コード例 #1
0
        echo Yii::t('web/home', 'Time start');
        ?>
:</span> <span style="color:#0FBB33;text-decoration: underline;"><?php 
        echo date('H:i d/m/Y', strtotime($item['start_date']));
        ?>
</span><span style="color: #999"> <?php 
        echo Yii::t('web/home', 'End');
        ?>
:</span> <span style="color:#FD8F2B;text-decoration: underline;"><?php 
        echo date('H:i d/m/Y', strtotime($item['end_date']));
        ?>
</span>
                            </span>
                            <span class="col-md-3" style="padding-left: 0px;">
                                <?php 
        $dataTraineeLog = WTrainingLog::getTraineeTrainingLog($trainee_id, 'r=wLecture/LectureView&course_lecture_id=' . $item['course_lecture_id']);
        if (!empty($dataTraineeLog)) {
            if (!empty($dataTraineeLog['result']) and $dataTraineeLog['result'] == 'OK') {
                ?>
                                            <span style="color: green; font-weight: bold;">OK</span>
                                            <?php 
            } elseif (!empty($dataTraineeLog['result']) and $dataTraineeLog['result'] == 'NOK') {
                ?>
                                            <span style="color: red; font-weight: bold;">NOK</span>
                                            <?php 
            } elseif (time() > strtotime($item['start_date']) and time() < strtotime($item['end_date'])) {
                ?>
                                            <span style="color: #0095B8; font-weight: bold;">Studying...</span>
                                            <?php 
            } else {
                ?>
コード例 #2
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;
     }
 }
コード例 #3
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionLectureView($course_lecture_id)
 {
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl(''));
     }
     $dataLectText = array();
     if (!empty($course_lecture_id)) {
         unset($_SESSION['listLectureText']);
         $db = Yii::app()->db;
         $today = date('Y-m-d H:i');
         $comm = $db->createCommand()->select('t.*,t2.course_name,t4.fullname,t4.id,t4.username,t3.id as lecture_id,t3.lecture_type,t3.avatar,t3.lecture_name,t3.intro,t3.training_minute,t3.files')->from('pls_course_lecture t')->leftJoin('pls_course t2', 't.course_id= t2.id')->leftJoin('pls_lecture t3', 't.lecture_id= t3.id')->leftJoin('pls_user t4', 't2.trainer_id= t4.id')->where('t.id=' . $course_lecture_id);
         $data = $comm->queryRow();
         $data = json_decode(json_encode($data), FALSE);
         if ($data->lecture_type == 1) {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY id ASC');
         } elseif ($data->lecture_type == 4) {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY sorder ASC');
         } else {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY id ASC');
         }
         $dataLectureText = CJSON::decode(CJSON::encode($dataLectureText));
         if (!empty($dataLectureText)) {
             foreach ($dataLectureText as $key => $item) {
                 $dataLectText[$item['id']] = array('lecture_text_title' => $item['title'], 'lecture_text_time' => $item['times'], 'lecture_text_content' => $item['content'], 'images' => $item['images'], 'times' => '', 'data' => 'data', 'lecture_id' => $item['lecture_id'], 'id' => $item['id']);
             }
         }
         Yii::app()->session->add('listLectureText', json_encode($dataLectText));
         $url = Yii::app()->getRequest()->getQueryString();
         $user_id = Yii::app()->user->id;
         $dataTrainingLog = WTrainingLog::model()->find('action_url="' . $url . '" AND user_id=' . $user_id);
         $dataTrainingLog = CJSON::decode(CJSON::encode($dataTrainingLog));
         if (!empty($dataTrainingLog)) {
             $itemRead = $dataTrainingLog['data'];
             if (!empty($itemRead)) {
                 $itemRead = explode(',', $itemRead);
                 foreach ($itemRead as $value) {
                     if (!empty($value)) {
                         $dataTrainingLog['itemActive'][] = $value;
                     }
                 }
             } else {
                 $dataTrainingLog['itemActive'] = array();
             }
         }
     }
     $this->render('view', array('model' => $data, 'text' => $dataLectText, 'dataTrainingLog' => (isset($dataTrainingLog) and !empty($dataTrainingLog)) ? $dataTrainingLog : array()));
 }
コード例 #4
0
ファイル: view.php プロジェクト: nguyendvphp/onlinetraining
             } else {
                 //Khong co bai Pos Test
                 if (time() > strtotime($item['end_date'])) {
                     echo "<span class='label label-default'>" . Yii::t('web/home', 'Not Finish') . "</span>";
                 } else {
                     echo '<a href="' . $url . '"><img src="' . Yii::app()->theme->baseUrl . '/img/complete.png" style="margin-right: 5px; border: 0px" /><span style="color: #3ab54a">' . Yii::t('web/home', 'Completed') . '</span></a>';
                 }
             }
         }
     }
 } else {
     // khong co pre test
     if (time() > strtotime($item['end_date'])) {
         echo "<span class='label label-default'>" . Yii::t('web/home', 'Not Finish') . "</span>";
     } else {
         if (WTrainingLog::getStatusLearnLecture('r=wlecture/LectureView&course_lecture_id=' . $item['id']) == FALSE) {
             if (time() > strtotime($item['end_date'])) {
                 echo "<span class='label label-default'>" . Yii::t('web/home', 'Not Finish') . "</span>";
             } else {
                 echo '<a href="' . $url . '"><span class="label label-info">' . Yii::t('web/home', 'Studying') . '...</span></a>';
             }
         } else {
             //Hoan thanh bai giang
             //Co bai Pos test
             if (!empty($item["test_id"])) {
                 //Kiem tra lam bai pos test hay chua
                 if (WUserTest::checkTestStatus($item["course_id"], $item["lecture_id"], $item["test_id"], Yii::app()->user->id, 0) == FALSE) {
                     if (time() > strtotime($item['end_date'])) {
                         echo "<span class='label label-default'>" . Yii::t('web/home', 'Not Finish') . "</span>";
                     } else {
                         echo "<span style=\"color: #ff6714\">" . Yii::t('web/home', 'Waiting for Post-test') . "</span> - <a href='" . $url . "'>" . Yii::t('web/home', 'Do Post-Testing now') . "</a>";
コード例 #5
0
            }
            ?>

            <tbody>
                <tr>
                    <td><?php 
            echo $i;
            ?>
</td>
                    <td><?php 
            echo $value_lecture['lecture_name'];
            ?>
</td>
                    <td>
                        <?php 
            $checkStatus = WTrainingLog::getStatusLecture("r=wLecture/LectureView&course_lecture_id=" . $value_lecture["courselectureid"], $data_user["id"]);
            if (!empty($checkStatus)) {
                //co post test
                if (!empty($value_lecture["post_test_id"]) and $checkStatus == TRUE and $post_test_check == TRUE) {
                    echo '<span class="label label-success">Completed</span>';
                } elseif (!empty($value_lecture["post_test_id"]) and $checkStatus == TRUE and $post_test_check == FALSE) {
                    echo '<span style="color: red"><span class="glyphicon glyphicon-remove"></span>   ' . Yii::t('web/home', 'Not-Completed') . '</span><br/><span style="font-size: 11px;font-style: italic;color: #CFCCCC;">Học viên chưa làm bài Post Test</span>';
                } else {
                    echo '<span class="label label-success">Completed</span>';
                }
            } else {
                if ($value_lecture["lecture_type"] == 3) {
                    if (time() < strtotime($value_lecture["end_date"]) and time() > strtotime($value_lecture["start_date"])) {
                        echo '<span class="label label-info">Studying...</span>';
                    } elseif (time() > strtotime($value_lecture["end_date"])) {
                        echo '<span class="label label-success">Completed</span>';
コード例 #6
0
 public function actionEndLectureText()
 {
     $course_lecture_id = $_POST['course_lecture_id'];
     $idtraininglog = $_POST['idtraininglog'];
     $totalText = $_POST['totalText'];
     $totalViewText = $_POST['totalViewText'];
     $viewListText = $_POST['viewListText'];
     $user_id = Yii::app()->user->id;
     $timeOK = $totalViewText / $totalText * 100;
     $viewText = $totalViewText . ' / ' . $totalText;
     $check = 'NOK';
     if ($timeOK >= 90) {
         $check = 'OK';
     }
     //$des = ' View : ('. number_format($timeOK,2,',','.') .'% View pages '.$viewText.')';
     $des = ' Hoàn thành : (' . number_format($timeOK, 2, ',', '.') . '% Xem ' . $viewText . ')';
     $desNotifi = 'Học viên hoàn thành : (' . number_format($timeOK, 2, ',', '.') . '% Xem ' . $viewText . ')';
     $modelTrainingLog = WTrainingLog::model()->findByPk($idtraininglog);
     $modelTrainingLog->user_id = $user_id;
     $modelTrainingLog->description = $des;
     $modelTrainingLog->result = $check;
     $modelTrainingLog->data = $viewListText;
     if ($modelTrainingLog->save()) {
         if ($modelTrainingLog->result == 'OK') {
             $userinfo = WUser::getFullNameUser(Yii::app()->user->id);
             $couseDetails = WCourseLecture::getInfoCourse($course_lecture_id);
             $trainer = WUser::getFullNameUser($couseDetails["created_by"]);
             $title = "Học viên " . $userinfo . " hoàn thành bài giảng:" . $couseDetails["course_name"];
             $content = "Dear <strong>" . $trainer . "</strong>";
             $content .= "<br/>Học viên <strong>" . $userinfo . '</strong> hoàn thành Bài giảng: <a href="' . Yii::app()->createUrl("wCourse/view", array("id" => $couseDetails["id"])) . '"><strong>' . $couseDetails["course_name"] . " (" . date('H:i d/m/Y') . ")</strong></a>";
             //$content .="<br/>==> <a href='".Yii::app()->createUrl("wCourse/view",array("id" => $couseDetails["id"]))."'>".$couseDetails["course_name"]."</a>";
             //$content .="<br />Congratulations, you have completed the lesson. ";
             //$content .="<br />Xin chúc mừng, Bạn đã hoàn thành bài học. ";
             $content .= "<br />" . $modelTrainingLog->description;
             WMessage::SendMessage($title, $content, "notifi", WUser::getIDMinUser(), $couseDetails["created_by"]);
             $mess = 'Xin chúc mừng, Bạn đã hoàn thành bài học. <br />' . $modelTrainingLog->description;
             // Chúc mừng bạn đã hoàn thành bài học
         } else {
             //$mess = 'You need to learn the lesson. <br />'.$modelTrainingLog->description;//Bạn cần phải học lại bài học.
             $mess = 'Bạn chưa hoàn thành bài học. <br />' . $modelTrainingLog->description;
             //Bạn cần phải học lại bài học.
         }
         echo json_encode(array('status' => 'true', 'result' => $modelTrainingLog->result, 'mess' => $mess));
     } else {
         echo json_encode(array('status' => 'false'));
     }
 }
コード例 #7
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionLectureView($course_lecture_id)
 {
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl(''));
     }
     $dataLectText = array();
     if (!empty($course_lecture_id)) {
         unset($_SESSION['listLectureText']);
         $db = Yii::app()->db;
         $today = date('Y-m-d H:i');
         $comm = $db->createCommand()->select('t.*,(SELECT COUNT(id) FROM pls_course_trainee WHERE course_id=t.course_id AND trainee_id=' . Yii::app()->user->id . ') as trainee,t.id as course_lecture_id,t2.id as course_id,t2.course_name,t4.fullname,t4.id,t4.username,t3.id as lecture_id,t3.lecture_type,t3.avatar,t3.lecture_name,t3.intro,t3.training_minute,t3.files,t3.seconds_question_vod')->from('pls_course_lecture t')->leftJoin('pls_course t2', 't.course_id= t2.id')->leftJoin('pls_lecture t3', 't.lecture_id= t3.id')->leftJoin('pls_user t4', 't2.trainer_id= t4.id')->where('t.id=' . $course_lecture_id);
         $data = $comm->queryRow();
         if (isset($data['trainee']) and $data['trainee'] == 0) {
             $this->redirect(Yii::app()->createUrl(''));
         }
         if (!empty($data['pre_test_id'])) {
             $checkEmptyTest = WTestParent::model()->find("id=" . $data["pre_test_id"]);
             if (!empty($checkEmptyTest)) {
                 $Pretest = WUserTest::model()->find('course_id=' . $data['course_id'] . ' AND test_kind=1 AND status=1 AND lecture_id=' . $data['lecture_id'] . ' AND test_id=' . $data['pre_test_id'] . ' AND user_id=' . Yii::app()->user->id);
                 if (empty($Pretest)) {
                     $this->redirect(Yii::app()->createUrl('wCourseLecture/introduce', array('course_id' => $data['course_id'], 'lecture_id' => $data['lecture_id'], 'test_id' => $data['pre_test_id'], 'kind' => 1)));
                 }
             }
         }
         if ($data['lecture_type'] == 3) {
             Yii::app()->session->add('idCourseLecture', $data['course_lecture_id']);
             $this->redirect(Yii::app()->createUrl('wLecture/WebinarDetails#primary'));
         }
         $data = json_decode(json_encode($data), FALSE);
         if ($data->lecture_type == 1) {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY id ASC');
         } elseif ($data->lecture_type == 4) {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY sorder ASC');
         } else {
             $dataLectureText = WLectureText::model()->findAll('lecture_id=' . $data->lecture_id . ' ORDER BY id ASC');
         }
         $dataLectureText = CJSON::decode(CJSON::encode($dataLectureText));
         if (!empty($dataLectureText)) {
             foreach ($dataLectureText as $key => $item) {
                 $dataLectText[$item['id']] = array('lecture_text_title' => $item['title'], 'lecture_text_time' => $item['times'], 'lecture_text_content' => $item['content'], 'images' => $item['images'], 'times' => '', 'data' => 'data', 'lecture_id' => $item['lecture_id'], 'id' => $item['id']);
             }
         }
         Yii::app()->session->add('listLectureText', json_encode($dataLectText));
         $url = Yii::app()->getRequest()->getQueryString();
         $user_id = Yii::app()->user->id;
         $dataTrainingLog = WTrainingLog::model()->find('action_url="' . $url . '" AND user_id=' . $user_id);
         $dataTrainingLog = CJSON::decode(CJSON::encode($dataTrainingLog));
         if (!empty($dataTrainingLog)) {
             $itemRead = $dataTrainingLog['data'];
             if (!empty($itemRead)) {
                 $itemRead = explode(',', $itemRead);
                 foreach ($itemRead as $value) {
                     if (!empty($value)) {
                         $dataTrainingLog['itemActive'][] = $value;
                     }
                 }
             } else {
                 $dataTrainingLog['itemActive'] = array();
             }
         }
     }
     $this->render('trainee/view', array('model' => $data, 'text' => $dataLectText, 'dataTrainingLog' => (isset($dataTrainingLog) and !empty($dataTrainingLog)) ? $dataTrainingLog : array()));
 }