Esempio n. 1
0
 /**
  * SysMiscNeuralForm::ConstructorCampos($Constructor, $Array)
  * 
  * Metodo de reutilizacion de clase abstracta para construir el formulario
  * 
  * @param $Array: Array asociativo con los datos del campo correspondiente
  * @param $Constructor: Array con los constructores html correspondientes
  * 
  */
 public static function ConstructorCampos($Constructor, $Array)
 {
     if ($Array['Tipo'] == 'Fieldset_Open') {
         return SysMiscNeuralForm::ConstructorFieldsetOpen($Constructor, $Array['Campos']);
     } elseif ($Array['Tipo'] == 'Fieldset_Close') {
         return $Constructor;
     } elseif ($Array['Tipo'] == 'Text') {
         return SysMiscNeuralForm::ConstructorText($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Hidden') {
         return SysMiscNeuralForm::ConstructorTextHidden($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Password') {
         return SysMiscNeuralForm::ConstructorPassword($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'File') {
         return SysMiscNeuralForm::ConstructorFile($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Submit') {
         return SysMiscNeuralForm::ConstructorSubmit($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Select') {
         return SysMiscNeuralForm::ConstructorSelect($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Textarea') {
         return SysMiscNeuralForm::ConstructorTextarea($Constructor, $Array);
     } elseif ($Array['Tipo'] == 'Legend') {
         return SysMiscNeuralForm::ConstructorLegend($Constructor, $Array);
     }
 }
Esempio n. 2
0
 /**
  * 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';
         }
     }
 }