コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new ForumQuestion();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ForumQuestion'])) {
         $model->attributes = $_POST['ForumQuestion'];
         if ($model->save()) {
             date_default_timezone_set("Asia/Manila");
         }
         $activity = new Activity();
         $activity->act_desc = 'Added Another Topic';
         $activity->act_datetime = date('Y-m-d G:i:s');
         $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
         $activity->save();
         $this->redirect(array('view', 'id' => $model->id));
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: JexIboy/lis-pglu
 public function actioncreate_topic()
 {
     $model = new ForumQuestion();
     if (isset($_POST['ForumQuestion'])) {
         $model->attributes = $_POST['ForumQuestion'];
         $model->datetime = date('Y-m-d H:i:s');
         $model->view = 0;
         $model->reply = 0;
         $model->confirmation = 0;
         if ($model->save()) {
             $this->redirect(array('main_forum'));
         }
     }
     $this->render('create_topic', array('model' => $model));
 }