コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Instituciones();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Instituciones'])) {
         $model->attributes = $_POST['Instituciones'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->idInstitucion));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
 public function actionGuardarinstitucion()
 {
     // echo("<script>console.log('Extension ".$e."');</script>");
     echo "<script>console.log('Entrooo');</script>";
     $institucion = new Instituciones();
     if (isset($_POST["Instituciones"])) {
         $institucion->attributes = $_POST["Instituciones"];
         if ($institucion->save()) {
             setcookie("ginstitucion", "1");
         } else {
             setcookie("gresponsable", "0");
         }
         $lista = Instituciones::model()->findAll();
         $lista = CHtml::listData($lista, 'idInstitucion', 'nombreInstitucion');
         foreach ($lista as $valor => $descripcion) {
             echo CHtml::tag('option', array('value' => $valor), CHtml::encode($descripcion), true);
         }
     }
 }