private function _generar_inputs_form() { $campos = $this->_oConfigEntidad->campos; //echo "<hr/>" . __FILE__ . " - " . __LINE__ . "<pre>"; //echo "<hr/><pre>"; // print_r($this->input->post()); //echo "</pre><hr/>"; //die(); //$config = $this->input->post("campos[id_provincia][config]"); // $config_decode = (array) json_decode($config); // print_r($config_decode); // print_r($campos); // echo "</pre><hr/>"; //die; $html = ""; require_once APPPATH . "/libraries/Crud/HtmlElementFactory.php"; foreach ($campos as $nombre_campo => $data_campo) { if (element($data_campo, "generar_input", 0) > 0) { $tipo_input = $data_campo["tipo_campo"]; $config = $data_campo["config"]; $html .= "<div class='form-group'>" . PHP_EOL; if ($tipo_input !== "hidden") { $html .= "<label>" . element($data_campo, "label", "") . ":</label><br/>" . PHP_EOL; } $elemento_html = HtmlElementFactory::crear_elemento($tipo_input); if (!empty($config)) { $config_decode = (array) json_decode($config); $elemento_html->set_config($config_decode); } $html .= $elemento_html->render($nombre_campo) . PHP_EOL; $html .= "</div>" . PHP_EOL; } } return $html; }
public function test_html($tipo) { require_once APPPATH . "/libraries/Crud/HtmlElementFactory.php"; $obj = HtmlElementFactory::crear_elemento($tipo); // echo "<hr/>" . __FILE__ . " - " . __LINE__ . "<pre>"; // var_dump($obj); // echo "</pre><hr/>"; // echo $obj->render("foo", "bar"); // die(); }