/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new LiikuntaUser(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['LiikuntaUser'])) { $model->attributes = $_POST['LiikuntaUser']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionSiirra_rivit_liikunta() { if (isset($_POST)) { $modelFromCopy = LiikuntaUser::model()->findbypk($_POST['id']); $uusi = new LiikuntaUser(); $uusi->attributes = $modelFromCopy->attributes; $uusi->pvm = date('Y-m-d', strtotime($_POST['pvm'])); if ($uusi->save()) { LiikuntaUser::model()->deletebypk($modelFromCopy->id); echo 'siirraOk'; } else { var_dump($uusi->getErrors()); } } }