Exemple #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Seccion();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Seccion'])) {
         $model->attributes = $_POST['Seccion'];
         if ($model->save()) {
             Yii::app()->db->createCommand("insert into Actividad (mensaje, usuario) Values ('Creó la Sección " . $model->nombre . "', '" . Yii::app()->user->name . "')")->execute();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function nueva()
 {
     if (Input::haspost("seccion")) {
         $seccion = new Seccion(Input::post("seccion"));
         if (!$seccion->seccionRepetida($seccion->semestre_id, $seccion->seccion)) {
             if ($seccion->save()) {
                 Flash::valid("Sección Agregada");
             } else {
                 Flash::error("No se Agrego la sección");
             }
         } else {
             Flash::error("No se Agrego la sección, porque ya hay una sección {$seccion->seccion} con ese nombre en el semestre {$seccion->semestre_id}");
         }
     }
     Router::redirect("seccion/");
 }