Exemplo n.º 1
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Mquestion::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 2
0
 public function actionProcessQuestion()
 {
     //Libraries::check($_POST);
     //die();
     $offset = $_POST['offset'];
     $limit = 10;
     $data['question'] = Mquestion::model()->findAll(array("condition" => "state = 1 and parent = 0", "offset" => $offset, "limit" => $limit));
     $this->renderPartial("get_question", $data);
 }
Exemplo n.º 3
0
 public function run()
 {
     parent::run();
     if (isset($_POST['submit_reply'])) {
         $id = $_POST['hid'];
         $model = new Mquestion();
         $model->content = Yii::app()->request->getPost('content_reply', true);
         $model->parent = $_POST['hid'];
         $model->user_id = $this->_session['login_id'];
         $model->state = 0;
         if (Libraries::get_vip($model->user_id) != 0) {
             $model->state = 1;
         }
         $model->date_create = new CDbExpression('NOW()');
         $model->save();
     }
     $data['question'] = Mquestion::model()->findAll(array("condition" => "state = 1 and parent = 0 ", "order" => "date_create desc", "limit" => 1));
     $data['u_log'] = $this->_session['login_id'];
     $this->render('member_question', $data);
 }