fixed change of framework
This commit is contained in:
+18
-17
@@ -5,7 +5,7 @@
|
||||
Module : /Web/Form.php
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 27th, 2008.
|
||||
Last Modified : August 22nd, 2026.
|
||||
Last Modified : September 5th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -48,7 +48,7 @@ final class Form {
|
||||
|
||||
public function option(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null, bool $multi=false, bool $group=false): string {
|
||||
$_opsi = '';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.rtrim($change, '();').'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
if ($multi===true) $_opsi .= ' multiple';
|
||||
@@ -118,14 +118,14 @@ final class Form {
|
||||
}
|
||||
|
||||
public function option_ulevel(string $label, string $field, int $value=9, bool $enable=true, bool $req=false, ?string $help=null, ?string $change=null): string {
|
||||
return $this->option($label, $field, $value, $enable, $req, $this->session->get('__WEB_APP')['USER_LEVEL'], $help, $change);
|
||||
return $this->option($label, $field, $value, $enable, $req, $this->session->get('WEB_APP')['USER_LEVEL'], $help, $change);
|
||||
}
|
||||
|
||||
public function radio(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[0];
|
||||
$_val = array_keys($arr);
|
||||
if (is_null($value)) $value = $_val[0];
|
||||
$_opsi = '';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.rtrim($change, '();').'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
$tout = '<input type="hidden" id="'.$field.'" value="'.$value.'" />';
|
||||
@@ -151,9 +151,9 @@ final class Form {
|
||||
|
||||
public function checkbox(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[1];
|
||||
if (is_null($value)) $value = $_val[0];
|
||||
$_opsi = ' odata="'.htmlspecialchars(json_encode($arr)).'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.rtrim($change, '();').'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
$tout = '<div class="col-form-label form-check"><input type="checkbox" class="form-check-input" id="'.$field.'" name="'.$field.'" value="'.$value.'"'.$_opsi;
|
||||
@@ -165,9 +165,9 @@ final class Form {
|
||||
|
||||
public function switch(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[1];
|
||||
if (is_null($value)) $value = $_val[0];
|
||||
$_opsi = ' odata="'.htmlspecialchars(json_encode($arr)).'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.rtrim($change, '();').'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
$tout = '<div class="col-form-label form-check form-switch"><input class="form-check-input" id="'.$field.'" name="'.$field.'" type="checkbox" role="switch" value="'.$value.'"'.$_opsi;
|
||||
@@ -179,8 +179,8 @@ final class Form {
|
||||
|
||||
public function textbox(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, string $type="text", ?string $holdtxt=null, ?int $maxsize=null, ?string $help=null, ?string $keyup=null, ?string $blur=null): string {
|
||||
$_opsi = '';
|
||||
if (!empty($keyup)) $_opsi .= ' okyup="'.$keyup.'"';
|
||||
if (!empty($blur)) $_opsi .= ' oblur="'.$blur.'"';
|
||||
if (!empty($keyup)) $_opsi .= ' okyup="'.rtrim($keyup, '();').'"';
|
||||
if (!empty($blur)) $_opsi .= ' oblur="'.rtrim($blur, '();').'"';
|
||||
if (!empty($holdtxt)) $_opsi .= ' placeholder="'.$holdtxt.'"';
|
||||
if (!empty($maxsize)) $_opsi .= ' maxlength="'.$maxsize.'"';
|
||||
if ($enable===false) $_opsi .= ' readonly';
|
||||
@@ -196,8 +196,9 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textauto(string $label, string $field, array $avalue=['value'=>0,'text'=>""], bool $enable=true, bool $req=false, ?string $holdtxt=null, ?int $maxsize=null, ?string $help=null): string {
|
||||
public function textauto(string $label, string $field, array $avalue, bool $enable=true, bool $req=false, ?string $holdtxt=null, ?int $maxsize=null, ?string $help=null): string {
|
||||
$_opsi = '';
|
||||
if (count($avalue) === 0) $avalue = [ 'value' => 0, 'text' => "" ];
|
||||
if (!empty($holdtxt)) $_opsi .= ' placeholder="'.$holdtxt.'"';
|
||||
if (!empty($maxsize)) $_opsi .= ' maxlength="'.$maxsize.'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
@@ -222,8 +223,8 @@ final class Form {
|
||||
|
||||
public function textarea(string $label, string $field, ?string $value=null, bool $enable=true, bool $req=false, int $rows=1, ?string $holdtxt=null, ?string $help=null, ?string $keyup=null, ?string $blur=null): string {
|
||||
$_opsi = '';
|
||||
if (!empty($keyup)) $_opsi .= ' okyup="'.$keyup.'"';
|
||||
if (!empty($blur)) $_opsi .= ' oblur="'.$blur.'"';
|
||||
if (!empty($keyup)) $_opsi .= ' okyup="'.rtrim($keyup, '();').'"';
|
||||
if (!empty($blur)) $_opsi .= ' oblur="'.rtrim($blur, '();').'"';
|
||||
if (!empty($holdtxt)) $_opsi .= ' placeholder="'.$holdtxt.'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
@@ -244,7 +245,7 @@ final class Form {
|
||||
|
||||
public function color(string $label, string $field, ?string $value=null, bool $enable=true, bool $req=false, ?string $help=null, ?string $change=null): string {
|
||||
$_opsi = '';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.rtrim($change, '();').'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
if ($req===true) $_opsi .= ' required=true';
|
||||
$tout = '<input type="color" class="form-control form-control-color" id="'.$field.'" name="'.$field.'" value="'.$value.'"'.$_opsi.' />';
|
||||
@@ -267,7 +268,7 @@ final class Form {
|
||||
$col_right = 'col-sm-' . (10-$lebar_kolom) . ' col-lg-' . (12-$lebar_kolom);
|
||||
$tres = '';
|
||||
foreach ($this->__aform as $_key => $_val) {
|
||||
$tres .= sprintf('<div class="row mb-1"><label class="%s col-form-label" for="%s">%s</label><div class="%s">%s %s</div></div>', $col_left, $_key, $_val['label'], $col_right, $_val['form'], (empty($_val['help'])?'':'<span class="help-block"><small>'.$_val['help'].'</small></span>'));
|
||||
$tres .= sprintf('<div class="row mb-1"><label class="%s col-form-label" for="%s">%s</label><div class="%s">%s %s</div></div>', $col_left, $_key, $_val['label'], $col_right.(str_contains($_val['form'],'type="radio"')?' d-flex gap-2':''), $_val['form'], (empty($_val['help'])?'':'<span class="help-block"><small>'.$_val['help'].'</small></span>'));
|
||||
}
|
||||
foreach ($this->__ahide as $_key => $_val) {
|
||||
$tres .= $_val;
|
||||
|
||||
Reference in New Issue
Block a user