public function actionRemoveAllInfoCourse()
 {
     $idcourse = $_REQUEST["idcourse"];
     $comm = Yii::app()->db->createCommand();
     $comm->reset();
     $comm->delete('pls_comment', 'data_id=' . $idcourse . ' AND data_type="course"');
     $ListCourseLEcture = WCourseLecture::ArrayIdCourseLecture(WCourseLecture::getListCourseLecture($idcourse));
     if (!empty($ListCourseLEcture)) {
         foreach ($ListCourseLEcture as $idcourselecture) {
             $comm->reset();
             $comm->delete('pls_training_log', 'action_url="r=wLecture/LectureView&course_lecture_id=' . $idcourselecture . '"');
             $comm->reset();
             $comm->delete('pls_training_randomquestion', 'course_lecture_id=' . $idcourselecture);
         }
     }
     $comm->reset();
     $comm->delete('pls_course_lecture', 'course_id=' . $idcourse);
     $comm->reset();
     $comm->delete('pls_course_trainee', 'course_id=' . $idcourse);
     $comm->reset();
     $comm->delete('pls_chat', 'course_id=' . $idcourse);
     $comm->reset();
     $comm->delete('pls_user_test', 'course_id=' . $idcourse);
     $comm->reset();
     $comm->delete('pls_course', 'id=' . $idcourse);
     echo json_encode(array("result" => "true"));
 }
示例#2
0
<?php

$data = WCourseLecture::MyTest(NULL, $course_id, NULL, $test_kind);
$total = WCourseLecture::getTotalPages(NULL, $course_id, NULL, $test_kind);
$page = ceil($total / 10);
if (!empty($data)) {
    ?>
<div id="datalistmytest">
<?php 
    foreach ($data as $key => $item) {
        ?>
    <div class="dataList_item_test">
        <a href="#" class="item_direct">
            <?php 
        if (!empty($item["avatar"])) {
            ?>
            <img class="img-thumbnail" src="<?php 
            echo Yii::app()->params['url_base'] . '/uploads/avatars/test/' . $item["avatar"];
            ?>
" />
            <?php 
        } else {
            ?>
            <img class="img-thumbnail" src="<?php 
            echo Yii::app()->theme->baseUrl;
            ?>
/img/pre-test.gif" />
            <?php 
        }
        ?>
        </a>
示例#3
0
 public static function getTestByLectureLog()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'user_id=:user_id and result=:result';
     $criteria->params = array(':user_id' => Yii::app()->user->id, ':result' => 'OK');
     $criteria->order = 'id DESC';
     $rs = WTrainingLog::model()->findAll($criteria);
     if ($rs) {
         $arrCL = array();
         foreach ($rs as $r) {
             $action = $r['action_url'];
             $arrAction = explode('&', $action);
             $stra = $arrAction[1];
             $course_lecture_id = explode('=', $stra);
             $arrCL[] = WCourseLecture::model()->find('id=:id ORDER BY id DESC', array(':id' => $course_lecture_id[1]));
         }
         return $arrCL;
     } else {
         return null;
     }
 }
示例#4
0
                                <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);
                ?>
</span></p>
                                <?php 
            }
            ?>
                            </div>
                            <div class="status_test">
                                <?php 
            if ($status_test['success'] == 0) {
                ?>
                                <div><span style="color: #0195e2; font-weight: bold;">Open</span></div>
                                <div style="color: #a7a7a7;"><?php 
                echo date('d/m/Y H:i:s', strtotime($item['start_date']));
                ?>
</div>
示例#5
0
 public static function getInfoCourseLectureComment($idcomment, $dataId, $dataType)
 {
     $db = Yii::app()->db;
     $dataNew = array();
     $group_id = Yii::app()->session["group_id"];
     if ($dataType == "course") {
         $comm = $db->createCommand()->select('t.*')->from('pls_course t')->where("t.id IS NOT NULL AND t.id=" . $dataId);
         $data = $comm->queryRow();
         if (!empty($data)) {
             $dataNew[$idcomment]["name"] = 'Course: ' . $data["course_name"];
             $url = Yii::app()->createUrl("wCourse/view", array("id" => $data["id"]));
             switch ($group_id) {
                 case 1:
                     $url = Yii::app()->createUrl("wCourse/view", array("id" => $data["id"], "row" => "comment_row_" . $idcomment));
                     break;
                 case 2:
                     $url = Yii::app()->createUrl("wCourse/TraineeViewCourse", array("id" => $data["id"], "row" => "comment_row_" . $idcomment));
                     break;
                 case 3:
                     $url = Yii::app()->createUrl("wCourse/view", array("id" => $data["id"], "row" => "comment_row_" . $idcomment));
                     break;
             }
             $dataNew[$idcomment]["url"] = $url;
         }
     } elseif ($dataType == "courselecture") {
         $comm = $db->createCommand()->select('t.*')->from('pls_lecture t')->where("t.id IS NOT NULL AND t.id=" . $dataId);
         $data = $comm->queryRow();
         if (!empty($data)) {
             $url = NULL;
             switch ($group_id) {
                 case 1:
                 case 3:
                     $url = Yii::app()->createUrl("wLecture/View", array("id" => $data["id"], "row" => "comment_row_" . $idcomment));
                     break;
                 case 2:
                     $datacourselecture = WCourseLecture::model()->findAll("lecture_id=" . $dataId);
                     $course_lecture_id = NULL;
                     if (!empty($datacourselecture)) {
                         foreach ($datacourselecture as $itemcourelecture) {
                             $modelCourseTrainee = WCourseTrainee::model()->find("course_id=" . $itemcourelecture->course_id . ' AND trainee_id=' . Yii::app()->user->id);
                             if (!empty($modelCourseTrainee)) {
                                 $course_lecture_id = $itemcourelecture->id;
                             }
                         }
                     }
                     if (!empty($course_lecture_id)) {
                         $url = Yii::app()->createUrl("wLecture/LectureView", array("course_lecture_id" => $course_lecture_id, "row" => "comment_row_" . $idcomment));
                     } else {
                         $url = "javascript:;";
                     }
                     break;
                     /*case 3:
                       $url = Yii::app()->createUrl("wSuperLecture/LectureView",array("course_lecture_id" => $data["id"]));;
                       break;*/
             }
             $dataNew[$idcomment]["name"] = 'Lecture: ' . $data["lecture_name"];
             $dataNew[$idcomment]["url"] = $url;
         }
     }
     return $dataNew;
 }
 /**
  * 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 WCourseLecture the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = WCourseLecture::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#7
0
</span></p>
                    <p><span class="col1">Duration: </span><span class="col2"><?php 
echo $test['time_test'];
?>
 minutes</span></p>
                    <div class="showintro">
                        <?php 
echo $test['introduce'];
?>
                    </div>
                </div>
                <div class="clear"></div>
                <div id='timer'>
                    <h6>Time remaining:</h6>
                    <?php 
$arr_test = WCourseLecture::getTestLectureUser($test['id'], $course_id, $lecture_id, $test['kind_of_test'], $kind);
$timer = WUserAnswers::ShowTimer(2, $arr_test['addedd_date'], $arr_test['time_test'], $test['id'], $course_id, $lecture_id, $total, $kind);
?>
                    <label id="lblTimer"><?php 
echo $timer;
?>
</label>

                </div>
            </div>
            <div class="clear"></div>
            <?php 
if (!empty($question)) {
    ?>
            <div class="number_ques" style="width: 100%; float:left; margin-top: 20px; margin-bottom: 20px;">
                <?php 
示例#8
0
<?php

/* @var $this LectureController */
/* @var $model WLecture */
/* @var $form CActiveForm */
$checkEmpty = array();
if (!$model->isNewRecord) {
    $checkEmpty = WCourseLecture::model()->findAll("lecture_id=" . $model->id);
}
?>
<div class="primary_page_edit">
    <div class="form_avatar">
        <a href="javascript:void(0);" style="min-height: 50px;">
            <center>
                <?php 
if (!empty($model->avatar)) {
    ?>
                    <img id="img_avatar_course" style="width:100%;" src="<?php 
    echo Yii::app()->params['url_base'] . '/uploads/avatars/lecture/' . $model->avatar;
    ?>
" alt=""/>
                    <?php 
} else {
    ?>
                    <img id="img_avatar_course" style="width:100%;" src="<?php 
    echo Yii::app()->theme->baseUrl;
    ?>
/img/add-avatar-lecture.jpg" alt=""/>
                <?php 
}
?>
示例#9
0
                    <?php 
    if ($dataTestUser["kind"] == 1) {
        ?>
                    <?php 
        $cl = WCourseLecture::model()->find('course_id=' . $dataTestUser['course_id'] . ' AND lecture_id=' . $dataTestUser['lecture_id'] . ' AND pre_test_id=' . $dataTestUser['id_test_parent'] . '');
        ?>
                    <a class="btn btn-danger" style="margin-top: 10px" href="<?php 
        echo Yii::app()->createUrl('wLecture/LectureView', array('course_lecture_id' => $cl->id));
        ?>
">Continue Lecture</a></p>
                    <?php 
    } elseif ($dataTestUser["kind"] == 0) {
        ?>
                    <?php 
        $cl = WCourseLecture::model()->find('course_id=' . $dataTestUser['course_id'] . ' AND lecture_id=' . $dataTestUser['lecture_id'] . ' AND test_id=' . $dataTestUser['id_test_parent'] . '');
        ?>
                    <a class="btn btn-danger" style="margin-top: 10px" href="<?php 
        echo Yii::app()->createUrl('wCourse/TraineeViewCourse', array('id' => $cl->course_id));
        ?>
">Continue</a></p>
                    <?php 
    }
    ?>
                <?php 
}
?>
            </div>
        </div>
    </div>
</div>
 public function actionUpdateTest()
 {
     $course_id = $_POST['course_id'];
     $lecture_id = $_POST['lecture_id'];
     $status = $_POST['status'];
     $idTest = $_POST['idTest'];
     $kind_of_test = $_POST['kind_of_test'];
     $model = WCourseLecture::model()->find('course_id=' . $course_id . ' AND lecture_id=' . $lecture_id);
     if ($status == 0) {
         if ($kind_of_test == 0) {
             $model->pre_test_id = $idTest;
         } elseif ($kind_of_test == 1) {
             $model->test_id = $idTest;
         }
     } else {
         if ($kind_of_test == 0) {
             $model->pre_test_id = '';
         } elseif ($kind_of_test == 1) {
             $model->test_id = '';
         }
     }
     if ($model->save()) {
         if ($kind_of_test == 0) {
             $idTest = $model->pre_test_id;
         } elseif ($kind_of_test == 1) {
             $idTest = $model->test_id;
         }
         echo json_encode(array('status' => 'true', 'idTest' => $idTest));
     } else {
         echo json_encode(array('status' => 'false', 'idTest' => 0));
     }
 }
 public function actionLectureList()
 {
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl(''));
     }
     $db = Yii::app()->db;
     $comm = $db->createCommand()->select('t.*')->from('pls_lecture_cat t');
     $data_lecture = $comm->queryAll();
     $comm = $db->createCommand()->select('t.*')->from('pls_course t')->leftJoin('pls_course_lecture t1', 't1.course_id = t.id')->group('t.id');
     $data_course = $comm->queryAll();
     $string_where = 't.status = 1';
     $data = array();
     if (isset($_REQUEST["page"])) {
         $page_number = filter_var($_REQUEST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
     } else {
         $page_number = 0;
     }
     if (isset($_REQUEST["cate"]) && !empty($_REQUEST["cate"])) {
         $string_where .= ' AND t2.id=' . $_REQUEST["cate"];
     } else {
         // $value='';
     }
     if (isset($_REQUEST["course"]) && !empty($_REQUEST["course"])) {
         $string_where .= ' AND t.course_id=' . $_REQUEST["course"];
     } else {
         // $value='';
     }
     $position = 0;
     $itempage = 6;
     $comm = $db->createCommand()->select('COUNT(*)')->from('pls_course_lecture t')->leftJoin('pls_lecture t1', 't1.id = t.lecture_id')->leftJoin('pls_lecture_cat t2', 't2.id = t1.lecture_cat_id')->leftJoin('pls_course t4', 't4.id = t.course_id')->where($string_where)->order('t.start_date ASC');
     $total = $comm->queryScalar();
     $comm->reset();
     $comm = $db->createCommand()->select('
                 t.id,
                 t1.lecture_type,
                 t1.lecture_name,
                 t1.training_minute,
                 t1.intro,
                 t1.avatar,
                 t1.pages,
                 t4.course_code,
                 t2.cat_name,
                 t5.fullname
             ')->from('pls_course_lecture t')->leftJoin('pls_lecture t1', 't1.id = t.lecture_id')->leftJoin('pls_lecture_cat t2', 't2.id = t1.lecture_cat_id')->leftJoin('pls_course t4', 't4.id = t.course_id')->leftJoin('pls_user t5', 't.trainer_id = t5.id')->where($string_where)->order('t.start_date ASC');
     // var_dump($string_where);
     /*$limit = 10;
       $page = (isset($_GET['page']) AND !empty($_GET['page'])) ? $_GET['page'] : 1;
       $offset = $limit * ($page-1);
        $pages = new CPagination($total);
       $pages->pageSize = $limit;
       */
     $comm->limit = $itempage;
     $comm->offset = $page_number * 6;
     $results = $comm->queryAll();
     $countLecture = WCourseLecture::model()->findAll();
     $total_pages = ceil(count($countLecture) / 6);
     // số trang = tất cả bản ghi/số bản ghi hiển thị 1 trang
     $this->render('supervisor/lecturelist', array('total_pages' => $total_pages, 'data_lecture' => $data_lecture, 'data_course' => $data_course, 'results' => $results));
 }
 /**
  * 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)
 {
     WCourseTrainee::model()->deleteAll(array('trainee_id' => $id));
     WCourseLecture::model()->deleteAll(array('trainee_id' => $id));
     WUserTest::model()->deleteAll(array('user_id' => $id));
     $this->loadModel($id)->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
    /**
     * This is the default 'index' action that is invoked
     * when an action is not explicitly requested by users.
     */
    public function actionIndex()
    {
        $view = 'index';
        if (Yii::app()->user->isGuest) {
            $this->redirect(array('login'));
        } else {
            if (Yii::app()->session['group_id'] == 2) {
                $this->layout = '//layouts/main';
                $view = 'trainee/index';
                $this->render($view);
            } elseif (Yii::app()->session['group_id'] == 1) {
                $this->layout = '//layouts/main';
                $view = 'trainer/index';
                $this->render($view);
            } elseif (Yii::app()->session['group_id'] == 4) {
                $this->layout = '//layouts/main';
                $view = 'teamleader/index';
                $this->render($view);
            } elseif (Yii::app()->session['group_id'] == 3) {
                $view = 'supervisor/index';
                // $view = 'index';
                $this->layout = '//layouts/main';
                $data = array();
                // biểu đồ liên quan
                $infoCourse = array();
                $criteria = new CDbCriteria();
                $criteria->condition = 'status = 1';
                $criteria->order = 'id desc';
                $criteria->limit = 6;
                $count = WUser::model()->count($criteria);
                $pages = new CPagination($count);
                // results per page
                $pages->pageSize = Params::$rowsPerPage;
                $pages->applyLimit($criteria);
                $infosupper = WUser::model()->findAll($criteria);
                // course_lecture
                /*   $courseLecture = array();
                     $db = Yii::app()->db;
                    	$comm = $db->createCommand()
                        ->select('COUNT(*)')
                        ->from('pls_course_lecture t')
                        ->leftJoin('pls_course t1','t1.id = t.course_id')
                        ->leftJoin('pls_lecture t2','t2.id = t.lecture_id')
                        ->leftJoin('pls_test t3','t3.id = t.pre_test_id')
                         ->leftJoin('pls_test t4','t4.id = t.test_id')
                        ->leftJoin('pls_user t5','t5.id = t.trainer_id')
                        ->order('t.id DESC');
                     $total = $comm->queryScalar();
                     $comm->reset();
                     $comm = $db->createCommand()
                        ->select('
                            t.*,
                            t1.course_name,
                            t2.lecture_name,
                            t3.test_name,
                            t4.test_name,
                            t5.fullname
                        ')
                        ->from('pls_course_lecture t')
                        ->leftJoin('pls_course t1','t1.id = t.course_id')
                        ->leftJoin('pls_lecture t2','t2.id = t.lecture_id')
                        ->leftJoin('pls_test t3','t3.id = t.pre_test_id')
                          ->leftJoin('pls_test t4','t4.id = t.test_id')
                        ->leftJoin('pls_user t5','t5.id = t.trainer_id')
                        ->order('t.id ASC');
                    	 $limit = 6;
                     $page = (isset($_GET['page']) AND !empty($_GET['page'])) ? $_GET['page'] : 1;
                     $offset = $limit * ($page-1);
                     $comm->limit = $limit;
                     $comm->offset = $offset;
                     $courseLecture = $comm->queryAll();
                     $pages = new CPagination($total);
                     $pages->pageSize = $limit;
                     */
                $courseLecture = array();
                $courseLecture = WCourseLecture::model()->findAll();
                $Lectures = array();
                $Lectures = WLecture::model()->findAll();
                // course trainne
                /*   $courseTrainee = array();
                     $db = Yii::app()->db;
                    	$comm = $db->createCommand()
                        ->select('COUNT(*)')
                        ->from('pls_course_trainee t')
                        ->leftJoin('pls_course t1','t1.id = t.course_id')
                        ->leftJoin('pls_user t2','t2.id = t.trainee_id')
                        ->order('t.id DESC');
                     $total = $comm->queryScalar();
                     $comm->reset();
                     $comm = $db->createCommand()
                        ->select('
                            t.*,
                            t1.course_name,
                            t2.fullname
                        ')
                        ->from('pls_course_trainee t')
                        ->leftJoin('pls_course t1','t1.id = t.course_id')
                        ->leftJoin('pls_user t2','t2.id = t.trainee_id')
                        ->order('t.id ASC');
                    	 $limit = 10;
                     $page = (isset($_GET['page']) AND !empty($_GET['page'])) ? $_GET['page'] : 1;
                     $offset = $limit * ($page-1);
                     $comm->limit = $limit;
                     $comm->offset = $offset;
                     $courseTrainee = $comm->queryAll();
                     $pages = new CPagination($total);
                     $pages->pageSize = $limit;*/
                // course_trainee
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('count(*)')->from('pls_user t')->where('t.user_group_id=2');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('*')->from('pls_user t')->where('t.user_group_id=2');
                $limit = 5;
                $page = (isset($_GET['page']) and !empty($_GET['page'])) ? $_GET['page'] : 1;
                $offset = $limit * ($page - 1);
                $comm->limit = $limit;
                $comm->offset = $offset;
                $data = $comm->queryAll();
                $result = array();
                if (!empty($data)) {
                    foreach ($data as $item) {
                        $result[$item['id']] = $item;
                        $comm->reset();
                        $comm = $db->createCommand()->select('t2.course_name')->from('pls_course_trainee t')->leftJoin('pls_course t2', 't.course_id= t2.id')->where('t.trainee_id=' . $item['id'] . ' AND t.status = 1');
                        $Trainee = $comm->queryAll();
                        $result[$item['id']]['course_list'] = $Trainee;
                    }
                }
                $pages = new CPagination($total);
                $pages->pageSize = $limit;
                $TraineeUser = array();
                $TraineeUser = WUser::model()->findAll('status=1 and user_group_id=2');
                //	 var_dump(count($TraineeUser));
                $TrainerUser = array();
                $TrainerUser = WUser::model()->findAll('status =1 and user_group_id=1');
                // var_dump(count($TrainerUser));
                $sum = array();
                $sum = array_merge($TraineeUser, $TrainerUser);
                //	 var_dump(count($sum));die;
                // var_dump(count($sumUser));die;
                // course_trainer
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('count(*)')->from('pls_user t')->where('t.user_group_id=1');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('*')->from('pls_user t')->where('t.user_group_id=1');
                $limit = 6;
                $page = (isset($_GET['page']) and !empty($_GET['page'])) ? $_GET['page'] : 1;
                $offset = $limit * ($page - 1);
                $comm->limit = $limit;
                $comm->offset = $offset;
                $data = $comm->queryAll();
                $resultTrainer = array();
                if (!empty($data)) {
                    foreach ($data as $item) {
                        $result[$item['id']] = $item;
                        $comm->reset();
                        $comm = $db->createCommand()->select('t2.course_name')->from('pls_course_trainee t')->leftJoin('pls_course t2', 't.course_id= t2.id')->where('t.trainee_id=' . $item['id'] . ' AND t.status = 1');
                        $courseTrainee = $comm->queryAll();
                        $resultTrainer[$item['id']]['course_list'] = $courseTrainee;
                    }
                }
                $pages = new CPagination($total);
                $pages->pageSize = $limit;
                // var_dump(count($resultTrainer));die;
                // course_result_test
                $courseTest = array();
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('COUNT(*)')->from('pls_user_test t')->leftJoin('pls_course t1', 't1.id = t.course_id')->leftJoin('pls_user t2', 't2.id = t.user_id')->leftJoin('pls_test t3', 't3.id = t.test_id')->order('t.course_id DESC');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('
	                t.*,
	                t1.course_name,
	                t2.fullname,
	                t3.total_point
	            ')->from('pls_user_test t')->leftJoin('pls_course t1', 't1.id = t.course_id')->leftJoin('pls_user t2', 't2.id = t.user_id')->leftJoin('pls_test t3', 't3.id = t.test_id')->order('t.course_id ASC');
                $limit = 6;
                $page = (isset($_GET['page']) and !empty($_GET['page'])) ? $_GET['page'] : 1;
                $offset = $limit * ($page - 1);
                $comm->limit = $limit;
                $comm->offset = $offset;
                $courseTest = $comm->queryAll();
                $pages = new CPagination($total);
                $pages->pageSize = $limit;
                // lecture_schedule
                $lectureSchedule = array();
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('COUNT(*)')->from('pls_course_lecture t')->leftJoin('pls_course t1', 't1.id = t.course_id')->leftJoin('pls_lecture t2', 't2.id = t.lecture_id')->leftJoin('pls_user t5', 't5.id = t.trainer_id')->order('t.trainer_id DESC');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('
	                t.*,
	                t1.course_name,
	                t2.lecture_name,
	                t5.fullname
	            ')->from('pls_course_lecture t')->leftJoin('pls_course t1', 't1.id = t.course_id')->leftJoin('pls_lecture t2', 't2.id = t.lecture_id')->leftJoin('pls_user t5', 't5.id = t.trainer_id')->order('t.trainer_id DESC');
                $limit = 6;
                $page = (isset($_GET['page']) and !empty($_GET['page'])) ? $_GET['page'] : 1;
                $offset = $limit * ($page - 1);
                $comm->limit = $limit;
                $comm->offset = $offset;
                $lectureSchedule = $comm->queryAll();
                $pages = new CPagination($total);
                $pages->pageSize = $limit;
                //  running course
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('COUNT(*)')->from('pls_course t')->leftJoin('pls_course_cat t1', 't1.id = t.course_cat_id')->where('t.status = 2 and t.end_date > NOW()')->order('t.start_date ASC');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('
                    t.*,
                    t1.course_cat,
                    t1.avatar
                ')->from('pls_course t')->leftJoin('pls_course_cat t1', 't1.id = t.course_cat_id')->where('t.status = 2 and t.end_date > NOW()')->order('t.start_date ASC');
                $limit = 6;
                $page = (isset($_GET['page']) and !empty($_GET['page'])) ? $_GET['page'] : 1;
                $offset = $limit * ($page - 1);
                $comm->limit = $limit;
                $comm->offset = $offset;
                $runningCourse = $comm->queryAll();
                $pages = new CPagination($total);
                $pages->pageSize = $limit;
                $totalCourse = array();
                $coursependding = array();
                $courseactive = array();
                $coursestart = array();
                $coursecomplete = array();
                $totalCourse = WCourse::model()->findAll();
                $coursependding = WCourse::model()->findAll('status=0');
                $courseactive = WCourse::model()->findAll('status=1');
                $coursestart = WCourse::model()->findAll('status=2');
                $coursecomplete = WCourse::model()->findAll('status=5');
                $imgoverview = '<img width="680px" height="360px" src="' . Yii::app()->theme->baseUrl . '/img/overview.png" />';
                //  training proccessing
                $dashCourse = array();
                $db = Yii::app()->db;
                $comm = $db->createCommand()->select('COUNT(*)')->from('pls_course t')->leftJoin('pls_user t2', 't2.id = t.trainer_id')->order('t.status ASC');
                $total = $comm->queryScalar();
                $comm->reset();
                $comm = $db->createCommand()->select('
                    t.*,
                    t2.fullname
                ')->from('pls_course t')->leftJoin('pls_user t2', 't2.id = t.trainer_id')->order('t.status ASC');
                $dashCourse = $comm->queryAll();
                $total_pages = ceil(count($dashCourse) / Params::$coursePerPage);
                $test = $db->createCommand('
                SELECT course_id, user_id, AVG(point_percent), YEAR(end_date) ,Y.course_name FROM(
                    SELECT A.course_id, A.lecture_id, A.test_id, A.pass_score_point, A.user_id,  C.total_point,
                        ROUND(IFNULL(A.pass_score_point, 0)*100 / C.total_point, 0) point_percent
                      FROM pls_user_test A
                     INNER JOIN pls_test C ON A.test_id = C.id
                        WHERE A. status  = 1 AND A.success = 2
                     GROUP BY  A.course_id, A.test_id, A.user_id, A.lecture_id
                ) X
                INNER JOIN pls_course Y ON X.course_id = Y.id 
                WHERE Y.end_date < NOW()
                GROUP BY course_id, end_date ,course_name , YEAR(end_date)
                ORDER BY YEAR(end_date) ASC
            ');
                $test = $test->queryAll();
                // MyHelper::dump($test);die;
                $this->render($view, array('total_pages' => $total_pages, 'test' => $test, 'totalCourse' => $totalCourse, 'coursependding' => $coursependding, 'courseactive' => $courseactive, 'coursestart' => $coursestart, 'coursecomplete' => $coursecomplete, 'Lectures' => $Lectures, 'TraineeUser' => $TraineeUser, 'TrainerUser' => $TrainerUser, 'sum' => $sum, 'imgoverview' => $imgoverview, 'runningCourse' => $runningCourse, 'courseTrainer' => $resultTrainer, 'courseTrainee' => $result, 'courseLecture' => $courseLecture, 'courseTest' => $courseTest, 'lectureSchedule' => $lectureSchedule));
                //  $this->render($view,array('courseTrainee'=>$courseTrainee, 'courseLecture'=>$courseLecture, 'courseTest'=>$courseTest,'lectureSchedule'=>$lectureSchedule));
            }
        }
    }
示例#14
0
                    <center>
                        <?php 
if (!empty($model['avatar'])) {
    ?>
                        <img id="img_avatar_course" width="100" class="img-thumbnail" src="<?php 
    echo Yii::app()->params['url_base'] . '/uploads/avatars/test/' . $model['avatar'];
    ?>
" alt=""/>
                        <?php 
} else {
    ?>
                        <img width="100" class="img-thumbnail" src="
                        <?php 
    if (WCourseLecture::checkPretestOrTest($course_id, $lecture_id, $test_id) === 'POSTTEST') {
        echo Yii::app()->theme->baseUrl . '/img/test.gif';
    } elseif (WCourseLecture::checkPretestOrTest($course_id, $lecture_id, $test_id) === 'PRETEST') {
        echo Yii::app()->theme->baseUrl . '/img/pre-test.gif';
    }
    ?>
                        " alt=""/>
                        <?php 
}
?>
            
                    </center>
                </a>
            </div>
            <div class="frr">
                <h2 style="margin-top: 0px; font-size: 14px;">
                    <?php 
if ($kind == 0) {
示例#15
0
. Results will be announced later.</div>
            
            </div>
            <div>
                <?php 
if ($model->kind_of_test == 1 or $model->kind_of_test == 2) {
    $cl = WCourseLecture::model()->find('course_id=' . $_REQUEST['course_id'] . ' AND lecture_id=' . $_REQUEST['lecture_id'] . ' AND pre_test_id=' . $_REQUEST['test_id']);
    ?>
                <a class="btn btn-danger" style="margin-top: 10px" href="<?php 
    echo Yii::app()->createUrl('wLecture/LectureView', array('course_lecture_id' => $cl->id));
    ?>
">Continue Lecture</a>
                <?php 
} elseif ($model->kind_of_test == 0) {
    ?>
                    <?php 
    $cl = WCourseLecture::model()->find('course_id=' . $_REQUEST['course_id'] . ' AND lecture_id=' . $_REQUEST['lecture_id'] . ' AND test_id=' . $_REQUEST['test_id']);
    ?>
                    <p><a class="btn btn-danger" style="margin-top: 10px" href="<?php 
    echo Yii::app()->createUrl('wCourse/TraineeViewCourse', array('id' => $cl->course_id));
    ?>
">Continue Course</a></p>
                    <p><span style="color: green; margin-top: 10px;">Congratulations, you have completed the lesson.</span></p>
                <?php 
}
?>
            </div>
        </div>
        
    </div>
</div>
示例#16
0
</span></p>
                <p><span class="col1">Duration: </span><span class="col2"><?php 
echo $test['time_test'];
?>
</span></p>
                <div class="showintro">
                    <?php 
echo $test['introduce'];
?>
                </div>
            </div>
            <div class="clear"></div>
            <div id='timer'>
            <h6>Time remaining:</h6>
            <?php 
$arr_test = WCourseLecture::getTestLectureUser($test['id'], $course_id, $lecture_id);
$timer = WUserAnswers::ShowTimer($arr_test['tstatus'], $arr_test['addedd_date'], $arr_test['time_test'], $test['id'], $course_id, $lecture_id);
?>
            <label id="lblTimer"><?php 
echo $timer;
?>
</label>
            
            </div>
        </div>
        <div class="clear"></div>
        <div class="number_ques" style="width: 100%; float:left; margin-top: 20px; margin-bottom: 20px;">
            <?php 
//echo $str;
?>
            <?php 
示例#17
0
    echo Yii::t('web/home', 'Kind of test');
    ?>
</td><td><?php 
    if ($model['kind_of_test'] == 0) {
        echo 'Post test';
    } elseif ($model['kind_of_test'] == 1) {
        echo 'Pre-test';
    } elseif ($model['kind_of_test'] == 2) {
        echo 'Both';
    }
    ?>
</td>
                                </tr>
                            </table>
                            <?php 
    if (!WUserTest::checkUserTested($model['id']) && !WCourseLecture::checkTestPreTest($model['id'])) {
        ?>
                            <a id="link_update" href="<?php 
        echo Yii::app()->createUrl('wTest/Update', array('id' => $model['id']));
        ?>
"><button class="btn btn-success">Edit Test</button></a>
                            <a id="link_delete" onclick="delete_test(<?php 
        echo $model['id'];
        ?>
)" href="javascript:void(0);" class="btn btn-danger">Delete</a>
                            <?php 
    }
    ?>
                            
                        </div>
                        <div class="introduce_v" style="margin-top: 15px; float: left; width: 100%;">
 /**
  * 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'] : '';
     $arrJson = array();
     WCourseLecture::updateTestPreTest($id);
     WQuestion::deleteQues($id);
     if ($this->loadModel($id)->delete()) {
         $arrJson = array('status' => true, 'msg' => 'Success');
     } else {
         $arrJson = array('status' => false, 'msg' => 'UnSuccess');
     }
     echo CJSON::encode($arrJson);
     exit;
 }
 public static function checkTestPreTest($test_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'test_id =:test_id OR pre_test_id =:pre_test_id';
     $criteria->params = array(':test_id' => $test_id, ':pre_test_id' => $test_id);
     $rs = WCourseLecture::model()->findAll($criteria);
     if ($rs && count($rs) > 0) {
         return true;
     } else {
         return false;
     }
 }
 public function actionUpdateTest()
 {
     $idcourselecture = $_REQUEST['idcourselecture'];
     $kind_of_test = $_REQUEST['kind_of_test'];
     $model = WCourseLecture::model()->find("id=" . $idcourselecture);
     if ($kind_of_test == 0) {
         $model->test_id = NULL;
     } elseif ($kind_of_test == 1) {
         $model->pre_test_id = NULL;
     }
     if ($model->save()) {
         echo json_encode(array('result' => 'true'));
     } else {
         echo json_encode(array('result' => 'false'));
     }
 }