upgrade with bootstrap 5.2
This commit is contained in:
+28
-20
@@ -3,18 +3,18 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Table.php
|
||||
Desc. : v3 - HTML Table v3 (jQuery & CoreUI)
|
||||
Desc. : v4 - HTML Table (jQuery & CoreUI)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 16th, 2008.
|
||||
Last Modified : May 8th, 2021.
|
||||
Last Modified : May 3rd, 2022.
|
||||
|
||||
(c) 2008 - 2021, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class Table {
|
||||
private $__tquery = "";
|
||||
@@ -23,18 +23,19 @@ final class Table {
|
||||
private $__afield = array();
|
||||
private $__astyle = array();
|
||||
private $__aformat = array();
|
||||
private $__afooter = array();
|
||||
private $__afooter = array();
|
||||
private $__aotype = array();
|
||||
private $__arowcol = array();
|
||||
private $__arow_func = array();
|
||||
private $__tfunc_select = "";
|
||||
private $__tfunc_navi = "";
|
||||
private $__tfunc_navi = "";
|
||||
private $__btxtbutton = false;
|
||||
private $__bnobutton = false;
|
||||
private $__bscrollbar = false;
|
||||
private $__acontrol = array('field'=>false, 'value'=>"");
|
||||
private $__acbox = array();
|
||||
private $__aoption = array();
|
||||
private $__npage_rec = 10; //baris per halaman
|
||||
private $__npage_rec = 10;
|
||||
private $__nreclimit = 0;
|
||||
private $__nscrollheight = 0;
|
||||
private $__ord_field = "";
|
||||
@@ -44,7 +45,7 @@ final class Table {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__cdb = $db; }
|
||||
else $this->__cdb = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__cdb = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
}
|
||||
|
||||
public function set_query($tquery = "") {
|
||||
@@ -99,8 +100,12 @@ final class Table {
|
||||
$this->__acontrol['value'] = $tvalue;
|
||||
}
|
||||
|
||||
public function add_row_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
|
||||
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => $ticon, 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue);
|
||||
public function add_row_form($tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
|
||||
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => "fon-tabel-dt", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue);
|
||||
}
|
||||
|
||||
public function add_row_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "", $tfield_css = "", $avalue_css = array()) {
|
||||
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => $ticon, 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue, 'field_css' => $tfield_css, 'avalue_css' => $avalue_css);
|
||||
}
|
||||
|
||||
public function add_row_del($tlabel = "", $tfunc = "", $tfield = "Unix", $tvalue = "") {
|
||||
@@ -122,21 +127,21 @@ final class Table {
|
||||
$this->__bnobutton = true;
|
||||
}
|
||||
|
||||
public function add_field($tfield = "", $theader = "", $tstyle = "left", $tformat = "", $tfooter = "") {
|
||||
public function add_field($tfield = "", $theader = "", $tstyle = "left", $tformat = "", $tfooter = "", $totype = "") {
|
||||
$this->__aheader[] = $theader;
|
||||
$this->__afield[] = $tfield;
|
||||
$this->__astyle[] = $tstyle;
|
||||
$this->__aformat[] = $tformat;
|
||||
$this->__afooter[] = $tfooter;
|
||||
$this->__afooter[] = $tfooter;
|
||||
$this->__aotype[] = $totype;
|
||||
}
|
||||
|
||||
public function json_table($nama_tabel = "tabel_", $baris_tabel = 10) {
|
||||
$adata = array();
|
||||
$dbpage = intval(\siaupheng\fonia3\Web\Param::Get($nama_tabel.'_pg', 0));
|
||||
|
||||
// adding header
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$adata['header'][] = array('f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i]);//add width later
|
||||
$adata['header'][] = array('f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i], 's'=>$this->__aotype[$i]);
|
||||
$njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -168,7 +173,7 @@ final class Table {
|
||||
for ($i=0; $i<count($this->__aoption); $i++) {
|
||||
if ($this->__aoption[$i]['type']=="button") {
|
||||
if (($this->__aoption[$i]['field']!="") && ($this->__cdb->Row($this->__aoption[$i]['field'])<>(trim("".$this->__aoption[$i]['value'])!="" ? $this->__aoption[$i]['value'] : $_SESSION['__WEB_USER']['UNIX']))) {} else {
|
||||
$aoption['button'][] = $this->__aoption[$i]['icon'];
|
||||
$aoption['button'][] = array($this->__aoption[$i]['icon'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??''));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,16 +207,19 @@ final class Table {
|
||||
|
||||
$adata['type'] = "table";
|
||||
$adata['id'] = $nama_tabel;
|
||||
$adata['config'] = array('css' => $this->__tcss, 'page' => $dbpage, 'row_count' => $baris_tabel, 'func_select' => $this->__tfunc_select, 'nobutton' => $this->__bnobutton, 'txtbutton' => $this->__btxtbutton, 'scrollbar' => $this->__bscrollbar, 'scroll_height' => $this->__nscrollheight, 'sort_col' => $this->__ord_field, 'sort_dir' => $this->__ord_dir);
|
||||
$adata['option'] = $this->__aoption;
|
||||
$adata['config'] = array('css' => $this->__tcss, 'row_count' => $baris_tabel, 'func_select' => $this->__tfunc_select, 'nobutton' => $this->__bnobutton, 'txtbutton' => $this->__btxtbutton, 'scrollbar' => $this->__bscrollbar, 'scroll_height' => $this->__nscrollheight, 'sort_col' => $this->__ord_field, 'sort_dir' => $this->__ord_dir);
|
||||
$adata['option'] = array();
|
||||
foreach ($this->__aoption as $aval) {
|
||||
if ($aval['type']!=="checkbox") unset($aval['field']); unset($aval['value']); unset($aval['field_css']); unset($aval['value_css']); $adata['option'][] = $aval;
|
||||
}
|
||||
$adata['navi'] = $anavi;
|
||||
$adata['content'] = $acontent;
|
||||
return $adata;
|
||||
}
|
||||
|
||||
public function json_table_db($nama_tabel = "tabel_", $baris_tabel = 10) {//new
|
||||
/*public function json_table_db($nama_tabel = "tabel_", $baris_tabel = 10) {//new
|
||||
$adata = array();
|
||||
$dbpage = \siaupheng\fonia3\Web\Param::Get($nama_tabel.'_pg', 0);
|
||||
$dbpage = \siaupheng\fonia4\Web\Param::Get($nama_tabel.'_pg', 0);
|
||||
|
||||
// adding header
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
@@ -286,7 +294,7 @@ final class Table {
|
||||
$adata['navi'] = $anavi;
|
||||
$adata['content'] = $acontent;
|
||||
return $adata;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user