/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Responsables();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Responsables'])) {
         $model->attributes = $_POST['Responsables'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->idResponsable));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionGuardarresponsable()
 {
     // echo("<script>console.log('Extension ".$e."');</script>");
     echo "<script>console.log('Entrooo');</script>";
     $responsable = new Responsables();
     if (isset($_POST["Responsables"])) {
         echo "<script>console.log('Existe el formulario');</script>";
         $responsable->attributes = $_POST["Responsables"];
         $responsable->instituciones_idInstitucion = $_COOKIE['cookinst'];
         //echo("<script>console.log('Nombre ".$responsable->primerNombreResponsable."');</script>");
         if ($responsable->save()) {
             setcookie("gresponsable", "1");
             echo "<script>console.log('guardo');</script>";
         } else {
             setcookie("gresponsable", "0");
             //print_r("<script>console.log('Errores ".$$responsable->getErrors()."');</script>");
         }
         //$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);
         //	}
     }
 }