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));
 }
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete()
 {
     $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
     $model = $this->loadModel($id);
     $arrJson = array();
     WTest::updatePoint($model['test_id'], $model['point']);
     if (WQuestionAnswer::deleteQuesAns($id) && $this->loadModel($id)->delete()) {
         $arrJson = array('status' => true, 'msg' => 'Success');
     } else {
         $arrJson = array('status' => false, 'msg' => 'UnSuccess');
     }
     echo CJSON::encode($arrJson);
     exit;
 }
 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));
 }
Пример #4
0
            ?>
                            <div class="row_test">
                                <span class="col-md-1 row_item"><img align="top" src="<?php 
            echo Yii::app()->theme->baseUrl;
            ?>
/img/dot-2.png"/> <?php 
            echo Yii::t('web/home', 'Test');
            ?>
 :</span>
                                <span class="info_test col-md-8 row_item" ><?php 
            echo '[' . $item['test_code'] . '] ' . $item['test_name'];
            ?>
</span>
                                <span class="col-md-3">
                                        <?php 
            $result_test = WTest::getTestResult($item['test_id'], $item['course_id'], $item['lecture_id'], 0, $trainee_id);
            ?>
                                    <?php 
            if (!empty($result_test) and $result_test['pass_score_point'] == $result_test['total_point']) {
                ?>
                                        <span style="color: #0FBB33"><?php 
                echo Yii::t('web/home', 'Done');
                ?>
: <?php 
                echo !empty($result_test['pass_score_point']) ? $result_test['pass_score_point'] : 0;
                ?>
/<?php 
                echo $result_test['total_point'];
                ?>
</span>
                                        <?php 
 /**
  * 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;
 }
Пример #6
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;
     }
 }
Пример #7
0
                        <button class="btn btn-success" id="btn_start_lecture" onclick="return loadVOD();">
                            <?php 
            echo Yii::t('web/home', 'Start Lecture');
            ?>
                        </button>
                        <!--<button class="btn btn-danger" style="display: none;" id="btn_stop_lecture" onclick="return StopLecture();"><?php 
            echo Yii::t('web/home', 'Stop');
            ?>
</button>-->
                        <?php 
        }
        ?>

                        <?php 
        //Kiem tra co pos test hay khong va co ton tai hay khong
        if (!empty($model->test_id) and WTest::checkEmptyTest($model->test_id) == TRUE) {
            //Button Do Pos Test se hien thi o day
            //2 truong hop Lecture Ok va Lecture NOK
            if (empty($dataTrainingLog) or $dataTrainingLog['result'] == 'NOK') {
                //truong hop Null va NOK
                ?>
                                <a id="btnContinueTest" disabled="disabled" href="<?php 
                echo Yii::app()->createUrl('wCourseLecture/Introduce', array('course_id' => $model->course_id, 'lecture_id' => $model->lecture_id, 'test_id' => $model->test_id, 'kind' => 0));
                ?>
" class="btn btn-default">Do Post Test</a>
                                <?php 
            } elseif (!empty($dataTrainingLog) and $dataTrainingLog['result'] == 'OK') {
                //truong hop OK
                //co 2 truong hop
                //Da lam bai test va chua lam bai test
                if (WUserTest::checkTestSuccess($model->course_id, $model->lecture_id, $model->test_id, Yii::app()->user->id, 0) == TRUE) {
Пример #8
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>