'; } // Floating Labels // https://getbootstrap.com/docs/5.0/forms/floating-labels/ public static function formFloatingLabels($args) { $name = $args['name']; $id = isset($args['id'])?$args['id']:$name; $value = isset($args['value'])?$args['value']:''; $type = isset($args['type'])?$args['type']:'text'; $placeholder = isset($args['placeholder'])?$args['placeholder']:''; $label = isset($args['label'])?$args['label']:$placeholder; $class = 'form-control'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } return << EOF; } public static function formSelect($args) { $name = $args['name']; $id = isset($args['id'])?$args['id']:$name; $class = 'form-select'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } $data = 'data-current-value="'.$args['selected'].'"'; if (isset($args['data'])) { if (is_array($args['data'])) { foreach ($args['data'] as $x => $y) { $data .= 'data-'.$x.' = "'.$y.'"'; } } } $html = '
'; if (!empty($args['label'])) { $html .= ''; } $html .= '
'; $html .= ''; if (!empty($args['tip'])) { $html .= '
'.$args['tip'].'
'; } $html .= '
'; $html .= '
'; return $html; } public static function formSelectBlock($args) { $name = $args['name']; $id = isset($args['id'])?$args['id']:$name; $class = 'form-select'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } $html = '
'; if (!empty($args['label'])) { $html .= ''; } $html .= ''; $html .= '
'; return $html; } public static function formTextarea($args) { $name = $args['name']; $id = isset($args['id'])?$args['id']:$name; $placeholder = isset($args['placeholder'])?$args['placeholder']:''; $value = isset($args['value'])?$args['value']:''; $rows = isset($args['rows'])?$args['rows']:'3'; $tip = ''; if (!empty($args['tip'])) { $tip = '
'.$args['tip'].'
'; } $label = ''; if (!empty($args['label'])) { $label = ''; } $class = 'form-control'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } return << $label
$tip
EOF; } public static function formInputText($args) { $name = $args['name']; $id = isset($args['id'])?$args['id']:$name; $disabled = empty($args['disabled'])?'':'disabled'; $readonly = empty($args['readonly'])?'':'readonly'; $placeholder = isset($args['placeholder'])?$args['placeholder']:''; $value = isset($args['value'])?$args['value']:''; $type = isset($args['type'])?$args['type']:'text'; $tip = ''; if (!empty($args['tip'])) { $tip = '
'.$args['tip'].'
'; } $label = ''; if (!empty($args['label'])) { $label = ''; } $class = 'form-control'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } $data = 'data-current-value="'.$value.'"'; if (isset($args['data'])) { if (is_array($args['data'])) { foreach ($args['data'] as $x => $y) { $data .= ' data-'.$x.' = "'.$y.'"'; } } } return << $label
$tip
EOF; } public static function pageTitle($args) { $title = ''; if (isset($args['icon'])) { $title = ''; } $title .= ''.$args['title'].''; return '

'.$title.'

'; } public static function formTitle($args) { $title = ''; if (isset($args['icon'])) { $title = ''; } $title .= ''.$args['title'].''; return '
'.$title.'
'; } public static function formOpen($args) { $class = empty($args['class'])?'':'class="'.$args['class'].'"'; $id = empty($args['id'])?'':'id="'.$args['id'].'"'; $enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"'; $action = empty($args['action'])?'action=""':'action="'.$args['action'].'"'; $method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"'; $style = empty($args['style'])?'':'style="'.$args['style'].'"'; return << EOF; } public static function formClose() { return << EOF; } public static function formInputTextBlock($args) { $name = $args['name']; $disabled = empty($args['disabled'])?'':'disabled'; $placeholder = isset($args['placeholder'])?$args['placeholder']:''; $value = isset($args['value'])?$args['value']:''; $id = 'js'.$name; if (isset($args['id'])) { $id = $args['id']; } $tip = ''; if (!empty($args['tip'])) { $tip = '
'.$args['tip'].'
'; } $class = 'mb-3 m-0'; if (isset($args['class'])) { $class = $args['class']; } $labelClass = 'mt-4 mb-2 pb-2 border-bottom text-uppercase w-100'; if (isset($args['labelClass'])) { $labelClass = $args['labelClass']; } $label = ''; if (!empty($args['label'])) { $label = ''; } $type = 'text'; if (isset($args['type'])) { $type = $args['type']; } return << $label $tip EOF; } public static function formInputFile($args) { $id = 'js'.$args['name']; if (isset($args['id'])) { $id = $args['id']; } $class = 'custom-file'; if (isset($args['class'])) { $class = $class.' '.$args['class']; } $html = '
'; $html .= ''; $html .= ''; $html .= '
'; return $html; } public static function formTextareaBlock($args) { $id = 'js'.$args['name']; if (isset($args['id'])) { $id = $args['id']; } $class = 'form-control'; if (!empty($args['class'])) { $class = $class.' '.$args['class']; } $html = '
'; if (!empty($args['label'])) { $html .= '
'.$args['label'].'
'; } $html .= ''; if (!empty($args['tip'])) { $html .= '
'.$args['tip'].'
'; } $html .= '
'; return $html; } public static function formCheckbox($args) { $labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:''; $placeholder = isset($args['placeholder'])?$args['placeholder']:''; $tip = isset($args['tip'])?'
'.$args['tip'].'
':''; $value = isset($args['value'])?$args['value']:''; $name = $args['name']; $id = 'js'.$name; if (isset($args['id'])) { $id = $args['id']; } $disabled = isset($args['disabled'])?'disabled':''; $class = 'mb-3 m-0'; if (isset($args['class'])) { $class = $args['class']; } $labelClass = 'mt-4 mb-2 pb-2 border-bottom text-uppercase w-100'; if (isset($args['labelClass'])) { $labelClass = $args['labelClass']; } $type = 'text'; if (isset($args['type'])) { $type = $args['type']; } $label = ''; if (!empty($args['label'])) { $label = ''; } $checked = $args['checked']?'checked':''; $value = $checked?'1':'0'; return << $label
$tip
EOF; } public static function alert($args) { $class = 'alert'; if (!empty($args['class'])) { $class = $class.' '.$args['class']; } $text = $args['text']; return <<$text EOF; } }