datatable with livedata
This commit is contained in:
+59
-1
@@ -4,7 +4,7 @@
|
||||
Desc. : JS - Fonia Custom Class v3
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 19th, 2009.
|
||||
Last Modified : July 6th, 2023.
|
||||
Last Modified : October 16th, 2023.
|
||||
|
||||
(c) 2009 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -850,6 +850,61 @@ Request.JSONF = function(options){//oke
|
||||
|
||||
$(divData).append(strTab + strHead + strBody + strFoot + '</table>');
|
||||
var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{return JSON.parse(localStorage.getItem(ini.id));}catch(e){}} };
|
||||
/*****/
|
||||
if (ini.config.live){
|
||||
var post_data = {};
|
||||
$(vars.data).map(function(key, item){
|
||||
var keyval = item.split("=");
|
||||
return post_data[keyval[0]] = keyval[1];
|
||||
});
|
||||
opsi.serverSide = true;
|
||||
opsi.ajax = {
|
||||
url: vars.url,
|
||||
type: 'POST',
|
||||
data: post_data,
|
||||
dataFilter: function(data){
|
||||
var json = jQuery.parseJSON(data), jsono = {};
|
||||
jsono.draw = json[0].draw;
|
||||
jsono.recordsTotal = json[0].recordsTotal;
|
||||
jsono.recordsFiltered = json[0].recordsFiltered;
|
||||
jsono.data = json[0].data;
|
||||
|
||||
$.each(jsono.data, function(key, val){
|
||||
//strBody += '<tr'+(val[0].rowcss?' class="'+val[0].rowcss+'"':'')+'>';
|
||||
/*$.each(val, function(keyi, vali){
|
||||
if (keyi == 0) return;
|
||||
var _title = (ini.header[(keyi-1)].f.indexOf('awr') >= 0) ? ' title="' + vali.replace(/<br\s*[\/]?>/gi,'\n').replace(/(<([^>]+)>)/gi,'') + '"' : '';
|
||||
});*/
|
||||
// belum bisa css row/tr
|
||||
// belum bisa title u/ awr class
|
||||
var optval = val[0]; jsono.data[key].shift();
|
||||
if (ini.option.length > 0) {
|
||||
var _tbtn1 = "", _tbtn2 = "";
|
||||
if (optval.button.length > 0) {
|
||||
$.each(optval.button, function(keyb, valb){
|
||||
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : valb[0];
|
||||
var _cssa = (valb[1]=='') ? '' : ' text-'+valb[1];
|
||||
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
|
||||
if (ini.config.txtbutton === true) {
|
||||
_tbtn1 += '<button class="btn tbl-rowbtn d-none d-lg-inline-block '+valb[0]+_cssb+' me-2" type="button">'+aTombol[valb[0]]+'</button>';
|
||||
_tbtn2 += '<a class="table-icon d-lg-none '+valb[0]+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
|
||||
} else {
|
||||
_tbtn2 += '<a class="table-icon '+valb[0]+_cssa+'" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
|
||||
}
|
||||
})
|
||||
}
|
||||
if (optval.checkbox) {
|
||||
_tbtn1 += '<div><input class="form-check-input" type="checkbox" id="_cbox_'+optval.checkbox.field+'" value="'+optval.checkbox.value+'"></div>';
|
||||
}
|
||||
jsono.data[key].push(_tbtn1+_tbtn2);
|
||||
}
|
||||
});
|
||||
|
||||
return JSON.stringify(jsono);
|
||||
}
|
||||
};
|
||||
}
|
||||
/******/
|
||||
if (ini.option.length > 0) opsi.columnDefs.push({responsivePriority:3,targets:-1}, {orderable:false,targets:-1});
|
||||
if (ini.navi.func_navi == '') opsi.paging = false;
|
||||
var _lmenu = [];
|
||||
@@ -886,6 +941,9 @@ Request.JSONF = function(options){//oke
|
||||
if (ini.navi.button) $('#'+ini.id+'Tabel_wrapper div.toolbar').html(_navibar);
|
||||
}
|
||||
opsi.drawCallback = function(settings){
|
||||
/*var api = this.api();
|
||||
console.log( api.rows( {page:'current'} ).data() );
|
||||
console.log( settings );*/
|
||||
}
|
||||
|
||||
var otabel = $('#'+ini.id+'Tabel').DataTable(opsi);
|
||||
|
||||
+121
-124
@@ -6,7 +6,7 @@
|
||||
Desc. : v4 - HTML Table (jQuery & Bootstrap)
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : January 16th, 2008.
|
||||
Last Modified : May 18th, 2023.
|
||||
Last Modified : October 16th, 2023.
|
||||
|
||||
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -17,30 +17,32 @@ declare(strict_types=1);
|
||||
namespace siaupheng\fonia3\Web;
|
||||
|
||||
final class Table {
|
||||
private $__table = "";
|
||||
private $__tquery = "";
|
||||
private $__tquery_footer = "";
|
||||
private $__aheader = array();
|
||||
private $__afield = array();
|
||||
private $__astyle = array();
|
||||
private $__aformat = array();
|
||||
private $__afooter = array();
|
||||
private $__aotype = array();
|
||||
private $__arowcol = array();
|
||||
private $__arow_func = array();
|
||||
private $__aheader = [];
|
||||
private $__afield = [];
|
||||
private $__astyle = [];
|
||||
private $__aformat = [];
|
||||
private $__afooter = [];
|
||||
private $__aotype = [];
|
||||
private $__arowcol = [];
|
||||
private $__arow_func = [];
|
||||
private $__tfunc_select = "";
|
||||
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 $__acontrol = ['field'=>false, 'value'=>""];
|
||||
private $__acbox = [];
|
||||
private $__aoption = [];
|
||||
private $__npage_rec = 10;
|
||||
private $__nreclimit = 0;
|
||||
private $__nscrollheight = 0;
|
||||
private $__ord_field = "";
|
||||
private $__ord_dir = "A";
|
||||
private $__tcss = "";
|
||||
private $__livedata = false;
|
||||
protected $__cdb = null;
|
||||
|
||||
public function __construct($db = null){
|
||||
@@ -48,6 +50,10 @@ final class Table {
|
||||
else { $this->__cdb = new \siaupheng\fonia3\DB\MySQL(); }
|
||||
}
|
||||
|
||||
public function set_table($ttable = "") {
|
||||
$this->__table = $ttable;
|
||||
}
|
||||
|
||||
public function set_query($tquery = "") {
|
||||
$this->__tquery = $tquery;
|
||||
}
|
||||
@@ -80,7 +86,7 @@ final class Table {
|
||||
|
||||
public function set_row_color($tfield = "", $tval = "", $tcss = "") {
|
||||
if ($tfield=="") return;
|
||||
$this->__arowcol[] = array('F'=>$tfield, 'V'=>$tval, 'C'=>$tcss);
|
||||
$this->__arowcol[] = ['F'=>$tfield, 'V'=>$tval, 'C'=>$tcss];
|
||||
}
|
||||
|
||||
public function set_func_navi($tfunc = "") {
|
||||
@@ -92,7 +98,7 @@ final class Table {
|
||||
}
|
||||
|
||||
public function set_func_btn($tfunc = "", $tlabel = "") {
|
||||
$this->__arow_func[] = array('label' => $tlabel, 'func' => $tfunc);
|
||||
$this->__arow_func[] = ['label' => $tlabel, 'func' => $tfunc];
|
||||
}
|
||||
|
||||
public function set_row_control($tfield = "", $tvalue = "Y") {
|
||||
@@ -101,26 +107,26 @@ final class Table {
|
||||
}
|
||||
|
||||
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);
|
||||
$this->__aoption[] = ['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_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "", $tfield_css = "", $avalue_css = []) {
|
||||
$this->__aoption[] = ['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 = "") {
|
||||
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => "x", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue);
|
||||
$this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => "x", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue];
|
||||
}
|
||||
|
||||
public function add_row_edit($tlabel = "", $tfunc = "") {
|
||||
$this->add_row_btn("note", $tlabel, $tfunc);
|
||||
}
|
||||
|
||||
public function add_row_checkbox($tfield = "ID", $tcontrol = "Edit", $avalue = array("Y","N")) {
|
||||
public function add_row_checkbox($tfield = "ID", $tcontrol = "Edit", $avalue = ["Y","N"]) {
|
||||
$this->__acbox['field'] = $tfield;
|
||||
$this->__acbox['control'] = $tcontrol;
|
||||
$this->__acbox['avalue'] = $avalue;
|
||||
$this->__aoption[] = array('type' => "checkbox", 'field' => $tfield, 'avalue' => $avalue);
|
||||
$this->__aoption[] = ['type' => "checkbox", 'field' => $tfield, 'avalue' => $avalue];
|
||||
}
|
||||
|
||||
public function no_button() {
|
||||
@@ -137,11 +143,11 @@ final class Table {
|
||||
}
|
||||
|
||||
public function json_table($nama_tabel = "tabel_", $baris_tabel = 10) {
|
||||
$adata = array();
|
||||
$adata = []; $njml_kol = 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], 's'=>$this->__aotype[$i]);
|
||||
$adata['header'][] = ['f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i], 's'=>$this->__aotype[$i]];
|
||||
$njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -158,57 +164,59 @@ final class Table {
|
||||
} else {
|
||||
$tval2 = ($this->__afooter[$i]<>"") ? $this->__afooter[$i] : $tval;
|
||||
}
|
||||
$adata['footer'][] = array('c'=>$tval2);
|
||||
$adata['footer'][] = ['c'=>$tval2];
|
||||
}
|
||||
}
|
||||
|
||||
$acontent = array();
|
||||
$this->__cdb->Query($this->__tquery);
|
||||
while ($this->__cdb->Next()) {
|
||||
$abaris = array();
|
||||
$aoption = array('button'=>array());
|
||||
if (count($this->__aoption)>0) {
|
||||
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||
// adding all option
|
||||
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'][] = array($this->__aoption[$i]['icon'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??''));
|
||||
$acontent = [];
|
||||
if (!$this->__livedata) {
|
||||
$this->__cdb->Query($this->__tquery);
|
||||
while ($this->__cdb->Next()) {
|
||||
$abaris = [];
|
||||
$aoption = ['button'=>[]];
|
||||
if (count($this->__aoption)>0) {
|
||||
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||
// adding all option
|
||||
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'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??'')];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adding checkbox option
|
||||
if (array_key_exists("field", $this->__acbox)) {
|
||||
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
|
||||
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
|
||||
// adding checkbox option
|
||||
if (array_key_exists("field", $this->__acbox)) {
|
||||
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
|
||||
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($this->__arowcol)>0) {//up: 2014-06-13
|
||||
for ($i=0; $i<count($this->__arowcol); $i++) {
|
||||
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
|
||||
if (count($this->__arowcol)>0) {//up: 2014-06-13
|
||||
for ($i=0; $i<count($this->__arowcol); $i++) {
|
||||
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$abaris[] = $aoption;
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
|
||||
if (is_array($this->__aformat[$i])) {
|
||||
$tval = $this->__aformat[$i][$tval];
|
||||
} else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) {
|
||||
$tval = call_user_func($this->__aformat[$i], $tval);
|
||||
$abaris[] = $aoption;
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
|
||||
if (is_array($this->__aformat[$i])) {
|
||||
$tval = $this->__aformat[$i][$tval];
|
||||
} else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) {
|
||||
$tval = call_user_func($this->__aformat[$i], $tval);
|
||||
}
|
||||
$abaris[] = $tval;
|
||||
}
|
||||
$abaris[] = $tval;
|
||||
$acontent[] = $abaris;
|
||||
}
|
||||
$acontent[] = $abaris;
|
||||
}
|
||||
|
||||
// navigator
|
||||
$anavi = array('func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func );
|
||||
$anavi = [ 'func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func ];
|
||||
|
||||
$adata['type'] = "table";
|
||||
$adata['id'] = $nama_tabel;
|
||||
$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();
|
||||
$adata['config'] = ['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, 'live' => $this->__livedata];
|
||||
$adata['option'] = [];
|
||||
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;
|
||||
}
|
||||
@@ -217,85 +225,74 @@ final class Table {
|
||||
return $adata;
|
||||
}
|
||||
|
||||
/*public function json_table_db($nama_tabel = "tabel_", $baris_tabel = 10) {//new
|
||||
$adata = array();
|
||||
$dbpage = \siaupheng\fonia3\Web\Param::Get($nama_tabel.'_pg', 0);
|
||||
public function db_table($nama_tabel = "tabel_", $baris_tabel = 10) {
|
||||
$this->__livedata = true;
|
||||
$id_draw = intval($_REQUEST['draw'] ?? 0);//
|
||||
$i_start = intval($_REQUEST['start'] ?? 0);//
|
||||
$i_length = intval($_REQUEST['length'] ?? 0);//
|
||||
$i_order = intval($_REQUEST['order'] ?? 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
|
||||
$njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1;
|
||||
}
|
||||
|
||||
// adding footer
|
||||
if ($this->__tquery_footer) {
|
||||
$this->__cdb->Query($this->__tquery_footer);
|
||||
$this->__cdb->Next();
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$tval = $this->__cdb->Row($this->__afield[$i], 0);
|
||||
if (is_array($this->__afooter[$i])) {
|
||||
$tval2 = $this->__afooter[$i][$tval];
|
||||
} else if (function_exists($this->__afooter[$i])) {
|
||||
$tval2 = call_user_func($this->__afooter[$i], $tval);
|
||||
} else {
|
||||
$tval2 = ($this->__afooter[$i]<>"") ? $this->__afooter[$i] : $tval;
|
||||
}
|
||||
$adata['footer'][] = array('c'=>$tval2);
|
||||
if ($id_draw > 0) {
|
||||
$t_order = "ASC";
|
||||
if ($i_order <> 0) {
|
||||
$t_order = ($i_order[0]['dir']=="asc") ? "ASC" : "DESC";
|
||||
$i_order = $i_order[0]['column'];
|
||||
}
|
||||
}
|
||||
$sql_limit = ($i_start>=0 && $i_length != -1) ? " LIMIT ".$i_start.", ".$i_length : "";
|
||||
$sql_order = ($this->__afield[$i_order]) ? " ORDER BY ".$this->__afield[$i_order]." ".$t_order : "";
|
||||
|
||||
$acontent = array();
|
||||
$this->__cdb->Query($this->__tquery);
|
||||
while ($this->__cdb->Next()) {
|
||||
$abaris = array();
|
||||
$aoption = array('button'=>array());
|
||||
if (count($this->__aoption)>0) {
|
||||
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||
// adding all option
|
||||
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'];
|
||||
$record = 0;
|
||||
$this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__table);
|
||||
if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0));
|
||||
$adata['draw'] = $id_draw;
|
||||
$adata['recordsTotal'] = $record;
|
||||
$adata['recordsFiltered'] = $record;
|
||||
|
||||
$adata['data'] = [];
|
||||
$this->__cdb->Query("SELECT `".implode('`,`', $this->__afield)."` FROM ".$this->__table.$sql_order.$sql_limit);
|
||||
while ($this->__cdb->Next()) {
|
||||
$abaris = [];
|
||||
$aoption = ['button'=>[]];
|
||||
if (count($this->__aoption)>0) {
|
||||
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||
// adding all option
|
||||
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'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??'')];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adding checkbox option
|
||||
if (array_key_exists("field", $this->__acbox)) {
|
||||
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
|
||||
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
|
||||
// adding checkbox option
|
||||
if (array_key_exists("field", $this->__acbox)) {
|
||||
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
|
||||
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($this->__arowcol)>0) {//up: 2014-06-13
|
||||
for ($i=0; $i<count($this->__arowcol); $i++) {
|
||||
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
|
||||
if (count($this->__arowcol)>0) {//up: 2014-06-13
|
||||
for ($i=0; $i<count($this->__arowcol); $i++) {
|
||||
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$abaris[] = $aoption;
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
|
||||
if (is_array($this->__aformat[$i])) {
|
||||
$tval = $this->__aformat[$i][$tval];
|
||||
} else if (function_exists($this->__aformat[$i])) {
|
||||
$tval = call_user_func($this->__aformat[$i], $tval);
|
||||
$abaris[] = $aoption;
|
||||
for ($i=0; $i<count($this->__afield); $i++) {
|
||||
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
|
||||
if (is_array($this->__aformat[$i])) {
|
||||
$tval = $this->__aformat[$i][$tval];
|
||||
} else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) {
|
||||
$tval = call_user_func($this->__aformat[$i], $tval);
|
||||
}
|
||||
$abaris[] = $tval;
|
||||
}
|
||||
$abaris[] = $tval;
|
||||
$adata['data'][] = $abaris;
|
||||
}
|
||||
$acontent[] = $abaris;
|
||||
|
||||
} else {
|
||||
$adata = $this->json_table($nama_tabel, $baris_tabel);
|
||||
}
|
||||
|
||||
// navigator
|
||||
$anavi = array('func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func );
|
||||
|
||||
$adata['type'] = "table";
|
||||
$adata['id'] = $nama_tabel;
|
||||
$adata['config'] = array('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['navi'] = $anavi;
|
||||
$adata['content'] = $acontent;
|
||||
return $adata;
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user