コード例 #1
0
 /**
  * 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));
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: kksshp/cms
 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));
 }