Esempio n. 1
0
 function agregar()
 {
     session_start();
     if (Session::siExisteSesion()) {
         $this->data['idevento'] = intval($this->params['idevento']);
         if (isset($_POST) && !empty($_POST)) {
             if (isset($_POST['nombre'])) {
                 Doo::loadModel('CtEncuesta');
                 $encuesta = new CtEncuesta();
                 $encuesta->nombre = strip_tags(addslashes($_POST['nombre']));
                 $encuesta->id_evento = $this->data['idevento'];
                 $encuesta->activa = 0;
                 $val = $encuesta->validate();
                 if (empty($val)) {
                     $idEncuesta = $encuesta->insert();
                     header('location:' . Doo::conf()->APP_URL . 'ionadmin/evento/' . $this->data['idevento'] . '/encuestas?success=1');
                 } else {
                     header('location:' . Doo::conf()->APP_URL . 'ionadmin/evento/' . $this->data['idevento'] . '/encuestas?error=1');
                 }
             } else {
                 header('location:' . Doo::conf()->APP_URL . 'ionadmin/evento/' . $this->data['idevento'] . '/encuestas?error=2');
             }
         } else {
             $this->data['slug'] = 'encuestas';
             $this->renderc('admin/encuesta-agregar', $this->data);
         }
     } else {
         header('location:' . Doo::conf()->APP_URL . 'ionadmin/login?error=1');
     }
 }