|
|
|
@ -38,9 +38,10 @@ class FormGenerator
|
|
|
|
|
$formulario .= '</div>'; |
|
|
|
|
$formulario .= $this->createButtonsForms(); |
|
|
|
|
$formulario .= $this->showLoading(); |
|
|
|
|
$formulario .= $this->createJavaScript($this->formulario_js); |
|
|
|
|
|
|
|
|
|
$formulario .= '</form></body></html>'; |
|
|
|
|
$formulario .= '</div></form>'; |
|
|
|
|
$formulario .= $this->createJavaScript($this->formulario_js); |
|
|
|
|
$formulario .= '</body></html>'; |
|
|
|
|
|
|
|
|
|
return $formulario; |
|
|
|
|
} |
|
|
|
@ -227,6 +228,14 @@ class FormGenerator
|
|
|
|
|
$props = $elemento['propriedades']; |
|
|
|
|
|
|
|
|
|
switch ($tipo) { |
|
|
|
|
case 'file': |
|
|
|
|
return '<div class="file-class"> <div class="file-label"><p>' . $elemento['text'] . '</p></div> |
|
|
|
|
<label class="custom-file" for="' . $props[0]['id'] . '"> |
|
|
|
|
<input ' . $this->generateAttributes($props[0]) . ' />Upload |
|
|
|
|
<span class="custom-file-span"></span> |
|
|
|
|
</label></div>'; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 'toggle': |
|
|
|
|
return '<div class="toggle-bn"> |
|
|
|
|
<label class="switch" for="' . $props[0]['id'] . '"> |
|
|
|
@ -339,12 +348,12 @@ class FormGenerator
|
|
|
|
|
$attributesRemove = $this->generateAttributes($props[1]); |
|
|
|
|
|
|
|
|
|
$botaoSelect = '<div class="select-bn"> |
|
|
|
|
<div ' . $attributesAdd . '> |
|
|
|
|
<h3> > </h3> |
|
|
|
|
<div ' . $attributesAdd . '> |
|
|
|
|
<h3> > </h3> |
|
|
|
|
</div> |
|
|
|
|
<div ' . $attributesRemove . '> |
|
|
|
|
<h3> |
|
|
|
|
< </h3> |
|
|
|
|
< </h3> |
|
|
|
|
</div> |
|
|
|
|
</div>'; |
|
|
|
|
|
|
|
|
@ -608,6 +617,39 @@ class FormGenerator
|
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function inputFile( |
|
|
|
|
?string $class_column = 'normal', |
|
|
|
|
?string $title = null, |
|
|
|
|
?string $text = null, |
|
|
|
|
?string $name = null, |
|
|
|
|
?bool $required = false, |
|
|
|
|
?array $div_open = null, |
|
|
|
|
?string $div_close = null, |
|
|
|
|
?bool $multiple = false, |
|
|
|
|
string $accept = null, |
|
|
|
|
) { |
|
|
|
|
return [ |
|
|
|
|
'tipo-conteudo' => 'file', |
|
|
|
|
'titulo' => $title, |
|
|
|
|
'classe-coluna' => $class_column, |
|
|
|
|
'abrir-div' => $div_open, |
|
|
|
|
'fechar-div' => $div_close, |
|
|
|
|
'text' => $text, |
|
|
|
|
'propriedades' => [ |
|
|
|
|
[ |
|
|
|
|
'name' => $name, |
|
|
|
|
'id' => $this->removeSquareBrackets($name), |
|
|
|
|
'type' => 'file', |
|
|
|
|
'multiple' => $multiple, |
|
|
|
|
'required' => $required, |
|
|
|
|
'onchange' => 'updateFileLabel(this)', |
|
|
|
|
'accept' => $accept, |
|
|
|
|
'style' => 'display: none;', |
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Função para criar um campo de texto |
|
|
|
|
private function inputPropsText($name, $value, $value_banco, $size, $maxlength, $oninput, $required, $pattern, $placeholder, $disabled, $style) |
|
|
|
@ -784,10 +826,6 @@ class FormGenerator
|
|
|
|
|
|
|
|
|
|
public function select($title = null, $class_column = null, $name = null, $options = null, $size = null, $multiple = null) |
|
|
|
|
{ |
|
|
|
|
if (strpos($name, '[') !== false && strpos($name, ']') !== false) { |
|
|
|
|
// Remove os colchetes da string |
|
|
|
|
$id = preg_replace('/[\[\]]/', '', $name); |
|
|
|
|
} |
|
|
|
|
return [ |
|
|
|
|
'tipo-conteudo' => 'normal', |
|
|
|
|
'classe-coluna' => $class_column, |
|
|
|
@ -796,7 +834,7 @@ class FormGenerator
|
|
|
|
|
'propriedades' => [ |
|
|
|
|
[ |
|
|
|
|
'name' => $name, |
|
|
|
|
'id' => $id, |
|
|
|
|
'id' => $this->removeSquareBrackets($name), |
|
|
|
|
'class' => 'selecao', |
|
|
|
|
'options' => $options, |
|
|
|
|
'size' => $size, |
|
|
|
@ -806,6 +844,15 @@ class FormGenerator
|
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function removeSquareBrackets($name) |
|
|
|
|
{ |
|
|
|
|
if (strpos($name, '[') !== false && strpos($name, ']') !== false) { |
|
|
|
|
// Remove os colchetes da string |
|
|
|
|
return preg_replace('/[\[\]]/', '', $name); |
|
|
|
|
} |
|
|
|
|
return $name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function inputCodecs($title = null, $options = null) |
|
|
|
|
{ |
|
|
|
|
return [ |
|
|
|
|