public function actionIntroduce()
 {
     $test_id = isset($_GET['test_id']) ? $_GET['test_id'] : '';
     $course_id = isset($_GET['course_id']) ? $_GET['course_id'] : '';
     $lecture_id = isset($_GET['lecture_id']) ? $_GET['lecture_id'] : '';
     $data = WTest::model()->find('id=:id', array(':id' => $test_id));
     $this->render('introduce', array('data' => $data, 'course_id' => $course_id, 'lecture_id' => $lecture_id));
 }
 public function actionListtest($test_id)
 {
     $cs = Yii::app()->getClientScript();
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl("/"));
     }
     $this->redirect(Yii::app()->createUrl("wUserTest"));
     exit;
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/jquery-ui.css?ver=' . time());
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/dialog.css?ver=' . time());
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery.simplemodal-1.4.4.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-ui.js');
     $kind = isset($_REQUEST['kind']) ? $_REQUEST['kind'] : '';
     $course_id = isset($_REQUEST['course_id']) ? $_REQUEST['course_id'] : '';
     $total = count(WUserTest::model()->findAll('test_id=:test_id and course_id=:course_id and test_kind=:test_kind', array(':test_id' => $test_id, ':course_id' => $course_id, ':test_kind' => $kind)));
     $arrUserTest = WUserTest::model()->find('test_id=:test_id and course_id=:course_id and test_kind=:test_kind order by finish_date DESC', array(':test_id' => $test_id, ':course_id' => $course_id, ':test_kind' => $kind));
     $listTrainee = WUserTest::listTest($course_id);
     $test = WTest::model()->find('id=:id', array(':id' => $test_id));
     $this->render('listtest', array('ut' => $arrUserTest, 'test' => $test, 'listtrainee' => $listTrainee, 'finish_date' => '', 'total' => $total, 'course_id' => $course_id));
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return WTest the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = WTest::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #4
0
 public static function updatePoint($test_id, $point)
 {
     $test = WTest::model()->find('id=:id', array(':id' => $test_id));
     $point_now = $test['total_point'];
     $div_point = (int) $point_now - (int) $point;
     $sql = "Update {{test}} SET total_point = " . $div_point . " WHERE id=" . $test_id . "";
     $command = Yii::app()->db->createCommand($sql);
     $exe = $command->execute();
     if ($exe) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #5
0
} elseif ($data['test_kind'] == 1) {
    ?>
                <span class="icon_test_pre">
                    <?php 
    echo Yii::t('web/home', 'Pre-test');
    ?>
                </span>
                <?php 
}
?>
                <?php 
echo $data->test->test_name;
?>
</h3>
                <?php 
$arrtest = WTest::model()->find('id=:id', array(':id' => $data->test->id));
?>
                <p><span class="col1"><?php 
echo Yii::t('web/home', 'Category');
?>
: </span><span class="col2"><a href="" style="color: #3AB54A;"><?php 
echo $arrtest->testcat->test_cat;
?>
</span></a></p>
                <p><span class="col1"><?php 
echo Yii::t('web/home', 'Questions');
?>
: </span><span class="col2"><?php 
echo count($arrtest->question);
?>
</span></p>