Exemplo n.º 1
0
 /**
  * 编辑话题回复
  */
 public function actionEditPost()
 {
     $model = new GroupPost();
     $pid = Yii::app()->request->getQuery('pid');
     $model = $model->loadPost($pid);
     $tid = $model->tid;
     $GroupPost = new GroupPost();
     $topic = $GroupPost->loadTopic($tid);
     $group = $topic->group;
     if (!empty($_POST['GroupPost'])) {
         $attributes = $_POST['GroupPost'];
         $post = $model->addTopic($attributes);
         if (empty($post->errors)) {
             $this->redirect(array('show', 'tid' => $topic->id));
         }
         //$model->validate();
     }
     $data = array('form' => $model);
     $this->render('EditPost', $data);
 }