/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new CmsNode(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CmsNode'])) { $model->attributes = $_POST['CmsNode']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionCreateblock() { $model = new CmsNode(); $cms = new CmsContent(); if (isset($_POST['CmsNode'])) { $model->attributes = $_POST['CmsNode']; $model->created = date('Y-m-d h:m:s'); if ($model->validate()) { if ($model->save()) { $cms->attributes = $_POST['CmsContent']; $cms->nodeId = $model->id; if ($cms->save()) { $this->redirect(array("//cms/admin/blocks")); } } } } $this->render('createblock', array('model' => $model, 'cms' => $cms)); }