public function agregar()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un codigo");
     }
     if ($parque->get("nivel") == "alto" || $parque->get("nivel") == "bajo") {
     } else {
         throw_exception("El nivel debe de ser alto o bajo");
     }
     if ($parque->get("municipio") == "medellin" || $parque->get("municipio") == "rionegro" || $parque->get("municipio") == "la estrella" || $parque->get(" municipio") == "copacabana" || $parque->get(" municipio") == "guatape") {
     } else {
         throw_exception("El municipio debe de ser medellin, rionegro, la estrella, copacabana o guatape");
     }
     print_r($parque);
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     settype($data, 'object');
     $data->fecha = date("y-m-d");
     $data->calificacion = 0;
     $data->parque = $parque->get("codigo");
     $calificacion = new calificacion($data);
     $this->orm->connect();
     $this->orm->insert_data("normal", $calificacion);
     $this->orm->close();
     $this->type_warning = "sucess";
     $this->msg_warning = "parque agregado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
 public function add()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un nivel");
     }
     $parque = new parque($this->post);
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un municipio");
     }
     if ($parque->get('municipio') != "Medellín" && $parque->get('municipio') != "La estrella" && $parque->get('municipio') != "Rionegro" && $parque->get('municipio') != "Copacabana" && $parque->get('municipio') != "Guatapé") {
         throw_exception("Municipio inválido");
     }
     if ($parque->get('nivel') != "alto" && $parque->get('nivel') != "bajo") {
         throw_exception("Nivel inválido");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->type_warning = "sucess";
     $this->msg_warning = "Parque registrado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
 public function add()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un codigo");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', "success");
     $this->engine->assign('msg_warning', "parque registrado correctamente");
 }
Beispiel #4
0
 public function registrar_parque()
 {
     $parque = new parque($this->post);
     if ($parque->is_valid()) {
         $this->orm->connect();
         $this->orm->insert_data('normal', $parque);
         $this->orm->close();
         $this->engine->assign('msg_warning', 'Parque registrado correctamente!');
         $this->engine->assign('type_warning', 'success');
     } else {
         $this->engine->assign('msg_warning', 'No se ha podido registrar el parque, por favor verifique que los datos ingresados sean correctos.');
         $this->engine->assign('type_warning', 'warning');
         $this->engine->assign('codigo', $parque->get('codigo'));
         $this->engine->assign('nombre', $parque->get('nombre'));
         $this->engine->assign('municipio', $parque->get('municipio'));
         $this->engine->assign('nivel', $parque->get('nivel'));
     }
 }
 public function registrar()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un codigo");
     }
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un nivel");
     }
     if (is_empty($parque->get('municipio'))) {
         throw_exception("Debe ingresar un municipio");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->type_warning = "sucess";
     $this->msg_warning = "Parque registrado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
 public function registrar()
 {
     $parque = new parque($this->post);
     $this->engine->assign('codigo', $parque->get('codigo'));
     $this->engine->assign('nombre', $parque->get('nombre'));
     $this->engine->assign('municipio', $parque->get('municipio'));
     $this->engine->assign('nivel', $parque->get('nivel'));
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un Codigo");
     } elseif (!is_numeric($parque->get('codigo')) or $parque->get('codigo') < 0) {
         throw_exception("Codigo invalido");
     }
     if (is_empty($parque->get('nombre'))) {
         throw_exception("Debe ingresar un nombre");
     }
     if (is_empty($parque->get('municipio'))) {
         throw_exception("Debe ingresar un municipio");
     } elseif ($parque->get('municipio') != "Medellín" and $parque->get('municipio') != "Rionegro" and $parque->get('municipio') != "La Estrella" and $parque->get('municipio') != "Copacabana" and $parque->get('municipio') != "Guatapé") {
         throw_exception("Municipio invalido, municipios validos: Medellín, Rionegro, La Estrella, Copacabana, Guatapé");
     }
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un nivel");
     } elseif ($parque->get('nivel') != "alto" and $parque->get('nivel') != "bajo") {
         throw_exception("Nivel invalido, niveles validos: alto, bajo");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->type_warning = "Exito";
     $this->msg_warning = "parque agregado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }