/** * MostrarFormulario() * * toma los metodos anteriores y genera el formulario correspondiente **/ public function MostrarFormulario() { $Constructor = array('Cabecera' => '<form { CAMPOS }>', 'Fin' => '</form>', 'Text' => '<label { CAMPOS_LABEL }>{ VALOR_LABEL }</label> <input type="text" { CAMPOS } />', 'Hidden' => '<input type="hidden" { CAMPOS } />', 'Password' => '<label { CAMPOS_LABEL }>{ VALOR_LABEL }</label> <input type="password" { CAMPOS } />', 'File' => '<label { CAMPOS_LABEL }>{ VALOR_LABEL }</label> <input type="file" { CAMPOS } />', 'Submit' => '<button type="submit" { CAMPOS }>{ TEXTO }</button>', 'Select' => "<label { CAMPOS_LABEL }>{ VALOR_LABEL }</label> <select { CAMPOS }>\n{ VALORES }\n</select>", 'Textarea' => '<label { CAMPOS_LABEL }>{ VALOR_LABEL }</label> <textarea { CAMPOS }>{ VALORES }</textarea>', 'Fieldset_Open' => '<fieldset { CAMPOS }>', 'Fieldset_Close' => '</fieldset>', 'Legend' => '<legend { CAMPOS }>{ VALORES }</legend>'); if (count($this->Campo) >= 1) { //Validamos que se haya instanciado el metodo de configuracion if (isset($this->ConfiguracionFormulario)) { $ConfiguracionFormulario = SysMiscNeuralForm::OrganizarConfiguracion($Constructor['Cabecera'], $this->ConfiguracionFormulario); $CantidadCampos = count($this->Campo); if ($CantidadCampos >= 1) { if (isset($this->Fieldset)) { $Formulario[] = $ConfiguracionFormulario; for ($i = 0; $i < $CantidadCampos; $i++) { $Tipo = $this->Campo[$i]['Tipo']; $Formulario[] = SysMiscNeuralForm::ConstructorCampos($Constructor[$Tipo], $this->Campo[$i]); } $Formulario[] = $Constructor['Fin']; return implode("\n", $Formulario); } else { $Formulario[] = $ConfiguracionFormulario; $Formulario[] = SysMiscNeuralForm::ConstructorFieldsetOpen($Constructor['Fieldset_Open'], array('name' => false, 'id' => 'Neural_Fieldset', 'class' => 'Neural_Fieldset', 'style' => false)); for ($i = 0; $i < $CantidadCampos; $i++) { $Tipo = $this->Campo[$i]['Tipo']; $Formulario[] = SysMiscNeuralForm::ConstructorCampos($Constructor[$Tipo], $this->Campo[$i]); } $Formulario[] = $Constructor['Fieldset_Close']; $Formulario[] = $Constructor['Fin']; return implode("\n", $Formulario); } } else { return 'Faltan Los Campos del Formulario'; } } else { return 'Falta la Configuración del Formulario'; } } }