public function calificar() { $calificacion = new calificacion($this->post); if (is_empty($calificacion->get('valor'))) { throw_exception("Debe ingresar una calificación"); } if ($calificacion->get('valor') < 1 && $calificacion->get('valor') > 5) { throw_exception("Calificación inválida"); } $this->orm->connect(); $this->orm->insert_data("normal", $calificacion); $this->orm->close(); $this->type_warning = "sucess"; $this->msg_warning = "Claificación registrada"; $this->temp_aux = 'message.tpl'; $this->engine->assign('type_warning', $this->type_warning); $this->engine->assign('msg_warning', $this->msg_warning); }
public function calificar() { settype($data, 'object'); $data->fecha = date("y-m-d"); $data->calificacion = $this->post->calificacion; $data->parque = $this->post->parque; $calificacion = new calificacion($data); if ($calificacion->get("calificacion") < 0 || $calificacion->get("calificacion") > 5) { throw_exception("Debe ingresar una calificacion entre 1 y 5"); } $this->orm->connect(); $this->orm->update_data("normal", $calificacion); $this->orm->close(); $this->type_warning = "sucess"; $this->msg_warning = "parque calificado correctamente"; $this->temp_aux = 'message.tpl'; $this->engine->assign('type_warning', $this->type_warning); $this->engine->assign('msg_warning', $this->msg_warning); }
public function calificar() { $this->engine->assign('codigo', $this->post->codigo); $this->engine->assign('nombre', $this->post->nombre); $this->engine->assign('municipio', $this->post->municipio); $calificacion = new calificacion($this->post); $calificacion->set('fecha', date('Y-m-d')); if (is_empty($calificacion->get('calificacion'))) { throw_exception("Debe ingresar una calificacion"); } elseif ($calificacion->get('calificacion') != 1 and $calificacion->get('calificacion') != 2 and $calificacion->get('calificacion') != 3 and $calificacion->get('calificacion') != 4 and $calificacion->get('calificacion') != 5) { throw_exception("Calificacion invalida, calificacion valida: 1, 2, 3, 4, 5"); } $this->orm->connect(); $this->orm->insert_data("normal", $calificacion); $this->orm->close(); $this->type_warning = "Exito"; $this->msg_warning = "Calificacion registrada"; $this->temp_aux = 'message.tpl'; $this->engine->assign('type_warning', $this->type_warning); $this->engine->assign('msg_warning', $this->msg_warning); }