Ejemplo 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;
 }
Ejemplo 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);
 }
Ejemplo 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);
 }
Ejemplo n.º 4
0
 public function actionAjaxquestion()
 {
     $array['status'] = 0;
     if (isset($_POST['submit_reply'])) {
         $id = $_POST['hid'];
         $model = new Mquestion();
         $model->content = Libraries::dataCleasing($_POST['content_reply']);
         $model->parent = $_POST['hid'];
         $model->user_id = $this->_session['login_id'];
         $model->state = Libraries::get_vip($model->user_id);
         $model->date_create = new CDbExpression('NOW()');
         if ($model->save()) {
             $user = Member::model()->findByPk($model->user_id);
             $array['status'] = 1;
             $array['content'] = '<li><span class="name"><a href="' . Yii::app()->getBaseUrl(true) . '/thanh-vien/' . $model->user_id . '.html">' . $user->username . '</a>';
             if ($user->premium == 1) {
                 $array['content'] .= "<img src='" . Yii::app()->getBaseUrl(true) . "/themes/default/assets/img/vip_i.gif'>";
             }
             $array['vip'] = $user->premium;
             $array['content'] .= '</span><p>' . $model->content . '</p></li>';
         }
     }
     echo json_encode($array);
 }
Ejemplo n.º 5
0
<div class='span3  '>
    <div class='card fix-card relative'>
        <div class='card-title'>
            <A href='#'>Câu hỏi & trả lời của thành viên</a>
        </div>
        <div class='mem-body' style="width:205px">
            <ul class="list_question_">
                <?php 
$i = 0;
foreach ($question as $k) {
    $i++;
    $rep = Mquestion::getQuestion($k->id);
    ?>
                    <li>
                        <span class="name"><a href="<?php 
    echo Yii::app()->getBaseUrl(true) . "/thanh-vien/" . $k->user_id;
    ?>
.html "><?php 
    echo $k->member->username;
    ?>
</a><?php 
    if ($k->member->premium == 1) {
        echo "<img src='" . Yii::app()->getBaseUrl(true) . "/themes/default/assets/img/vip_i.gif'>";
    }
    ?>
</span>
                        <p><?php 
    echo $k->content;
    ?>
</p>
                        <span class='answer' name="<?php 
Ejemplo n.º 6
0
 /**
  * 
  * @param type $id
  * @return all record question
  */
 public function getQuestion($id)
 {
     $model = new Mquestion();
     $total = $model->findAll("parent = " . $id . " and state = 1");
     return $total;
 }