Example #1
0
                ?>
/img/avatar_test.png" />
                                <?php 
            }
            ?>
                            </a>
                            <div class="item" style="font-size: 16px;">
                                <h2 style="font-size: 16px;"><a href="<?php 
            echo Yii::app()->createUrl('wCourseLecture/Introduce', array('course_id' => $item['course_id'], 'lecture_id' => $item['lecture_id'], 'test_id' => $item->test->id));
            ?>
"><?php 
            echo CHtml::encode($item->test->test_name);
            ?>
</a></h2>
                                <p><span class="col1">Questions: </span><span class="col2"><?php 
            echo count(WQuestion::model()->findAll('test_id=:test_id', array(':test_id' => $item['test_id'])));
            ?>
</span></p>
                                <?php 
            if ($status_test['success'] == 2) {
                //$oneUT = WUserTest::model()->find('test_id=:test_id and user_id=:user_id', array(':test_id'=> $item->test->id, ':user_id'=>Yii::app()->user->id));
                ?>
                                <p><span class="col1">Mark:</span><span class="col2"><?php 
                echo $status_test['pass_score_point'];
                ?>
/<?php 
                echo $item->test->total_point;
                ?>
 points - <?php 
                echo WCourseLecture::labelStatusMark($status_test['pass_score_point'], $item->test->total_point);
                ?>
Example #2
0
 public static function checkTypeQuestion($test_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'test_id=:test_id';
     $criteria->params = array(':test_id' => $test_id);
     $rs = WQuestion::model()->findAll($criteria);
     if ($rs) {
         $ques_type = array();
         foreach ($rs as $r) {
             $ques_type[] = $r['question_type'];
         }
         if (in_array('2', $ques_type)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 public function loadModelQuestion($id)
 {
     $model = WQuestion::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
            <!--<div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                  <div class="checkbox">
                    <label>
                      <input type="checkbox" /> Show Introduce
                    </label>
                  </div>
                </div>
            </div>-->
            <hr />
            <div class="form-group">
                <label for="WTest_test_name" class="col-sm-2 control-label required">Question:</label>
                <div class="col-sm-10">
                    <div class="questiontest">
                        <?php 
$arrQ = WQuestion::model()->findAll('test_id=:test_id', array(':test_id' => $model->id));
if (count($arrQ) > 0) {
    $k = 1;
    foreach ($arrQ as $ques) {
        ?>
                        <div class="q1">Question <?php 
        echo $k;
        ?>
 <span id="q<?php 
        echo $k;
        ?>
"></span></div>
                        <div class="content_question">
                            <div class="point">
                                <label for="WTest_total_point" class="col-sm-4 control-label required">Point</label>
                                <div class="col-xs-6 col-sm-4">
Example #5
0
 /**
  * Get section questions count
  *
  * @return int
  */
 public function getQuestionsCount()
 {
     return WQuestion::model()->count("test_id=:test_id", array("test_id" => $this->id));
 }
Example #6
0
            <h6 style="color: #3ab54a; font-weight: bold;"><?php 
echo Yii::t('web/home', 'Test results');
?>
:</h6>
            <?php 
$strChoice = '<table width="800px" border=1>
                <thead>
                    <tr>
                        <th>' . Yii::t('web/home', 'Question') . '</th>
                        <th>' . Yii::t('web/home', 'Results') . '</th>
                        <th>' . Yii::t('web/home', 'Points') . '</th>
                    </tr>
                </thead>
                <tbody>';
$strWrite = '';
$arrQues = WQuestion::model()->findAll('test_id=:test_id', array(':test_id' => $data->test->id));
$i = 1;
foreach ($arrQues as $ques) {
    if ($ques['question_type'] == 2) {
        $arrUA = WUserAnswers::model()->find('question_id=:question_id and user_test_id=:user_test_id', array(':question_id' => $ques['id'], ':user_test_id' => $user_test_id));
        $strWrite .= '<div class="quesw"><span style="font-weight: bold;">' . Yii::t('web/home', 'Question') . ' ' . $i . '</span> (' . $ques['point'] . ' ' . Yii::t('web/home', 'points') . ')</div>
                                <div class="name_ques">' . $ques['question_text'] . '</div>
                                <input type="hidden" id="pointstr" value="' . $ques['point'] . '" />
                                <div class="ans" style="font-style: italic;">' . Yii::t('web/home', 'Answer') . ':</div>
                                <div class="answer">
                                    <p>' . $arrUA['user_answer_text'] . '</p>
                                </div>';
        if ($arrUA['user_answer_text'] != '') {
            $name_ques = $ques['question_text'];
            //$q_id      = $ques['id'];
            $point = WUserTest::model()->find('id=:id', array(':id' => $user_test_id));
Example #7
0
 public static function getAllQuestion($test_id)
 {
     return WQuestion::model()->findAll('test_id=:test_id ORDER BY RAND()', array(':test_id' => $test_id));
 }