/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new LiikuntaSuosikit();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['LiikuntaSuosikit'])) {
         $model->attributes = $_POST['LiikuntaSuosikit'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Example #2
0
 public function actionUusi_suosiki()
 {
     if (isset($_POST['sivu']) and $_POST['sivu'] == 'ruoka') {
         $model = new RuokaSuosikit();
     } elseif (isset($_POST['sivu']) and $_POST['sivu'] == 'liikunta') {
         $model = new LiikuntaSuosikit();
     }
     if (isset($_POST)) {
         $model->attributes = $_POST;
         $model->user_id = Yii::app()->user->id;
         if ($model->save()) {
             echo 'uusiFavOK//' . $model->id;
         } else {
             var_dump($model->getErrors());
         }
     }
 }