upgrade with bootstrap 5.2
This commit is contained in:
+29
-16
@@ -3,31 +3,33 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /App.php
|
||||
Desc. : v3 - HTML5 Page Generator v3 (jQuery & CoreUI)
|
||||
Desc. : v4 - HTML5 Page Generator (jQuery & CoreUI)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 10th, 2008.
|
||||
Last Modified : May 8th, 2021.
|
||||
Last Modified : October 17th, 2022.
|
||||
|
||||
(c) 2008 - 2021, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3;
|
||||
namespace siaupheng\fonia4;
|
||||
|
||||
final class App {
|
||||
public $version = "3.0.0";
|
||||
public $version = "4.0.0";
|
||||
private $apps = array();
|
||||
private $auser = array();
|
||||
private $cache = null;
|
||||
private $menu = null;
|
||||
private $reg = null;
|
||||
protected $__db = null;
|
||||
protected $__form = null;
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
$this->__form = new \siaupheng\fonia4\Web\Form($this->__db);
|
||||
|
||||
$this->apps = $_SESSION['__WEB_APP'];
|
||||
$this->apps['TEMPLATE'] = "index.php";
|
||||
@@ -39,9 +41,9 @@ final class App {
|
||||
$this->auser['user_img'] = $this->auser['ID'].".webp";
|
||||
}
|
||||
}
|
||||
$this->reg = new \siaupheng\fonia3\Web\Register($this->__db);
|
||||
$this->cache = new \siaupheng\fonia3\Data\Cache($this->__db);
|
||||
$this->menu = new \siaupheng\fonia3\Web\Menu($this->__db);
|
||||
$this->reg = new \siaupheng\fonia4\Web\Register($this->__db);
|
||||
$this->cache = new \siaupheng\fonia4\Data\Cache($this->__db);
|
||||
$this->menu = new \siaupheng\fonia4\Web\Menu($this->__db);
|
||||
}
|
||||
|
||||
public function TampilApp($aoption = array()) {
|
||||
@@ -97,10 +99,10 @@ final class App {
|
||||
$buffer = str_replace($asrc, $adst, $buffer);
|
||||
|
||||
if (isset($this->auser) && is_array($this->auser)) {
|
||||
$buffer = str_replace("[_USER_ID_]", $this->auser['UserID'], $buffer);
|
||||
$buffer = str_replace("[_USER_USER_]", $this->auser['Username'], $buffer);
|
||||
$buffer = str_replace("[_USER_NAME_]", $this->auser['Nama'], $buffer);
|
||||
$buffer = str_replace("[_USER_POSISI_]", $this->auser['Posisi'], $buffer);
|
||||
$buffer = str_replace("[_USER_ID_]", $this->auser['UserID']??"", $buffer);
|
||||
$buffer = str_replace("[_USER_USER_]", $this->auser['Username']??"", $buffer);
|
||||
$buffer = str_replace("[_USER_NAME_]", $this->auser['Nama']??"", $buffer);
|
||||
$buffer = str_replace("[_USER_POSISI_]", $this->auser['Posisi']??"", $buffer);
|
||||
|
||||
// menu modul
|
||||
$t_modul = "";
|
||||
@@ -122,7 +124,15 @@ final class App {
|
||||
foreach ($this->auser['MENU_MODUL'] as $modul) {
|
||||
$href = $href1.$modul['APP_PATH'].$href2;
|
||||
$href .= '/?auth='.$_SESSION['APP_TOKEN'];
|
||||
$t_modul .= '<a class="dropdown-item slink" href="'.$href.'"><i class="c-icon mr-2 '.$modul['Icon'].'"></i> '.$modul['Judul'].'</a>';
|
||||
$t_modul .= '<a class="dropdown-item slink" href="'.$href.'"><i class="icon me-2 '.$modul['Icon'].'"></i> '.$modul['Judul'].'</a>';
|
||||
}
|
||||
}
|
||||
// menu extra
|
||||
$amodul_ext = $aoption['MENU_MODUL'] ?? [];
|
||||
if (count($amodul_ext) > 0) {
|
||||
$t_modul .= '<div class="dropdown-divider"></div>';
|
||||
foreach ($amodul_ext as $modul) {
|
||||
$t_modul .= '<a class="dropdown-item slink" id="'.$modul['Id'].'"><i class="icon me-2 '.$modul['Icon'].'"></i> '.$modul['Judul'].'</a>';
|
||||
}
|
||||
}
|
||||
$buffer = str_replace("[_MENU_MODUL_]", $t_modul, $buffer);
|
||||
@@ -141,10 +151,13 @@ final class App {
|
||||
if (count($aoption) > 0) {
|
||||
foreach ($aoption as $__key => $val) {
|
||||
if (strpos($__key, "OPTION")!==false) {
|
||||
$opt_var = (new cFORM())->option("Pilihan", $__key, $val['value'], true, $val['option']);
|
||||
$opt_var = $this->__form->option("_", $__key, $val['value'], true, true, $val['option']);
|
||||
$buffer = str_replace("[_".$__key."_]", $opt_var, $buffer);
|
||||
} else if (strpos($__key, "RADIO")!==false) {
|
||||
$opt_var = $this->__form->radio("_", $__key, $val['value'], true, true, $val['radio']);
|
||||
$buffer = str_replace("[_".$__key."_]", $opt_var, $buffer);
|
||||
} else if (strpos($__key, "PICKDATE")!==false) {
|
||||
$txt_var = (new cFORM())->datebox("Tanggal", $__key, $val['value'], true);
|
||||
$txt_var = $this->__form->datebox("_", $__key, $val['value'], true, true);
|
||||
$buffer = str_replace("[_".$__key."_]", $txt_var, $buffer);
|
||||
} else if (strpos($__key, "CUSTOM")!==false) {
|
||||
$buffer = str_replace("[_".$__key."_]", $val['value'], $buffer);
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /DB/CheckSQL.php
|
||||
Desc. : v3 - Class Check SQL / Repair Database
|
||||
Desc. : v4 - Class Check SQL / Repair Database
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 11th, 2011.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\DB;
|
||||
namespace siaupheng\fonia4\DB;
|
||||
|
||||
final class CheckSQL {
|
||||
private $__atabel = array();
|
||||
@@ -23,7 +23,7 @@ final class CheckSQL {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
|
||||
$this->__db->Query("SELECT TABLE_NAME,ENGINE,TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='".$this->__db->getDBName()."' AND TABLE_TYPE='BASE TABLE'");
|
||||
while ($this->__db->Next()) {
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /DB/DumpSQL.php
|
||||
Desc. : v3 - Class Dump Data SQL
|
||||
Desc. : v4 - Class Dump Data SQL
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 11th, 2011.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\DB;
|
||||
namespace siaupheng\fonia4\DB;
|
||||
|
||||
final class DumpSQL {
|
||||
private $__adata = array();
|
||||
@@ -23,7 +23,7 @@ final class DumpSQL {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
|
||||
$this->__adata = $this->__db->getConfig();
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /DB/MySQL.php
|
||||
Desc. : v3 - Class database MySQL / MariaDB
|
||||
Desc. : v4 - Class database MySQL / MariaDB
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 2nd, 2007.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\DB;
|
||||
namespace siaupheng\fonia4\DB;
|
||||
|
||||
final class MySQL {
|
||||
private $cnn;
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /DB/SQL.php
|
||||
Desc. : v3 - Class Query database
|
||||
Desc. : v4 - Class Query database
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 2nd, 2007.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\DB;
|
||||
namespace siaupheng\fonia4\DB;
|
||||
|
||||
final class SQL {
|
||||
private $__ttable = "";
|
||||
@@ -26,7 +26,7 @@ final class SQL {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
}
|
||||
|
||||
public function SafeSQL($ttext = "") {
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/CSV.php
|
||||
Desc. : v3 - Class pembuatan file CSV
|
||||
Desc. : v4 - Class pembuatan file CSV
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 2rd, 2011.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Data;
|
||||
namespace siaupheng\fonia4\Data;
|
||||
|
||||
define( DELI_CSV, ";" );
|
||||
define( CRLF_CSV, "\r\n" );
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/Cache.php
|
||||
Desc. : v3 - Class cache aplikasi
|
||||
Desc. : v4 - Class cache aplikasi
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 16th, 2008.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Data;
|
||||
namespace siaupheng\fonia4\Data;
|
||||
|
||||
use MatthiasMullie\Minify;
|
||||
|
||||
@@ -31,7 +31,7 @@ final class Cache {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else $this->__db = new \siaupheng\fonia4\DB\MySQL();
|
||||
|
||||
$rootdir = $_SESSION['__WEB_APP']['REAL_PATH'];
|
||||
$this->__cachedir = $rootdir . 'cache/';
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/PDF.php
|
||||
Desc. : v3 - Class pembuatan file PDF
|
||||
Desc. : v4 - Class pembuatan file PDF
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 18th, 2015.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Data;
|
||||
namespace siaupheng\fonia4\Data;
|
||||
|
||||
use Mpdf;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Function/Auth.php
|
||||
Desc. : Fungsi Custom Auth
|
||||
Desc. : v4 - Fungsi Custom Auth
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 27th, 2008.
|
||||
Last Modified : May 6th, 2021.
|
||||
|
||||
+10
-3
@@ -3,17 +3,24 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Function/JSON.php
|
||||
Desc. : Fungsi Custom JSON
|
||||
Desc. : v4 - Fungsi Custom JSON
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 14th, 2012.
|
||||
Last Modified : May 6th, 2021.
|
||||
Last Modified : April 29th, 2022.
|
||||
|
||||
(c) 2012 - 2021, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2012 - 2022, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if (!function_exists('is_json')) {
|
||||
function is_json($string) {
|
||||
json_decode($string);
|
||||
return json_last_error() === JSON_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('send_json')) {
|
||||
function send_json($ajson = array(), $bempty = false) {
|
||||
if (count($ajson) > 0 || $bempty == true) {
|
||||
|
||||
+12
-2
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Function/Misc.php
|
||||
Desc. : Fungsi Custom Lain Lain
|
||||
Desc. : v4 - Fungsi Custom Lain Lain
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 27th, 2008.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -135,7 +135,7 @@ if (!function_exists('abjad')) {
|
||||
if (!function_exists('checkbox')) {
|
||||
function checkbox($nilai = 0) {
|
||||
$bhasil = ((is_string($nilai) && ($nilai=="N" || $nilai=="0")) or (is_numeric($nilai) && $nilai==0) or (is_bool($nilai) && $nilai==false)) ? true : false;
|
||||
return '<input type="checkbox" '.(($bhasil)?"":"checked").' readonly />';
|
||||
return '<input class="form-check-input" type="checkbox" '.(($bhasil)?"":"checked").' readonly />';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,4 +323,14 @@ if (!function_exists('potong')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('format_bytes')) {
|
||||
function format_bytes($bytes) {
|
||||
if ($bytes < 1024) return $bytes.' B';
|
||||
elseif ($bytes < 1048576) return uang2($bytes / 1024).' KB';
|
||||
elseif ($bytes < 1073741824) return uang2($bytes / 1048576).' MB';
|
||||
elseif ($bytes < 1099511627776) return uang2($bytes / 1073741824).' GB';
|
||||
else return uang2($bytes / 1099511627776).' TB';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+5
-6
@@ -3,18 +3,18 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Auth.php
|
||||
Desc. : v3 - Fungsi login dan user checking
|
||||
Desc. : v4 - Fungsi login dan user checking
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 16th, 2008.
|
||||
Last Modified : May 8th, 2021.
|
||||
Last Modified : April 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 Auth {
|
||||
private $__id_reg = 0;
|
||||
@@ -22,8 +22,7 @@ final class Auth {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
$this->__id_reg = $_SESSION['__WEB_APP']['REG_ID'];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Button.php
|
||||
Desc. : v4 - Button Generator (jQuery & CoreUI)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 27th, 2008.
|
||||
Last Modified : April 4th, 2022.
|
||||
|
||||
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
class Button {
|
||||
private $__abutton = array();
|
||||
private $__bsepa = false;
|
||||
|
||||
public function __construct() {}
|
||||
private function add($type="info", $id="", $label="", $bmiss=false) {
|
||||
if ($id=="") $id = "random".rand(1000, 10000);
|
||||
$this->__abutton[] = array('type'=>$type, 'id'=>$id, 'label'=>$label, 'bmiss'=>$bmiss);
|
||||
}
|
||||
|
||||
public function separator() {
|
||||
$this->__abutton[] = array('type'=>"separator");
|
||||
$this->__bsepa = true;
|
||||
}
|
||||
public function primary($id="", $label="", $bmiss=false) {
|
||||
$this->add("primary", $id, $label, $bmiss);
|
||||
}
|
||||
public function info($id="", $label="", $bmiss=false) {
|
||||
$this->add("info", $id, $label, $bmiss);
|
||||
}
|
||||
public function danger($id="", $label="", $bmiss=false) {
|
||||
$this->add("danger", $id, $label, $bmiss);
|
||||
}
|
||||
public function warning($id="", $label="", $bmiss=false) {
|
||||
$this->add("warning", $id, $label, $bmiss);
|
||||
}
|
||||
public function success($id="", $label="", $bmiss=false) {
|
||||
$this->add("success", $id, $label, $bmiss);
|
||||
}
|
||||
public function secondary($id="", $label="", $bmiss=false) {
|
||||
$this->add("secondary", $id, $label, $bmiss);
|
||||
}
|
||||
|
||||
public function Button($size=2) {
|
||||
if (0==count($this->__abutton)) return "";
|
||||
$items = count($this->__abutton) - ($this->__bsepa==true ? 1 : 0);
|
||||
$sepa_size = (12 == $items*$size) ? 0 : 12 - ($items*$size);
|
||||
$_out = '<div class="row mb-2">';
|
||||
foreach ($this->__abutton as $item) {
|
||||
if ("separator" == $item['type']) {
|
||||
if (0 < $sepa_size) $_out .= '<div class="d-none d-lg-block col-lg-'.$sepa_size.'"> </div>';
|
||||
} else {
|
||||
$_out .= '<div class="col-md-'.floor($size*2).' col-lg-'.$size.' mb-sm-0"><button type="button" class="btn btn-block btn-'.$item['type'].' shadow-none" id="'.$item['id'].'"'.(true==$item['bmiss']?' data-coreui-dismiss="modal"':'').'>'.$item['label'].'</button></div>';
|
||||
}
|
||||
}
|
||||
$_out .= '</div>';
|
||||
return $_out;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+48
-92
@@ -3,18 +3,18 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Form.php
|
||||
Desc. : v3 - Form Generator v3 (jQuery & CoreUI)
|
||||
Desc. : v4 - Form Generator (jQuery & CoreUI)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 27th, 2008.
|
||||
Last Modified : May 22nd, 2021.
|
||||
Last Modified : April 17th, 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 Form {
|
||||
private $__aform = array();
|
||||
@@ -25,17 +25,16 @@ final class Form {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
$this->__button = new Button();
|
||||
}
|
||||
|
||||
public function option($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null, $bmulti=false) {//oke
|
||||
public function option($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null, $bmulti=false) {
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_change = ($tchange==null) ? "" : ' onchange="'.$tchange.'"';
|
||||
$_multi = ($bmulti==true) ? ' multiple=true' : "";
|
||||
$tout = '<select class="form-control option-tags" id="'.$tfield.'" name="'.$tfield.'"'.$_enab.$_change.$_req.$_multi.' >';
|
||||
$_change = ($tchange==null) ? '' : ' onchange="'.$tchange.'"';
|
||||
$_multi = ($bmulti==true) ? ' multiple' : '';
|
||||
$tout = '<select class="form-select option-tags" id="'.$tfield.'" name="'.$tfield.'"'.$_enab.$_change.$_req.$_multi.' >';
|
||||
if (count($aarr)>0) {
|
||||
foreach ($aarr as $key => $val) {
|
||||
$_val2 = $val; $olabel = "";
|
||||
@@ -55,7 +54,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function option_db($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $ttable=null, $afield=null, $twhere=null, $addarray=null, $thelp="", $tchange=null, $bmulti=false) {//oke
|
||||
public function option_db($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $ttable=null, $afield=null, $twhere=null, $addarray=null, $thelp=null, $tchange=null, $bmulti=false) {
|
||||
$afield = ($afield==null) ? array("ID", "Nama", "Label") : $afield;
|
||||
$_twhere = ($twhere==null) ? "" : " WHERE ".$twhere;
|
||||
$_twhere .= ($twhere===null || stripos($twhere,"ORDER BY")===false) ? " ORDER BY ".$afield[1] : "";
|
||||
@@ -71,7 +70,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function option_que($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $tquery=null, $afield=null, $addarray=null, $thelp="", $tchange=null) {//oke
|
||||
public function option_que($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $tquery=null, $afield=null, $addarray=null, $thelp="", $tchange=null) {
|
||||
$afield = ($afield==null) ? array("ID", "Nama", "Label") : $afield;
|
||||
$ahasil = array();
|
||||
if (is_array($addarray)) $ahasil[$addarray[0]] = (!isset($afield[2])) ? $addarray[1] : array($addarray[1], $addarray[2]);
|
||||
@@ -85,18 +84,18 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function option_jkl($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {//oke
|
||||
public function option_jkl($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {
|
||||
$akel = array("L" => "Laki-Laki", "P" => "Perempuan");
|
||||
$tout = $this->option($tlabel, $tfield, $tvalue, $benable, $breq, $akel, $thelp, $tchange);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function option_ulevel($tlabel="", $tfield, $tvalue=9, $benable=true, $breq=false, $thelp="", $tchange=null) {//oke
|
||||
public function option_ulevel($tlabel="", $tfield, $tvalue=9, $benable=true, $breq=false, $thelp="", $tchange=null) {
|
||||
$tout = $this->option($tlabel, $tfield, $tvalue, $benable, $breq, $_SESSION['__WEB_APP']['USER_LEVEL'], $thelp, $tchange);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function radio($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null) {//oke
|
||||
public function radio($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null) {
|
||||
if ($tvalue == null) {
|
||||
$tmp_key = array_keys($aarr);
|
||||
$tvalue = $tmp_key[0];
|
||||
@@ -117,42 +116,43 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function radio_jkl($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {//oke
|
||||
public function radio_jkl($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {
|
||||
$tout = $this->radio($tlabel, $tfield, $tvalue, $benable, $breq, array("L" => "Laki-Laki", "P" => "Perempuan"), $thelp, $tchange);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function radio_gd($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {//oke
|
||||
public function radio_gd($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tchange=null) {
|
||||
$tvalue = ($tvalue=="") ? "X" : $tvalue;
|
||||
$tout = $this->radio($tlabel, $tfield, $tvalue, $benable, $breq, array("A"=>"A", "B"=>"B", "AB"=>"AB", "O"=>"O", "X"=>"NONE"), $thelp, $tchange);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function checkbox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $avalue=array(), $thelp="", $tchange=null) {//oke
|
||||
public function checkbox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $avalue=array(), $thelp="", $tchange=null) {
|
||||
$bhasil = ((is_string($tvalue) && in_array($tvalue,array("N","T","0"))) or (is_numeric($tvalue) && $tvalue==0) or (is_bool($tvalue) && $tvalue===false) or empty($tvalue)) ? true : false;
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_change = ($tchange==null) ? ' onchange="this.value=(this.checked)?\''.$avalue[0].'\':\''.$avalue[1].'\';"' : ' onchange="this.value=(this.checked)?\''.$avalue[0].'\':\''.$avalue[1].'\';'.$tchange.'"';
|
||||
$tout .= '<div class="form-check form-check-inline mr-1"><input type="checkbox" class="form-check-input" id="'.$tfield.'" name="'.$tfield.'" value="'.($bhasil?$avalue[1]:$avalue[0]).'"'.$_enab.$_change.$_req;
|
||||
$tout = '<div class="form-check form-check-inline mr-1"><input type="checkbox" class="form-check-input" id="'.$tfield.'" name="'.$tfield.'" value="'.($bhasil?$avalue[1]:$avalue[0]).'"'.$_enab.$_change.$_req;
|
||||
$tout .= ($bhasil==false) ? ' checked="checked"' : '';
|
||||
$tout .= '></div>';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>$thelp, 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function switch_sq($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null) {//oke
|
||||
//todo: perlu test lagi !!
|
||||
public function switch_sq($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $aarr=array(), $thelp="", $tchange=null) {
|
||||
$_key = array_keys($aarr); $_val = array_values($aarr);
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_change = ($tchange==null) ? ' onchange="this.value=(this.checked)?\''.$_key[0].'\':\''.$_key[1].'\';"' : ' onchange="this.value=(this.checked)?\''.$_key[0].'\':\''.$_key[1].'\';'.$tchange.'"';
|
||||
$tout = '<label class="c-switch c-switch-label c-switch-info"><input class="c-switch-input" type="checkbox" id="'.$tfield.'" name="'.$tfield.'" value="'.$tvalue.'"'.$_enab.$_change.$_req;
|
||||
$tout = '<div class="form-check form-switch form-switch-lg"><input class="form-check-input me-0" id="'.$tfield.'" name="'.$tfield.'" type="checkbox" value="'.$tvalue.'"'.$_enab.$_change.$_req;
|
||||
$tout .= ($_key[0] == $tvalue) ? ' checked="checked"' : '';
|
||||
$tout .= '><span class="c-switch-slider" data-checked="'.$_val[0].'" data-unchecked="'.$_val[1].'"></span></label>';
|
||||
$tout .= '><label class="form-check-label fw-semibold small" for="'.$tfield.'"> </label></div>';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>$thelp, 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
/* belum diupgrade !! */
|
||||
//todo: belum diupgrade !!
|
||||
public function form_group_cbox($tfield, $tkey=null, $tclass=null, $ttable=null, $afield=null, $ncol=2) {
|
||||
if ($ttable==null) return;
|
||||
$avalue = explode(",", $tkey);
|
||||
@@ -182,7 +182,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textbox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $ttype="text", $holdtxt=null, $nmaxsize=null, $thelp="", $tkeyup=null, $tblur=null) {//oke
|
||||
public function textbox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $ttype="text", $holdtxt=null, $nmaxsize=null, $thelp="", $tkeyup=null, $tblur=null) {
|
||||
$_enab = ($benable==true) ? "" : ' readonly';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_max = ($nmaxsize==null) ? "" : ' maxlength="'.$nmaxsize.'"';
|
||||
@@ -203,7 +203,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textauto($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="") {//oke
|
||||
public function textauto($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="") {
|
||||
$tvalue = ($tvalue==null) ? array('value'=>0, 'text'=>"") : $tvalue;
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
@@ -214,21 +214,21 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function datebox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tkeyup=null, $tblur=null) {//oke
|
||||
public function datebox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tkeyup=null, $tblur=null) {
|
||||
if ($tvalue<>null) $tvalue = tgl_sql2str($tvalue);
|
||||
$tout = '<div class="input-group">';
|
||||
$tout .= $this->textbox($tlabel, $tfield, $tvalue, $benable, $breq, "pickdate", "dd-mm-yyyy", 12, $thelp, $tkeyup, $tblur);
|
||||
$tout .= '<div class="input-group-append"><span class="input-group-text"><i class="cui-calendar"></i></span></div></div>';
|
||||
$tout .= '<span class="input-group-text"><i class="cui-calendar"></i></span></div>';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>$thelp, 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function timebox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tkeyup=null, $tblur=null) {//oke
|
||||
public function timebox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tkeyup=null, $tblur=null) {
|
||||
$tout = $this->textbox($tlabel, $tfield, $tvalue, $benable, $breq, "picktime", "hh:mm:ss", 10, $thelp, $tkeyup, $tblur);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textarea($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $nrows=1, $holdtxt=null, $thelp="", $tkeyup=null, $tblur=null) {//oke
|
||||
public function textarea($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $nrows=1, $holdtxt=null, $thelp="", $tkeyup=null, $tblur=null) {
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_rows = ($nrows==null) ? "" : ' rows="'.$nrows.'"';
|
||||
@@ -240,24 +240,30 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function password($tlabel="", $tfield, $tvalue="", $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="", $tkeyup=null) {//oke
|
||||
public function plaintext($tlabel="", $tfield, $tvalue=null) {
|
||||
$tout = '<input type="text" class="form-control-plaintext" id="'.$tfield.'" name="'.$tfield.'" value="'.$tvalue.'" readonly />';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>"", 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function password($tlabel="", $tfield, $tvalue="", $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="", $tkeyup=null) {
|
||||
$tout = $this->textbox($tlabel, $tfield, $tvalue, $benable, $breq, "password", $holdtxt, $nmaxsize, $thelp, $tkeyup, $tblur);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function hidden($tfield, $tvalue="", $tclass="text") {//oke
|
||||
public function hidden($tfield, $tvalue="", $tclass="text") {
|
||||
$tout = '<input type="hidden" id="'.$tfield.'" value="'.$tvalue.'" class="'.$tclass.'" />';
|
||||
$this->__ahide[$tfield] = $tout;
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function clear() {//oke
|
||||
public function clear() {
|
||||
$this->__aform = array();
|
||||
}
|
||||
|
||||
public function show($tstr) {//oke
|
||||
public function show($tstr) {
|
||||
foreach ($this->__aform as $_key => $_val) {
|
||||
$tval = '<div class="form-row mb-1"><label class="col-sm-5 col-lg-4 col-form-label" for="'.$_key.'">'.$_val['label'].'</label><div class="col-sm-7 col-lg-8">'.$_val['form'].($_val['help']==""?'':'<span class="help-block"><small>'.$_val['help'].'</small></span>').'</div></div>';
|
||||
$tval = '<div class="row mb-1"><label class="col-sm-5 col-lg-4 col-form-label" for="'.$_key.'">'.$_val['label'].'</label><div class="col-sm-7 col-lg-8">'.$_val['form'].($_val['help']==""?'':'<span class="help-block"><small>'.$_val['help'].'</small></span>').'</div></div>';
|
||||
$tstr = str_replace("_".$_key."_", $tval, $tstr);
|
||||
}
|
||||
$txtbtn = $this->__button->Button($this->__nbtnsize);
|
||||
@@ -273,80 +279,30 @@ final class Form {
|
||||
echo $tstr;
|
||||
}
|
||||
|
||||
public function btn_separator() {//oke
|
||||
public function btn_separator() {
|
||||
$this->__button->separator();
|
||||
}
|
||||
public function btn_primary($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_primary($id="", $label="", $bmiss=false) {
|
||||
$this->__button->primary($id, $label, $bmiss);
|
||||
}
|
||||
public function btn_info($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_info($id="", $label="", $bmiss=false) {
|
||||
$this->__button->info($id, $label, $bmiss);
|
||||
}
|
||||
public function btn_danger($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_danger($id="", $label="", $bmiss=false) {
|
||||
$this->__button->danger($id, $label, $bmiss);
|
||||
}
|
||||
public function btn_warning($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_warning($id="", $label="", $bmiss=false) {
|
||||
$this->__button->warning($id, $label, $bmiss);
|
||||
}
|
||||
public function btn_success($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_success($id="", $label="", $bmiss=false) {
|
||||
$this->__button->success($id, $label, $bmiss);
|
||||
}
|
||||
public function btn_secondary($id="", $label="", $bmiss=false) {//oke
|
||||
public function btn_secondary($id="", $label="", $bmiss=false) {
|
||||
$this->__button->secondary($id, $label, $bmiss);
|
||||
}
|
||||
public function Button($size=2) {//oke
|
||||
public function Button($size=2) {
|
||||
$this->__nbtnsize = $size;
|
||||
}
|
||||
}
|
||||
|
||||
class Button {
|
||||
private $__abutton = array();
|
||||
private $__bsepa = false;
|
||||
|
||||
public function __construct() {}
|
||||
private function add($type="info", $id="", $label="", $bmiss=false) {//oke
|
||||
if ($id=="") $id = "random".rand(1000, 10000);
|
||||
$this->__abutton[] = array('type'=>$type, 'id'=>$id, 'label'=>$label, 'bmiss'=>$bmiss);
|
||||
}
|
||||
|
||||
public function separator() {//oke
|
||||
$this->__abutton[] = array('type'=>"separator");
|
||||
$this->__bsepa = true;
|
||||
}
|
||||
public function primary($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("primary", $id, $label, $bmiss);
|
||||
}
|
||||
public function info($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("info", $id, $label, $bmiss);
|
||||
}
|
||||
public function danger($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("danger", $id, $label, $bmiss);
|
||||
}
|
||||
public function warning($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("warning", $id, $label, $bmiss);
|
||||
}
|
||||
public function success($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("success", $id, $label, $bmiss);
|
||||
}
|
||||
public function secondary($id="", $label="", $bmiss=false) {//oke
|
||||
$this->add("secondary", $id, $label, $bmiss);
|
||||
}
|
||||
|
||||
public function Button($size=2) {//oke
|
||||
if (0==count($this->__abutton)) return "";
|
||||
$items = count($this->__abutton) - ($this->__bsepa==true ? 1 : 0);
|
||||
$sepa_size = (12 == $items*$size) ? 0 : 12 - ($items*$size);
|
||||
$_out = '<div class="row mb-3">';
|
||||
foreach ($this->__abutton as $item) {
|
||||
if ("separator" == $item['type']) {
|
||||
if (0 < $sepa_size) $_out .= '<div class="d-none d-lg-block col-lg-'.$sepa_size.'"> </div>';
|
||||
} else {
|
||||
$_out .= '<div class="col-md-'.floor($size*2).' col-lg-'.$size.' mb-1 mb-sm-0"><button type="button" class="btn btn-block btn-'.$item['type'].'" id="'.$item['id'].'"'.(true==$item['bmiss']?' data-dismiss="modal"':'').'>'.$item['label'].'</button></div>';
|
||||
}
|
||||
}
|
||||
$_out .= '</div>';
|
||||
return $_out;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+47
-76
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/HTMLPrint.php
|
||||
Desc. : v3 - Class cetak HTML
|
||||
Desc. : v4 - Class cetak HTML
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,36 +14,36 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class HTMLPrint {
|
||||
private $__avalue = array();
|
||||
private $__astyle = array();
|
||||
private $__atabel = array();
|
||||
private $__css = "pnormal";
|
||||
|
||||
public function __construct() {//
|
||||
}
|
||||
private $__avalue = array();
|
||||
private $__astyle = array();
|
||||
private $__atabel = array();
|
||||
private $__css = "table";
|
||||
|
||||
public function __construct() {//
|
||||
}
|
||||
|
||||
public function set_css($style = "") {//
|
||||
if ($style=="") return;
|
||||
$this->__css = $style;
|
||||
}
|
||||
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="", $nkol=1) {//up 2012-03-07
|
||||
$this->__atabel[] = array($tnama, $nlebar, $ffunc, $talign, $nkol);
|
||||
}
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="", $nkol=1) {//up 2012-03-07
|
||||
$this->__atabel[] = array($tnama, $nlebar, $ffunc, $talign, $nkol);
|
||||
}
|
||||
|
||||
public function show_fields() {//
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
public function show_fields() {//
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
if ($this->__atabel[$i][4]==0) continue;
|
||||
$tmp_out .= $this->set_align($this->__atabel[$i][0], $this->__atabel[$i][1], "C", false, true, $this->__atabel[$i][4]);
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
$this->__astyle[] = "L";
|
||||
}
|
||||
$tmp_out .= $this->set_align($this->__atabel[$i][0], $this->__atabel[$i][1], "C", false, true, $this->__atabel[$i][4]);
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
$this->__astyle[] = "L";
|
||||
}
|
||||
|
||||
public function clear() {//
|
||||
$this->__avalue = array();
|
||||
@@ -56,9 +56,9 @@ final class HTMLPrint {
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][2]) && trim($tmp_val)<>"") { //up 2010-05-28
|
||||
if (is_array($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") { //up 2010-05-28
|
||||
$tmp_val = $this->__atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
|
||||
}
|
||||
$tmp_val = $this->set_align($tmp_val, $this->__atabel[$i][1], $this->__atabel[$i][3]);
|
||||
@@ -78,7 +78,7 @@ final class HTMLPrint {
|
||||
if (!isset($tmp_val[2])) $tmp_val[2] = "L";
|
||||
if (!isset($tmp_val[4])) $tmp_val[4] = "";
|
||||
if (isset($tmp_val[3])) {
|
||||
if (function_exists($tmp_val[3]) && trim($tmp_val[0])<>"") {
|
||||
if (function_exists($tmp_val[3]) && trim("".$tmp_val[0])<>"") {
|
||||
$tmp_val[0] = call_user_func($tmp_val[3], $tmp_val[0]);
|
||||
}
|
||||
}
|
||||
@@ -90,40 +90,11 @@ final class HTMLPrint {
|
||||
$this->__astyle[] = "L";
|
||||
}
|
||||
|
||||
public function add($ttext = "", $tstyle = "L") {//todo:delete
|
||||
$this->__avalue[] = $ttext;
|
||||
$this->__astyle[] = $tstyle;
|
||||
}
|
||||
|
||||
public function addl($ttext = "") {//todo:delete
|
||||
$this->add($ttext);
|
||||
}
|
||||
|
||||
public function addr($ttext = "") {//todo:delete
|
||||
$this->add($ttext, "R");
|
||||
}
|
||||
|
||||
public function addc($ttext = "") {//todo:delete
|
||||
$this->add($ttext, "C");
|
||||
}
|
||||
|
||||
public function add_line() {//todo:delete
|
||||
$this->add("__LINE ");
|
||||
}
|
||||
|
||||
public function add_empty($nrep = 1) {//todo:delete
|
||||
for ($i=0;$i<$nrep;$i++) $this->add(" ");
|
||||
}
|
||||
|
||||
public function add_pagebreak() {//up 2012-10-11
|
||||
$this->add("</tbody></table><p id=\"linebreak\">................ page break ................</p>", "PB");
|
||||
$this->add("<p id=\"pagebreak\"> </p><table class=\"".$this->__css."\" border=\"0\" width=\"100%\" cellspading=\"0\" cellspacing=\"0\"><tbody>", "PB");
|
||||
}
|
||||
|
||||
public function show_pagebreak() {//del
|
||||
echo "<p id=\"linebreak\">................ page break ................</p><p id=\"pagebreak\"> </p>";
|
||||
}
|
||||
|
||||
public function add_stamp($ctk_ke=1, $bnama=false) {//up 2011-03-25
|
||||
$this->add($_SESSION['__WEB_APP']['APP_NAME']."v".$_SESSION['__WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):""), "NB");
|
||||
}
|
||||
@@ -132,41 +103,41 @@ final class HTMLPrint {
|
||||
return $_SESSION['__WEB_APP']['APP_NAME']."v".$_SESSION['__WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
}
|
||||
|
||||
public function show($jumlah_ctk=1) {//up 2012-10-11
|
||||
$out = "<p id=\"autopage\"> </p>";
|
||||
$out .= "<table class=\"".$this->__css."\" width=\"100%\"><tbody>";
|
||||
public function show($jumlah_ctk=1) {//up 2012-10-11
|
||||
$out = "<p id=\"autopage\"> </p>";
|
||||
$out .= "<table class=\"".$this->__css."\" width=\"100%\"><tbody>";
|
||||
|
||||
// content out
|
||||
for ($i=0; $i<count($this->__avalue); $i++) {
|
||||
$tmp_str = $this->__avalue[$i];
|
||||
// content out
|
||||
for ($i=0; $i<count($this->__avalue); $i++) {
|
||||
$tmp_str = $this->__avalue[$i];
|
||||
if ($this->__astyle[$i]=="PB") {
|
||||
$out .= $tmp_str;
|
||||
continue;
|
||||
}
|
||||
if (strpos($tmp_str, "_LINE")>0) $tmp_str = "<hr />";
|
||||
$out .= $this->set_align($tmp_str, 0, $this->__astyle[$i], true);
|
||||
}
|
||||
$out .= "</tbody></table>";
|
||||
if (strpos($tmp_str, "_LINE")>0) $tmp_str = "<hr />";
|
||||
$out .= $this->set_align($tmp_str, 0, $this->__astyle[$i], true);
|
||||
}
|
||||
$out .= "</tbody></table>";
|
||||
|
||||
for ($i=1; $i<=$jumlah_ctk; $i++) echo $out;
|
||||
}
|
||||
}
|
||||
|
||||
public function set_align($ttext, $nlen, $tdir="L", $bline=false, $bhead=false, $ncol=1, $textra="") {//up 2011-04-14
|
||||
public function set_align($ttext, $nlen, $tdir="L", $bline=false, $bhead=false, $ncol=1, $textra="") {//up 2011-04-14
|
||||
$tstyle = $this->create_style($tdir);
|
||||
if (strpos(strtolower($ttext), "<tr>")===false) { //jika tidak ada <tr> up 2011-04-14
|
||||
if ($bline===true) {
|
||||
return "<tr><td colspan=\"".count($this->__atabel)."\" class=\"".$tstyle." ".$textra."\">".$ttext."</td></tr>";
|
||||
} else {
|
||||
return (($bhead===true)?"<th":"<td").(($ncol>1)?" colspan=\"".$ncol."\"":"")." class=\"".$tstyle." ".$textra."\" ".(($bhead===true)?"width=\"".$nlen."\"":"").">".$ttext.(($bhead===true)?"</th>":"</td>");
|
||||
}
|
||||
} else {
|
||||
return (($bline===true) ? $ttext : (($bhead===true)?"<th":"<td").(($ncol>1)?" colspan=\"".$ncol."\"":"")." class=\"".$tstyle." ".$textra."\" ".(($bhead===true)?"width=\"".$nlen."\"":"").">".$ttext.(($bhead===true)?"</th>":"</td>"));
|
||||
}
|
||||
}
|
||||
if (strpos(strtolower("".$ttext), "<tr>")===false) { //jika tidak ada <tr> up 2011-04-14
|
||||
if ($bline===true) {
|
||||
return "<tr><td colspan=\"".count($this->__atabel)."\" class=\"".$tstyle." ".$textra."\">".$ttext."</td></tr>";
|
||||
} else {
|
||||
return (($bhead===true)?"<th":"<td").(($ncol>1)?" colspan=\"".$ncol."\"":"")." class=\"".$tstyle." ".$textra."\" ".(($bhead===true)?"width=\"".$nlen."\"":"").">".$ttext.(($bhead===true)?"</th>":"</td>");
|
||||
}
|
||||
} else {
|
||||
return (($bline===true) ? $ttext : (($bhead===true)?"<th":"<td").(($ncol>1)?" colspan=\"".$ncol."\"":"")." class=\"".$tstyle." ".$textra."\" ".(($bhead===true)?"width=\"".$nlen."\"":"").">".$ttext.(($bhead===true)?"</th>":"</td>"));
|
||||
}
|
||||
}
|
||||
|
||||
private function create_style($tstyle="L") { //up 2014-10-12
|
||||
// style = Left Right Center No-Border No-Left No-Right Bold Italic
|
||||
$apad = array("L"=>"left", "R"=>"right", "C"=>"center", "NB"=>"nb", "NL"=>"noleft", "NR"=>"noright", "B"=>"bold", "I"=>"italic");
|
||||
$apad = array("L"=>"l", "R"=>"r", "C"=>"c", "NB"=>"nb", "NL"=>"noleft", "NR"=>"noright", "B"=>"b", "I"=>"i");
|
||||
$_astyle = explode(",", $tstyle);
|
||||
$thasil = "";
|
||||
foreach ($_astyle as $_key => $_val) {
|
||||
|
||||
+20
-37
@@ -3,25 +3,24 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Menu.php
|
||||
Desc. : v3 - Class menu
|
||||
Desc. : v4 - Class menu
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 16th, 2008.
|
||||
Last Modified : May 8th, 2021.
|
||||
Last Modified : May 1st, 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 Menu {
|
||||
protected $__db = null;
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
$this->__db = $db ?? new \siaupheng\fonia4\DB\MySQL();
|
||||
}
|
||||
|
||||
private function Menu_Query($qry = "", $order = "Kode") {
|
||||
@@ -34,7 +33,7 @@ final class Menu {
|
||||
return $ahasil;
|
||||
}
|
||||
|
||||
public function Menu_Sidebar() {
|
||||
public function Menu_Sidebar() {//oke
|
||||
$a_modul = array();
|
||||
$is_modul = (isset($_SESSION['__WEB_APP']['APP_MODULE']) && $_SESSION['__WEB_APP']['APP_MODULE'] <> "") ? true : false;
|
||||
if ($is_modul == true) {
|
||||
@@ -61,11 +60,11 @@ final class Menu {
|
||||
}
|
||||
if (($amodul[$i]['Level']>=0) && (isset($amodul[$i+1]) && ($amodul[$i+1]['Level']>$amodul[$i]['Level']))) {
|
||||
$ticon = ($amodul[$i]['Icon']) ? $amodul[$i]['Icon'] : "cui-puzzle";
|
||||
$thasil .= '<li class="c-nav-item c-nav-dropdown '.($i==0?'c-open':'').'"><a class="c-nav-link c-nav-dropdown-toggle" title="'.$amodul[$i]['Judul'].'"><i class="c-nav-icon '.$ticon.'"></i> '.$amodul[$i]['Menu'].'</a><ul class="c-nav-dropdown-items">';
|
||||
$thasil .= '<li class="nav-group '.($i==0?'show':'').'"><a class="nav-link nav-group-toggle" title="'.$amodul[$i]['Judul'].'"><i class="nav-icon '.$ticon.'"></i> '.$amodul[$i]['Menu'].'</a><ul class="nav-group-items">';
|
||||
} else if (trim($amodul[$i]['Menu'])=="-") {
|
||||
$thasil .= '<li class="c-nav-divider"></li>';
|
||||
$thasil .= '<li class="nav-divider"></li>';
|
||||
} else {
|
||||
$thasil .= '<li class="c-nav-item"><a class="c-nav-link mlink" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'"><span class="c-nav-icon"></span> '.$amodul[$i]['Menu'].'</a></li>';
|
||||
$thasil .= '<li class="nav-item"><a class="nav-link mlink" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'"><span class="nav-icon"></span> '.$amodul[$i]['Menu'].'</a></li>';
|
||||
}
|
||||
$last_level = $amodul[$i]['Level'];
|
||||
}
|
||||
@@ -73,7 +72,7 @@ final class Menu {
|
||||
return $thasil;
|
||||
}
|
||||
|
||||
public function Menu_Header() {
|
||||
public function Menu_Header() {//oke
|
||||
$a_modul = array();
|
||||
$is_modul = (isset($_SESSION['__WEB_APP']['APP_MODULE']) && $_SESSION['__WEB_APP']['APP_MODULE'] <> "") ? true : false;
|
||||
$mulai_level = 0;
|
||||
@@ -102,18 +101,18 @@ final class Menu {
|
||||
}
|
||||
if (isset($amodul[$i+1]) && ($amodul[$i+1]['Level']>$amodul[$i]['Level'])) {
|
||||
if ($amodul[$i]['Level']==$mulai_level) {
|
||||
$ticon = ($amodul[$i]['Icon']) ? " mr-1 ".$amodul[$i]['Icon'] : "";
|
||||
$thasil .= '<li class="c-header-nav-item px-3"><a class="c-header-nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="'.$amodul[$i]['Judul'].'"><i class="c-nav-icon'.$ticon.'"></i> '.$amodul[$i]['Menu'].'<b class="caret"></b></a><ul class="dropdown-menu multi-level">';
|
||||
} else if ($amodul[$i]['Level']==($mulai_level+1)) {
|
||||
$thasil .= '<li class="dropdown-submenu"><a class="dropdown-item dropdown-toggle slink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="'.$amodul[$i]['Judul'].'"><i class="c-nav-icon"></i> '.$amodul[$i]['Menu'].'</a><ul class="dropdown-menu">';
|
||||
$ticon = ($amodul[$i]['Icon']) ? " me-1 ".$amodul[$i]['Icon'] : "";
|
||||
$thasil .= '<li class="nav-item pe-3"><a class="nav-link dropdown-toggle" data-coreui-toggle="dropdown" aria-expanded="false" title="'.$amodul[$i]['Judul'].'"><i class="nav-icon'.$ticon.'"></i> '.$amodul[$i]['Menu'].'</a><ul class="dropdown-menu multi-level">';
|
||||
} else {
|
||||
$thasil .= '<li class="nav-item dropdown-submenu"><a class="nav-link dropdown-toggle slink" data-coreui-toggle="dropdown" aria-expanded="false" title="'.$amodul[$i]['Judul'].'"><i class="nav-icon"></i> '.$amodul[$i]['Menu'].'</i></a><ul class="dropdown-menu">';
|
||||
}
|
||||
} else if (trim($amodul[$i]['Menu'])=="-" && $amodul[$i]['Level']>$mulai_level) {
|
||||
$thasil .= '<li class="dropdown-divider"></li>';
|
||||
} else if ($amodul[$i]['Level']==$mulai_level) {
|
||||
$ticon = ($amodul[$i]['Icon']) ? " mr-1 ".$amodul[$i]['Icon'] : "";
|
||||
$thasil .= '<li class="c-header-nav-item px-3"><a class="c-header-nav-link mlink" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'"><span class="c-nav-icon'.$ticon.'"></span> '.$amodul[$i]['Menu'].'</a></li>';
|
||||
$thasil .= '<li class="nav-item pe-3"><a class="nav-link mlink" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'"><span class="nav-icon'.$ticon.'"></span> '.$amodul[$i]['Menu'].'</a></li>';
|
||||
} else {
|
||||
$thasil .= '<li><a class="dropdown-item mlink" data-toggle="collapse" data-target=".dropdown-menu.show" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'">'.$amodul[$i]['Menu'].'</a></li>';
|
||||
$thasil .= '<li class="nav-item"><a class="nav-link dropdown-item mlink" id="'.$amodul[$i]['Kode'].'Link" title="'.$amodul[$i]['Judul'].'">'.$amodul[$i]['Menu'].'</a></li>';
|
||||
}
|
||||
$last_level = $amodul[$i]['Level'];
|
||||
}
|
||||
@@ -122,15 +121,14 @@ final class Menu {
|
||||
}
|
||||
|
||||
static function MenuJSON($db = null, $page = "", $tquery = "") {
|
||||
if (is_resource($db)) { $_mdb = $db; }
|
||||
else $_mdb = new \siaupheng\fonia3\DB\MySQL();
|
||||
$_mdb = $db ?? new \siaupheng\fonia4\DB\MySQL();
|
||||
$_query = ($tquery=="") ? "" : ",'".$tquery."'";
|
||||
$ajson = array('login' => true);
|
||||
$apage = array('Link' => "");
|
||||
|
||||
$acus_page = array(
|
||||
'SYSP' => array('Kode'=>"SYSP", 'Judul'=>"Profil Pengguna", 'Link'=>"sys/profile.php", 'JS'=>"SYSProfileJS", 'Width'=>600, 'Button'=>"_,C,S"),
|
||||
'SYSC' => array('Kode'=>"SYSC", 'Judul'=>"Ubah Password", 'Link'=>"sys/chpasswd.php", 'JS'=>"SYSChpasswdJS", 'Width'=>400, 'Button'=>"_,C,S")
|
||||
'SYSP' => array('Kode'=>"SYSP", 'Judul'=>"Profil Pengguna", 'Link'=>"sys/profile.php", 'JS'=>"SYSProfileJS", 'Width'=>600, 'Button'=>'[{},{"i":"butBatal"},{"i":"butSave","v":"Simpan","c":"success"}]'),
|
||||
'SYSC' => array('Kode'=>"SYSC", 'Judul'=>"Ubah Password", 'Link'=>"sys/chpasswd.php", 'JS'=>"SYSChpasswdJS", 'Width'=>500, 'Button'=>'[{},{"i":"butBatal"},{"i":"butSave","v":"Simpan","c":"success"}]')
|
||||
);
|
||||
|
||||
if ($acus_page[$page]) {
|
||||
@@ -143,26 +141,11 @@ final class Menu {
|
||||
$ajson['iswindow'] = ($apage['Width'] > 0) ? true : false;
|
||||
$ajson['width'] = $apage['Width'];
|
||||
$ajson['title'] = $apage['Judul'];
|
||||
$ajson['button'] = $apage['Button'];
|
||||
$ajson['button'] = is_json($apage['Button']) ? json_decode($apage['Button']) : $apage['Button'];
|
||||
$ajson['php'] = $apage['Link'];
|
||||
$ajson['func'] = $apage['JS'];
|
||||
$ajson['kode'] = $apage['Kode'];
|
||||
|
||||
if ($ajson['iswindow'] == false) {
|
||||
$tsql = (isset($_SESSION['__WEB_APP']['APP_MODULE']) && $_SESSION['__WEB_APP']['APP_MODULE'] <> "") ? " AND Modul='".$_SESSION['__WEB_APP']['APP_MODULE']."' AND Level>0" : "";
|
||||
$a_bread = array(); $i_level = null;
|
||||
$_mdb->Query("SELECT Kode,Level,Menu FROM app_menu WHERE Kode<='".$page."'".$tsql." ORDER BY Kode DESC");
|
||||
while ($_mdb->Next()) {
|
||||
if ($page == $_mdb->Row("Kode") || $i_level > $_mdb->Row("Level")) {
|
||||
$a_bread[] = $_mdb->Row("Menu");
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
$i_level = $_mdb->Row("Level");
|
||||
}
|
||||
$a_bread[] = "Beranda";
|
||||
$ajson['bread'] = $a_bread;
|
||||
}
|
||||
if (!file_exists($_SESSION['__WEB_APP']['REAL_PATH']."apps/php/".$apage['Link'])) $ajson['php'] = "";
|
||||
return $ajson;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/POSPrint.php
|
||||
Desc. : v3 - Class cetak POS
|
||||
Desc. : v4 - Class cetak POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
/* VERSI BARU DENGAN MULTI SHEET */
|
||||
class POSPrint {//up: 20180108
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Param.php
|
||||
Desc. : Class akses data parameter dari client side
|
||||
Desc. : v4 - Class data parameter dari client side
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 14th, 2013.
|
||||
Last Modified : May 8th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class Param {
|
||||
private static $__ahasil = array();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/RAWPrint.php
|
||||
Desc. : v3 - Class cetak RAW
|
||||
Desc. : v4 - Class cetak RAW
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
class RAWPrint {
|
||||
private $_header = array();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Register.php
|
||||
Desc. : v3 - Class Registrasi Aplikasi
|
||||
Desc. : v4 - Class Registrasi Aplikasi
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 23th, 2011.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class Register {
|
||||
protected $__db = null;
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__db = $db; }
|
||||
else $this->__db = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__db = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
}
|
||||
|
||||
static public function reg_id() {
|
||||
|
||||
+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;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Terbilang.php
|
||||
Desc. : Class Format Angka & Terbilang
|
||||
Desc. : v4 - Class Format Angka & Terbilang
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 12th, 2009.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class Terbilang {
|
||||
private $numb = array("","Satu","Dua","Tiga","Empat","Lima","Enam","Tujuh","Delapan","Sembilan");
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Update.php
|
||||
Desc. : Class Update Aplikasi Otomatis
|
||||
Desc. : v4 - Class Update Aplikasi Otomatis
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 14th, 2013.
|
||||
Last Modified : May 6th, 2021.
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\fonia3\Web;
|
||||
namespace siaupheng\fonia4\Web;
|
||||
|
||||
final class Update {
|
||||
private $__amysql = array();
|
||||
@@ -22,7 +22,7 @@ final class Update {
|
||||
|
||||
public function __construct($db = null){
|
||||
if (is_resource($db)) { $this->__linkdb = $db; }
|
||||
else $this->__linkdb = new \siaupheng\fonia3\DB\MySQL();
|
||||
else { $this->__linkdb = new \siaupheng\fonia4\DB\MySQL(); }
|
||||
|
||||
$this->__amysql = $this->__linkdb->getConfig();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user