コード例 #1
0
 public function actionAdd()
 {
     $model = new Tareas();
     if (isset($_POST['Tareas'])) {
         $model->attributes - $_POST['Tareas'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('add', array('model' => $model));
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Tareas();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Tareas'])) {
         $model->attributes = $_POST['Tareas'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #3
0
 public function actionAdd()
 {
     $model = new Tareas();
     if (isset($_POST['Tareas'])) {
         // valkidamos si trae algun valor en el formulario
         $model->attributes = $_POST['Tareas'];
         // se asignan los valores del formulario a la clase modelo
         if ($model->save()) {
             // esto es como hacer un UPDATE tareas... WHERE id = {el ide que trae la accion}
             $this->redirect(array('view', 'id' => $model->id));
         }
         // esto es como hacer un header location en el caso que guarde
     }
     $this->render('add', array('model' => $model));
 }