public function actionCreateTrainee()
 {
     $cs = Yii::app()->getClientScript();
     //$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/ckeditor/ckeditor.js');
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.css');
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/bootstrap-datepicker/bootstrap-datetimepicker.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.ui.widget.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.js', CClientScript::POS_END);
     $model = new WUser();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['WUser'])) {
         $model->attributes = $_POST['WUser'];
         $model->password = CFunction::encrypt(Yii::app()->params->password_default, Yii::app()->params->hashkey);
         $model->supervisor_code = Yii::app()->user->id;
         $model->status = 1;
         if ($model->save()) {
             $this->redirect(array('AllTrainee'));
         }
     }
     $this->render('createtrainee', array('model' => $model));
 }
Exemplo n.º 2
0
 /**
  * Expire login
  * User need change password to insite
  * @return boolean whether login
  */
 public static function expire()
 {
     $user = WUser::model()->find('LOWER(username)=?', array(strtolower(Yii::app()->user->name)));
     $time_changepass = strtotime($user['time_changepass']);
     $now = time();
     $datediff = $now - $time_changepass;
     $number_date = floor($datediff / (60 * 60 * 24));
     if (isset($time_changepass) && $time_changepass != '' || $number_date <= Yii::app()->params->number_date_expire) {
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 3
0
 public function init()
 {
     date_default_timezone_set('Asia/Ho_Chi_Minh');
     parent::init();
     $this->pageTitle = Yii::app()->params['page_title'];
     $this->metaKeywords = 'hoc online, training online';
     $this->metaDescription = 'hoc online, training online';
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/global.js');
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/countdown.js');
     $language = Yii::app()->session->get('language') ? Yii::app()->session->get('language') : 'en';
     Yii::app()->setLanguage($language);
     //echo Yii::app()->user->id; exit();
     if (Yii::app()->user->id) {
         //$user = new WUsers;
         $userInfo = WUser::getUserById(Yii::app()->user->id);
         //$agen = unserialize($userInfo['group']);
         $this->username = Yii::app()->user->name;
         Yii::app()->session['username'] = $this->username;
         Yii::app()->session['fullname'] = $userInfo['fullname'];
         Yii::app()->session['group_id'] = $userInfo['user_group_id'];
         if (Yii::app()->session['group_id'] == 2) {
             Yii::app()->session['company_code'] = $userInfo['company_code'];
         }
         // var_dump($userInfo['avatar']);
         $string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/no_avatar.jpg';
         if (isset($userInfo['user_group_id']) && !empty($userInfo['user_group_id'])) {
             // gv
             if ($userInfo['user_group_id'] == 1) {
                 $string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/trainer.gif';
             }
             // hs
             if ($userInfo['user_group_id'] == 2) {
                 $string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/trainee.gif';
             }
             // sp
             if ($userInfo['user_group_id'] == 3) {
                 $string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/supervisor.gif';
             }
         }
         Yii::app()->session['avatar'] = (isset($userInfo['avatar']) and !empty($userInfo['avatar'])) ? Yii::app()->params['url_base'] . '/uploads/avatars/user/' . $userInfo['avatar'] : $string_avatar_none;
     }
     //load XML Config
     //$xmlPath = realpath($path = Yii::app()->basePath.'/../'.Yii::app()->params['config_folder'].'/');
     //$xmlFile = Yii::app()->params['config_file_name'];
     //$this->config = new LoadConfigXML($xmlPath,$xmlFile);
     Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
 }
Exemplo n.º 4
0
 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $user = WUser::model()->find('LOWER(username)=?', array(strtolower($this->username)));
     //var_dump($user); exit();
     //echo CFunction::encrypt($this->password,Yii::app()->params->hashkey);exit();
     //echo $user->validatePassword($this->password,Yii::app()->params->hashkey);exit();
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!$user->validatePassword($this->password, Yii::app()->params->hashkey)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->_id = $user->id;
             //$this->_group_id = $user->group;
             $this->username = $user->username;
             $this->errorCode = self::ERROR_NONE;
             //update login
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionTraineeViewCourse($id)
 {
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl(''));
     }
     $dataCourseLecture = array();
     $listTrainee = array();
     $db = Yii::app()->db;
     if (!empty($id)) {
         $data = WCourseLecture::model()->findAll('course_id=' . $id . ' ORDER BY start_date ASC');
         $data = CJSON::decode(CJSON::encode($data));
         $course_data = WCourse::getDetailCourse($id);
         if (!empty($data)) {
             foreach ($data as $key => $item) {
                 if (!empty($item["lecture_id"])) {
                     $lectureDetails = WLecture::model()->find('id=' . $item['lecture_id']);
                     if (!empty($lectureDetails)) {
                         $category = $lectureDetails->category;
                         $lectureDetails = CJSON::decode(CJSON::encode($lectureDetails));
                         $dataCourseLecture[$item['id']] = $item;
                         $dataCourseLecture[$item['id']]['details'] = $lectureDetails;
                         $dataCourseLecture[$item['id']]['cat_name'] = $category->cat_name;
                         $dataCourseLecture[$item['id']]['PreTest'] = FALSE;
                         if (strtotime($course_data["end_date"]) < strtotime($item["end_date"])) {
                             $dataCourseLecture[$item['id']]['end_date'] = $course_data["end_date"];
                         }
                         if (!empty($item['pre_test_id'])) {
                             $comm = $db->createCommand()->select('t.*')->from('pls_user_test t')->where('course_id=' . $item['course_id'] . ' AND success = 2 AND lecture_id=' . $item['lecture_id'] . ' AND test_id=' . $item['pre_test_id'] . ' AND user_id=' . Yii::app()->user->id);
                             $preTest = $comm->queryRow();
                             $comm->reset();
                             if (!empty($preTest)) {
                                 $dataCourseLecture[$item['id']]['PreTest'] = TRUE;
                             }
                         }
                         $dataCourseLecture[$item['id']]['Test'] = FALSE;
                         if (!empty($item['test_id'])) {
                             $comm = $db->createCommand()->select('t.*')->from('pls_user_test t')->where('course_id=' . $item['course_id'] . ' AND success=2 AND lecture_id=' . $item['lecture_id'] . ' AND test_id=' . $item['test_id'] . ' AND user_id=' . Yii::app()->user->id);
                             $Test = $comm->queryRow();
                             $comm->reset();
                             if (!empty($Test)) {
                                 $dataCourseLecture[$item['id']]['Test'] = TRUE;
                             }
                         }
                     }
                 }
                 // Info Pre-Test
             }
         }
         $dataTrainee = WCourseTrainee::model()->findAll('course_id=' . $id);
         $dataTrainee = CJSON::decode(CJSON::encode($dataTrainee));
         if (!empty($dataTrainee)) {
             foreach ($dataTrainee as $item) {
                 $traineeDetails = WUser::model()->find('id=' . $item['trainee_id']);
                 if (!empty($traineeDetails)) {
                     $traineeDetails = CJSON::decode(CJSON::encode($traineeDetails));
                     $listTrainee[$traineeDetails['id']]['id'] = $traineeDetails['id'];
                     $listTrainee[$traineeDetails['id']]['course_id'] = $id;
                     $listTrainee[$traineeDetails['id']]['fullname'] = $traineeDetails['fullname'];
                     $listTrainee[$traineeDetails['id']]['username'] = $traineeDetails['username'];
                 }
             }
         }
     }
     $this->render('trainee/view', array('model' => $this->loadModel($id), 'dataCourseLecture' => $dataCourseLecture, 'listTrainee' => $listTrainee));
 }
Exemplo n.º 6
0
    echo $totalnoanswer;
    ?>
</strong> câu hỏi chờ giáo viên chọn đáp án <?php 
}
?>
<br/>

                    <?php 
if (!empty($totalQuestionText) and $totalQuestionText > 0) {
    ?>

                    Có <strong style="color: #D30C0C"><?php 
    echo $totalQuestionText;
    ?>
</strong> câu hỏi tự luận. Giáo viên <strong><?php 
    echo WUser::getFullNameUser($testDetails->created_by);
    ?>
</strong> sẽ chấm bài tự luận của bạn.
                    <?php 
}
?>
                </div>
                <div class="alert alert-success" role="alert" style="background: #dff0d8; border-color: #d6e9c6; width: 80%;margin: 0px auto; margin-top: 10px;">
                    Tổng điểm bạn đạt được 
                    <p style="text-align: center; font-weight: bold; font-size: 60px;"><?php 
echo !empty($dataUserTest["pass_score_point"]) ? $dataUserTest["pass_score_point"] : 0;
?>
/<?php 
echo $testDetails->total_point;
?>
</p>
 /**
  * Luu ket qua test vao db 
  **/
 public function actionResult()
 {
     $this->layout = '//layouts/main_trainer';
     $cs = Yii::app()->getClientScript();
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/jquery-ui.css?ver=' . time());
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/dialog.css?ver=' . time());
     //$cs->registerCssFile(Yii::app()->theme->baseUrl.'/css/jquery.countdown.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');
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery.slimscroll.min.js');
     $courseid = isset($_REQUEST['course_id']) ? $_REQUEST['course_id'] : '';
     $lecture_id = isset($_REQUEST['lecture_id']) ? $_REQUEST['lecture_id'] : '';
     $test_id = isset($_REQUEST['test_id']) ? $_REQUEST['test_id'] : '';
     $total = isset($_REQUEST['total']) ? $_REQUEST['total'] : '';
     $kind = isset($_REQUEST['kind']) ? $_REQUEST['kind'] : '';
     //Thong tin bai test
     $testDetails = WTestParent::model()->find("id=" . $test_id);
     //Get tong so cau hoi
     $db = Yii::app()->db;
     $comm = $db->createCommand()->select('t.*')->from('pls_test_user t')->where('t.id_test_parent=' . $test_id . ' AND t.user_id=' . Yii::app()->user->id . ' AND kind=' . $kind . ' AND t.course_id=' . $courseid . ' AND t.lecture_id=' . $lecture_id);
     $dataTestUser = $comm->queryRow();
     if (empty($dataTestUser)) {
         $this->redirect(Yii::app()->createUrl("/"));
     }
     $totalquestion = 0;
     $totalTrue = 0;
     $totalQuestionText = 0;
     $totalfails = 0;
     $totalnotdoing = 0;
     $totalnoanswer = 0;
     if (!empty($dataTestUser) and !empty($dataTestUser["dataquestion"])) {
         if (!empty($dataTestUser["dataquestion"])) {
             $dataquestion = json_decode($dataTestUser["dataquestion"], true);
             $totalquestion = count($dataquestion);
         }
         //lay so cau hoi dung
         if (!empty($dataTestUser["datafinish"])) {
             $datafinish = json_decode($dataTestUser["datafinish"], true);
             foreach ($datafinish as $itemdatafinish) {
                 if ($itemdatafinish["question_type"] != 2 and isset($itemdatafinish["check"]) and $itemdatafinish["check"] == "OK") {
                     ++$totalTrue;
                 } elseif ($itemdatafinish["question_type"] != 2 and isset($itemdatafinish["check"]) and $itemdatafinish["check"] == "NOK" and isset($itemdatafinish["doing"]) and $itemdatafinish["doing"] == 1) {
                     $totalfails++;
                 } elseif ($itemdatafinish["question_type"] != 2 and isset($itemdatafinish["check"]) and $itemdatafinish["check"] == "NOK" and isset($itemdatafinish["doing"]) and $itemdatafinish["doing"] == 0) {
                     $totalnotdoing++;
                 } elseif ($itemdatafinish["question_type"] == 2) {
                     ++$totalQuestionText;
                 } elseif (!isset($itemdatafinish["check"])) {
                     ++$totalnoanswer;
                 }
             }
         }
     }
     // Tong diem
     $comm->reset();
     $comm = $db->createCommand()->select('t.*')->from('pls_user_test t')->where('t.test_id=' . $test_id . ' AND test_kind=' . $kind . ' AND t.course_id=' . $courseid . ' AND t.lecture_id=' . $lecture_id . ' AND user_id=' . Yii::app()->user->id);
     $dataUserTest = $comm->queryRow();
     $courseDetails = WCourse::model()->find("id=" . $courseid);
     $username = WUser::getFullNameUser(Yii::app()->user->id);
     $trainer = WUser::getFullNameUser($courseDetails->created_by);
     $title = "Học viên " . $username . " Làm xong bài Test :" . $testDetails->test_name;
     $content = "Dear <strong>" . $trainer . "</strong>";
     $content .= "<br/>Có học viên <strong>" . $username . "</strong> làm xong bài test : " . $testDetails->test_name . " (" . date('H:i d/m/Y') . ")";
     $content .= "<br/><a href='" . Yii::app()->createUrl("wUserTest/viewdetails", array("id" => $dataUserTest["id"])) . "'>Click để xem chi tiết</a>";
     WMessage::SendMessage($title, $content, "notifi", WUser::getIDMinUser(), $courseDetails->created_by);
     $modeltest = WTest::model()->find('id=:id', array(':id' => $test_id));
     $this->render('/wTest/trainee/_result', array('testDetails' => $testDetails, 'totalquestion' => $totalquestion, 'totalQuestionText' => $totalQuestionText, 'totalTrue' => $totalTrue, 'totalfails' => $totalfails, 'totalnotdoing' => $totalnotdoing, 'totalnoanswer' => $totalnoanswer, 'dataUserTest' => $dataUserTest, 'dataTestUser' => $dataTestUser));
 }
 public function actionBlockTrainee()
 {
     $name_hs = isset($_REQUEST["name_hs"]) ? $_REQUEST["name_hs"] : NULL;
     $course_lecture_id = isset($_REQUEST["course_lecture_id"]) ? $_REQUEST["course_lecture_id"] : NULL;
     $dataUser = array();
     if (!empty($name_hs)) {
         $dataUser = WUser::getUserByUsername($name_hs);
     }
     if (!empty($dataUser)) {
         $trainee_id = $dataUser->id;
         $model = new WBlockWebinar();
         $model->user_id = $trainee_id;
         $model->trainer_id = Yii::app()->user->id;
         $model->course_lecture_id = $course_lecture_id;
         $time = date('Y-m-d H:i:s');
         $timeunlock = strtotime('+2 day', strtotime($time));
         $model->timeblock = $time;
         $model->timeunblock = date('Y-m-d H:i:s', $timeunlock);
         $model->save();
     }
 }
 public function actionSendComment()
 {
     $dataType = $_REQUEST["dataType"];
     $dataId = $_REQUEST["dataId"];
     $action_url = $_REQUEST["action_url"];
     $contentComment = $_REQUEST["contentComment"];
     $parent_id = $_REQUEST["parent_id"];
     $_db = Yii::app()->db;
     $comm = $_db->createCommand();
     $result = $comm->insert('pls_comment', array('parent_id' => $parent_id, 'user_id' => Yii::app()->user->id, 'content' => $contentComment, 'data_id' => $dataId, 'data_type' => $dataType, 'status' => 1, 'created_date' => date('Y-m-d H:i:s'), 'action_url' => strtolower($action_url)));
     if ($result) {
         $idnewrecord = Yii::app()->db->getLastInsertID($result);
         if ($dataType == "course") {
             $courseDetails = WCourse::model()->find("id=" . $dataId);
             if (Yii::app()->user->id != $courseDetails->created_by) {
                 $title = "Bình Luận Khóa học: " . $courseDetails->course_name;
                 $content = "";
                 $user = WUser::getUserById(Yii::app()->user->id);
                 if (Yii::app()->session["group_id"] == 1) {
                     $content .= "Có giáo viên <strong>" . $user->username . "</strong> bình luận tại Khóa học: <a href='" . Yii::app()->createUrl('wCourse/view', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseDetails->course_name . "\"</a>";
                 } else {
                     if (Yii::app()->session["group_id"] == 2) {
                         $content .= "Có học viên <strong>" . $user->username . "</strong> bình luận tại Khóa học: <a href='" . Yii::app()->createUrl('wCourse/view', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseDetails->course_name . "\"</a>";
                     } else {
                         if (Yii::app()->session["group_id"] == 3) {
                             $content .= "Có Quản trị viên <strong>" . $user->username . "</strong> bình luận tại Khóa học: <a href='" . Yii::app()->createUrl('wCourse/view', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseDetails->course_name . "\"</a>";
                         }
                     }
                 }
                 $content .= '<br/>Click xem chi tiết: <a href="' . Yii::app()->createUrl('wCourse/view', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . '">' . $courseDetails->course_name . '</a>';
                 WMessage::SendMessage($title, $content, "notifi", WUser::getIDMinUser(), $courseDetails->created_by);
             }
         } elseif ($dataType == "courselecture") {
             $courseLecture = WLecture::model()->find("id=" . $dataId);
             if (Yii::app()->user->id != $courseLecture->created_by) {
                 $title = "Bình Luận Bài Giảng: " . $courseLecture->lecture_name;
                 $content = "";
                 $user = WUser::getUserById(Yii::app()->user->id);
                 if (Yii::app()->session["group_id"] == 1) {
                     $content .= "Có giáo viên <strong>" . $user->username . "</strong> bình luận tại Bài Giảng: <a href='" . Yii::app()->createUrl('wLecture/View', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseLecture->lecture_name . "\"</a>";
                 } else {
                     if (Yii::app()->session["group_id"] == 2) {
                         $content .= "Có học viên <strong>" . $user->username . "</strong> bình luận tại Bài Giảng: <a href='" . Yii::app()->createUrl('wLecture/View', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseLecture->lecture_name . "\"</a>";
                     } else {
                         if (Yii::app()->session["group_id"] == 3) {
                             $content .= "Có Quản trị viên <strong>" . $user->username . "</strong> bình luận tại Bài Giảng: <a href='" . Yii::app()->createUrl('wLecture/View', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . "'>\"" . $courseLecture->lecture_name . "\"</a>";
                         }
                     }
                 }
                 $content .= '<br/>Click xem chi tiết: <a href="' . Yii::app()->createUrl('wLecture/View', array("id" => $dataId, "row" => "comment_row_" . $idnewrecord)) . '">' . $courseLecture->lecture_name . '</a>';
                 WMessage::SendMessage($title, $content, "notifi", WUser::getIDMinUser(), $courseLecture->created_by);
             }
         }
         echo json_encode(array("result" => "true"));
     } else {
         echo json_encode(array("result" => "false"));
     }
 }
Exemplo n.º 10
0
">
                <span class="glyphicon glyphicon-off"   aria-hidden="true"></span> <?php 
        echo Yii::t('web/home', 'Cancel');
        ?>
            </button>
        </p>
    </td>
    <td><a target="_blank" href="<?php 
        echo Yii::app()->createUrl('wCourse/view', array('id' => $commentCourse["course_id"], "row" => 'comment_row_' . $commentCourse["id"]));
        ?>
" ><?php 
        echo $commentCourse["course_name"];
        ?>
</a></td>
    <td><center><strong><?php 
        echo WUser::getFullNameUser($commentCourse["user_id"]);
        ?>
</strong></center></td>
    <td><?php 
        echo date('H:i:s m/d/Y', strtotime($commentCourse["created_date"]));
        ?>
</td>
    <td>
        <button data-id="<?php 
        echo $commentCourse["id"];
        ?>
" onclick="return removeComment(this);" class="btn btn-danger btn-xs"><?php 
        echo Yii::t('web/home', 'Delete');
        ?>
</button>
    </td>
Exemplo n.º 11
0
 
          </font>
         <!--  Created date: <font class="time_last">
         <?php 
        if (!empty($item['created_date'])) {
            echo date('d-m-Y', $item['created_date']);
        } else {
            echo 'N/A';
        }
        ?>
</font> -->
          </span>
      </td>
      <td>
          <?php 
        echo !empty($item['supervisor_code']) ? WUser::getFullNameSuperUser($item['supervisor_code']) : 'N/A';
        ?>
      </td>
      <td><?php 
        echo !empty($item['email']) ? $item['email'] : 'N/A';
        ?>
</td>
      <td><?php 
        echo !empty($item['phone']) ? $item['phone'] : 'N/A';
        ?>
</td>
      <td><?php 
        echo !empty($item['address']) ? $item['address'] : 'N/A';
        ?>
</td>
      
Exemplo n.º 12
0
?>
		<?php 
echo $form->dropDownList($model, 'course_id', CHtml::listData(WCourse::model()->findAll(), 'id', 'course_name'), array('prompt' => 'Chọn khóa học :'));
?>
		<?php 
echo $form->error($model, 'course_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'trainee_id');
?>

        <?php 
echo $form->dropDownList($model, 'trainee_id', CHtml::listData(WUser::model()->findAll("group_id=2"), 'id', 'fullname'), array('class' => 'chosen-select', 'multiple' => 'multiple', 'data-placeholder' => "Chọn học viên vào lớp"));
?>
        <?php 
echo $form->error($model, 'trainee_id');
?>
            <input type="hidden" id="list_trainee" name="list_trainee" />
        <?php 
$cs = Yii::app()->getClientScript();
$cs->registerCssFile(Yii::app()->theme->baseUrl . '/chosen/chosen.css');
?>
        <script type="text/javascript">
            function add_chosen(item) {
                $('#list_trainee').val($('#list_trainee').val()+item.value+",");
            };

            function delete_chosen(item) {
Exemplo n.º 13
0
 public static function SendMessage($title, $content, $typeSend = "notifi", $iduserFrom = NULL, $iduserTo)
 {
     $titlemessage = $title;
     $contentmessage = $content;
     if (empty($iduserFrom)) {
         $iduserFrom = WUser::getIDMinUser();
     }
     $date = date('Y-m-d H:i:s');
     if (!empty($iduserTo)) {
         $message = new WMessage();
         $message->status = 1;
         $message->title = $titlemessage;
         $message->created_by = $iduserFrom;
         $message->created_date = $date;
         $message->type_message = $typeSend;
         if ($message->save()) {
             $idmessage = $message->id;
             $messgetTrash = new WMessageTrash();
             $messgetTrash->id_message = $idmessage;
             $messgetTrash->trash = 0;
             $messgetTrash->save();
             $messageContent = new WMessageContent();
             $messageContent->created_date = $date;
             $messageContent->content = $contentmessage;
             $messageContent->id_message = $idmessage;
             $messageContent->created_by = $iduserFrom;
             $messageContent->status = 1;
             if ($messageContent->save()) {
                 $idmessagecontent = $messageContent->id;
                 if (!empty($iduserTo)) {
                     $dataUser = WUser::getUserByUsername($iduserTo);
                     $messageSendto = new WMessageSendto();
                     $messageSendto->id_message = $idmessage;
                     $messageSendto->id_message_content = $idmessagecontent;
                     $messageSendto->id_user_to = $iduserTo;
                     $messageSendto->type_message = $typeSend;
                     $messageSendto->status = 0;
                     $messageSendto->trash = 0;
                     if ($messageSendto->save()) {
                     } else {
                         echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 03. Mời bạn thử lại'));
                         die;
                     }
                 }
             } else {
                 echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 02. Mời bạn thử lại'));
                 die;
             }
         } else {
             echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 01. Mời bạn thử lại'));
             die;
         }
     } else {
         echo json_encode(array('result' => 'false', 'html' => 'Không có User nào cần gửi'));
     }
 }
Exemplo n.º 14
0
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title"><?php 
echo Yii::t('web/home', 'titleBoxAddTrainee');
?>
</h4>
            </div>
            <!--form search-->
            <div class="modal-body" >
                <label class="sr-only"><?php 
echo Yii::t('web/home', 'Search');
?>
</label>
                <input type="text" id="trainee_username" class="form-control" placeholder="Username Or Fullname Or Email" style="width: 600px;float: left;">
                <?php 
echo Chtml::dropDownList('dataListCompany', 'id', Chtml::listData(WUser::model()->findAll('company is NOT NULL GROUP BY company'), "company", "company"), array('empty' => Yii::t('web/home', 'Select a Company'), 'style' => 'width:215px;float:left;margin-left:10px', 'class' => 'form-control'));
?>
                <button type="button" onclick="return loadTraineeOption();" class="btn btn-success" style="margin-left: 10px; float: left;"><?php 
echo Yii::t('web/home', 'Search');
?>
</button>
                <div id="bodyTraineeList" style="float: left;width: 100%; margin-top: 10px;"></div>
                <div class="clear"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success btn-sm" onclick="return addMutilTrainee();"><?php 
echo Yii::t('web/home', 'titleBoxAddTraineeButtonAdd');
?>
</button>
                <button type="button" class="btn btn-danger btn-sm" data-dismiss="modal" ><?php 
echo Yii::t('web/home', 'titleBoxAddTraineeButtonClose');
Exemplo n.º 15
0
    if ($data['username']) {
        echo $data['username'];
    } else {
        echo 'N/A';
    }
    ?>
</p></td>
                                </tr>
                                <?php 
    if ($data['user_group_id'] == 1) {
        ?>
                                <tr class="company">
                                    <td><p>Supervisor :  </p></td>
                                    <td class="value"><p><?php 
        if ($data['supervisor_code']) {
            echo WUser::getFullNameSuperUser($data['supervisor_code']);
        } else {
            echo 'N/A';
        }
        ?>
</p></td>
                                </tr>
                                <?php 
    } else {
        ?>
                                <tr class="company">
                                    <td><p>Company :  </p></td>
                                    <td class="value"><p><?php 
        if ($data['company_code']) {
            echo WCompany::getNameCompany($item['company_code']);
        } else {
Exemplo n.º 16
0
    /**
     * 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));
            }
        }
    }
Exemplo n.º 17
0
                <?php 
echo $form->textArea($model, 'address', array('size' => 60, 'maxlength' => 255, 'class' => 'form-control'));
?>
                <?php 
echo $form->error($model, 'address');
?>
            </td>
        </tr>
        <tr>
            <td width="130"><?php 
echo $form->labelEx($model, 'supervisor_code');
?>
</td>
            <td  style="padding-bottom: 10px;">
                <?php 
echo $form->dropDownList($model, 'supervisor_code', CHtml::listData(WUser::model()->findAll('status=:status and user_group_id=:group_id', array(':status' => 1, ':group_id' => 3)), "username", "fullname"), array('class' => 'form-control'));
?>
                <?php 
echo $form->error($model, 'supervisor_code');
?>
            </td>
        </tr>
        <tr>
            <td width="130"><?php 
echo $form->labelEx($model, 'time_startwork');
?>
</td>
            <td  style="padding-bottom: 10px;">
                <?php 
echo $form->textField($model, 'time_startwork', array('size' => 50, 'maxlength' => 50, 'class' => 'form-control'));
?>
Exemplo n.º 18
0
 public static function getUserByUsername($username)
 {
     return WUser::model()->find('username=:username', array(':username' => $username));
 }
 public function actionRspass()
 {
     // thu vien mail
     Yii::import('application.extensions.phpmailer.JPhpMailer');
     $check_date = '';
     // check login
     if (!empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createurl(''));
     }
     $page = 0;
     if (!empty($_REQUEST['acc']) && !empty($_REQUEST['token'])) {
         $username_var = trim($_REQUEST['acc']);
         $username_var = str_replace(array(',', "'", '"', ' ', '%'), '', $username_var);
         $token_string = trim($_REQUEST['token']);
         $token_string = str_replace(array(',', "'", '"', ' ', '%'), '', $token_string);
         //check token
         $criteria = new CDbCriteria();
         $criteria->select = array('*');
         $criteria->addCondition('user_name= "' . $username_var . '" AND token_check="' . $token_string . '"');
         $check_token = WUserLosePass::model()->find($criteria);
         $check_token = CJSON::decode(CJSON::encode($check_token));
         if (empty($check_token)) {
             $check_date = 'Chuỗi kick hoạt không đúng ! bạn vui lòng sử dụng đúng URL trong Email !';
         } else {
             $date_now = date('Y-m-d');
             //get id lost
             $criteria = new CDbCriteria();
             $criteria->select = array('*');
             $criteria->addCondition('user_name= "' . $username_var . '"');
             $get_lost_id = WUserLosePass::model()->findAll($criteria);
             $get_lost_id = CJSON::decode(CJSON::encode($get_lost_id));
             $criteria = new CDbCriteria();
             $criteria->select = array('*');
             $criteria->addCondition('user_name= "' . $username_var . '" AND end_time_change >= "' . $date_now . '"');
             $data_lost = WUserLosePass::model()->findAll($criteria);
             $data_lost = CJSON::decode(CJSON::encode($data_lost));
             //check user
             $criteria = new CDbCriteria();
             $criteria->select = array('*');
             $criteria->addCondition('username= "******"');
             $data = WUser::model()->find($criteria);
             $data = CJSON::decode(CJSON::encode($data));
             if (empty($data_lost)) {
                 // var_dump($data_lost);
                 $check_date = 'Quá hạn kich hoạt email!';
             }
             if (empty($check_date) && !empty($data)) {
                 if (!empty($_REQUEST['password'])) {
                     $pass_new = CFunction::encrypt($_REQUEST['password'], Yii::app()->params->hashkey);
                     $model = WUserUpdate::model()->find('id=' . $data['id']);
                     $model->password = $pass_new;
                     if ($model->save()) {
                         if ($get_lost_id) {
                             foreach ($get_lost_id as $key => $value) {
                                 $id = $value['id'];
                                 $this->loadModel($id)->delete();
                             }
                         }
                         $this->render('success_change_pass');
                         $page = 1;
                     }
                 }
             }
         }
     }
     if ($page == 0) {
         $dataProvider = new CActiveDataProvider('WUserLosePass');
         $this->render('lostpass', array('dataProvider' => $dataProvider, 'check_date' => $check_date));
     }
 }
Exemplo n.º 20
0
    border: solid 1px #DEE0E6;
  font-weight: bold;
  color: #20252B;
  padding: 8px 12px;
}
.primary_container ul.yiiPager .selected a{
  background: #2EB15C;
}
</style>
<div class="primary_boxtop">
    <div class="primary_boxtop_content">
        <h1 class="fl"><img src="<?php 
echo Yii::app()->theme->baseUrl;
?>
/img/btn_icon_course.png" align="middle" alt="Course" />Trainee List Of Supervisor: <?php 
echo WUser::getFullNameSuperUser($_GET['super_code']);
?>
</h1>
        <a class="fr btn btn-warning" href="<?php 
echo Yii::app()->createUrl('wManagerUser/AllSuper');
?>
"><span class="btn_right">Back</span></a>
        <a class="fr btn btn-success" href="javascript:void(0)" onclick="showListSuper()"><span class="btn_right">Change Supervisor</span></a>
        <div class="clear"></div>
    </div>
</div>
<div class="primary_container">
<div class="primary_container_test" style="box-shadow: 0px 0px 0px; border: 0px; ">
    <div class="container_test">
        <div class="box_test">
            <div id="container_course">
Exemplo n.º 21
0
 /**
  * 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 WUser the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = WUser::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 22
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'));
     }
 }
?>
/webRTC/js/firebase.js"></script>
<script type="text/javascript" src="<?php 
echo Yii::app()->params['url_base'];
?>
/webRTC/js/RTCMultiConnection-v2.2.4.js"></script>
<!--<script type="text/javascript" src="--><?php 
//echo Yii::app()->params['url_base'];
?>
<!--/webRTC/js/getMediaElement.css"></script>-->
<script type="text/javascript" src="<?php 
echo Yii::app()->params['url_base'];
?>
/webRTC/js/getMediaElement.js"></script>
<?php 
$dataUser = WUser::model()->find("id=" . Yii::app()->user->id);
?>

<div class="primary_boxtop">
    <div class="primary_boxtop_content">
        <h1 class="fl"><img src="<?php 
echo Yii::app()->theme->baseUrl;
?>
/img/icon-webinar.png" align="middle" alt="Course" /><?php 
echo $dataCourseLecture['lecture_name'];
?>
</h1>
        <div class="clear"></div>
    </div>
</div>
<div class="primary_container">
Exemplo n.º 24
0
 public static function getUserById($id)
 {
     return WUser::model()->find('id=:id', array(':id' => $id));
 }
Exemplo n.º 25
0
    ?>
                        <?php 
    foreach ($list as $item) {
        ?>
                          <tr id="row_trainee">
                              <td>
                                  <?php 
        echo $i;
        ?>
                              </td>
                              <td><?php 
        echo !empty($item['log_time']) ? date('Y-m-d H:i:s', $item['log_time']) : 'N/A';
        ?>
</td>
                              <td><?php 
        echo !empty($item['user_id']) ? WUser::getFullNameUser($item['user_id']) : 'N/A';
        ?>
</td>
                              <td><?php 
        echo !empty($item['action']) ? $item['action'] : 'N/A';
        ?>
</td>
                              <td><a href="#"><img src="<?php 
        echo Yii::app()->theme->baseUrl;
        ?>
/img/delete.png" width="16" /></a></td>
                          </tr>
                          <?php 
        $i++;
    }
    ?>
 public function actionSendMessageReply()
 {
     if (empty(Yii::app()->user->id)) {
         echo json_encode(array('result' => 'false', 'html' => 'Bạn cần đăng nhập để sử dụng chức năng này'));
     }
     $username = $_REQUEST["username"];
     $idmessage = $_REQUEST["idmessage"];
     $contentmessage = $_REQUEST["contentmessage"];
     $arrUserTo = array();
     $arrUserTo = explode(',', $username);
     $arrUserTo = self::convertArr($arrUserTo);
     $date = date('Y-m-d H:i:s');
     if (!empty($username)) {
         $messageContent = new WMessageContent();
         $messageContent->created_date = $date;
         $messageContent->content = $contentmessage;
         $messageContent->id_message = $idmessage;
         $messageContent->created_by = Yii::app()->user->id;
         $messageContent->status = 1;
         if ($messageContent->save()) {
             WMessageSendto::model()->updateAll(array('trash' => 0), "id_message=" . $idmessage . " AND id_user_to=" . Yii::app()->user->id);
             $idmessagecontent = $messageContent->id;
             foreach ($arrUserTo as $user) {
                 if (!empty($user)) {
                     $dataUser = WUser::getUserByUsername($user);
                     $messageSendto = new WMessageSendto();
                     $messageSendto->id_message = $idmessage;
                     $messageSendto->id_message_content = $idmessagecontent;
                     $messageSendto->id_user_to = $dataUser->id;
                     $messageSendto->status = 0;
                     $messageSendto->trash = 0;
                     $messageSendto->type_message = "message";
                     if ($messageSendto->save()) {
                     } else {
                         echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 03. Mời bạn thử lại'));
                         die;
                     }
                 }
             }
         } else {
             echo json_encode(array('result' => 'false', 'html' => 'Lỗi thao tác 02. Mời bạn thử lại'));
             die;
         }
     } else {
         echo json_encode(array('result' => 'false', 'html' => 'Không có User nào cần gửi'));
         die;
     }
     echo json_encode(array('result' => 'true', 'html' => 'Bạn gửi tin nhắn thành công'));
     die;
 }
 public function actionMarkTest()
 {
     $arrQuestion = isset($_REQUEST["arrQuestion"]) ? $_REQUEST["arrQuestion"] : array();
     $user_test_id = isset($_REQUEST["user_test_id"]) ? $_REQUEST["user_test_id"] : NULL;
     $json = array("result" => "true");
     if (!empty($arrQuestion)) {
         $checkSave = TRUE;
         foreach ($arrQuestion as $itemquestion) {
             $model = WUserAnswers::model()->find("question_id=" . $itemquestion["idquestion"] . ' AND user_test_id=' . $itemquestion["user_test_id"]);
             if (!empty($model)) {
                 $model->point_answer_text = $itemquestion["point_answer_text"];
                 $model->comment_trainer = $itemquestion["comment_question"];
                 if (!$model->save()) {
                     $checkSave = FALSE;
                 }
             }
         }
         if ($checkSave == TRUE) {
             $arrPointQuestion = array();
             // Lay Point cua cau hoi
             $db = Yii::app()->db;
             $comm = $db->createCommand()->select('t.*,t2.test_name')->from('pls_user_test t')->LeftJoin('pls_test_parent t2', 't2.id=t.test_id')->LeftJoin('pls_course t3', 't3.id=t.course_id')->where('t.id=' . $user_test_id . ' AND t3.created_by=' . Yii::app()->user->id);
             $dataUserTest = $comm->queryRow();
             $comm->reset();
             $comm = $db->createCommand()->select('t.*')->from('pls_test_user t')->where('t.id_test_parent=' . $dataUserTest["test_id"] . ' AND user_id=' . $dataUserTest["user_id"] . ' AND kind=' . $dataUserTest["test_kind"] . ' AND t.course_id=' . $dataUserTest["course_id"] . ' AND t.lecture_id=' . $dataUserTest["lecture_id"]);
             $dataTestUser = $comm->queryRow();
             if (!empty($dataTestUser)) {
                 if (!empty($dataTestUser["dataquestion"])) {
                     $dataquestion = json_decode($dataTestUser["dataquestion"], true);
                     if (!empty($dataquestion)) {
                         foreach ($dataquestion as $itemdataquestion) {
                             $arrPointQuestion[$itemdataquestion["idquestion"]]["point"] = $itemdataquestion["point"];
                             $arrPointQuestion[$itemdataquestion["idquestion"]]["answertrue"] = WQuestionAnswerLib::getAnswerTrueQuestion($itemdataquestion["idquestion"]);
                         }
                     }
                 }
             }
             // Select Nhung cau tra loi cua hoc vien
             $comm->reset();
             $comm = $db->createCommand()->select('t.*')->from('pls_user_answers t')->where('t.user_test_id=' . $user_test_id);
             $dataUserAnswer = $comm->queryAll();
             if (!empty($dataUserAnswer)) {
                 foreach ($dataUserAnswer as $itemdataUserAnswer) {
                     $arrPointQuestion[$itemdataUserAnswer["question_id"]]["question_type"] = $itemdataUserAnswer["question_type"];
                     $arrPointQuestion[$itemdataUserAnswer["question_id"]]["question_id"] = $itemdataUserAnswer["question_id"];
                     $arrPointQuestion[$itemdataUserAnswer["question_id"]]["doing"] = $itemdataUserAnswer["doing"];
                     if ($itemdataUserAnswer["question_type"] == 1 or $itemdataUserAnswer["question_type"] == 4) {
                         $arrPointQuestion[$itemdataUserAnswer["question_id"]]["useranswer"] = $itemdataUserAnswer["user_answer_id"];
                     } elseif ($itemdataUserAnswer["question_type"] == 2) {
                         $arrPointQuestion[$itemdataUserAnswer["question_id"]]["useranswer"] = $itemdataUserAnswer["user_answer_text"];
                     }
                     $arrPointQuestion[$itemdataUserAnswer["question_id"]]["point_answer_text"] = $itemdataUserAnswer["point_answer_text"];
                     $arrPointQuestion[$itemdataUserAnswer["question_id"]]["comment_trainer"] = $itemdataUserAnswer["comment_trainer"];
                 }
             }
             // Kiem tra nhung cau tra loi dung
             $dataNew = array();
             $total_point = 0;
             if (!empty($arrPointQuestion)) {
                 foreach ($arrPointQuestion as $key => $itemPointQuestion) {
                     $dataNew[$key] = $itemPointQuestion;
                     if (!empty($itemPointQuestion["answertrue"])) {
                         if ($itemPointQuestion["question_type"] == 4 or $itemPointQuestion["question_type"] == 1) {
                             // Truong hop nhieu dap an
                             $dataAnswer = explode(',', $itemPointQuestion["useranswer"]);
                             $dataAnswerNew = array();
                             foreach ($dataAnswer as $item) {
                                 if (!empty($item)) {
                                     $dataAnswerNew[] = $item;
                                 }
                             }
                             $check = TRUE;
                             if (count($dataAnswerNew) == count($itemPointQuestion["answertrue"])) {
                                 foreach ($dataAnswerNew as $itemdataAnswerNew) {
                                     if (!in_array($itemdataAnswerNew, $itemPointQuestion["answertrue"])) {
                                         $check = FALSE;
                                     }
                                 }
                             } else {
                                 $check = FALSE;
                             }
                             if ($check == TRUE) {
                                 $dataNew[$key]["check"] = "OK";
                                 $total_point += $itemPointQuestion["point"];
                             } else {
                                 $dataNew[$key]["check"] = "NOK";
                             }
                         }
                     }
                     if ($itemPointQuestion["question_type"] == 2) {
                         if (isset($itemPointQuestion["point_answer_text"])) {
                             $total_point += $itemPointQuestion["point_answer_text"];
                         }
                     }
                 }
             }
             // Luu ket qua vao database
             $model = WTestUser::model()->find('user_id=' . $dataUserTest["user_id"] . ' AND id_test_parent=' . $dataUserTest["test_id"] . ' AND kind=' . $dataUserTest["test_kind"] . ' AND course_id=' . $dataUserTest["course_id"] . ' AND lecture_id=' . $dataUserTest["lecture_id"]);
             $model->datafinish = json_encode($dataNew);
             $model->save();
             $modelUserTest = WUserTest::model()->find('id=' . $user_test_id);
             $modelUserTest->pass_score_point = $total_point;
             $modelUserTest->success = 2;
             if ($modelUserTest->save()) {
                 //$testDetails = WTest::model()->find("id=".$test_id);
                 $username = WUser::getFullNameUser($dataUserTest["user_id"]);
                 $trainer = WUser::getFullNameUser(Yii::app()->user->id);
                 $title = "Giáo viên " . $trainer . " đã chấm bài test: " . $dataUserTest["test_name"] . " của bạn";
                 if (!empty($dataUserTest["success"]) and $dataUserTest["success"] == 2) {
                     $title = "Giáo viên " . $trainer . " đã chấm bài lại test: " . $dataUserTest["test_name"] . " của bạn";
                 }
                 $content = "Dear <strong>" . $username . "</strong>";
                 //$content .="<br/>Bài làm Test :".$testDetails->test_name." của bạn đã được Giáo viên: <strong>".$trainer.'</strong> chấm xong';
                 $content .= "<br/>Giáo viên <strong>" . $trainer . '</strong> đã chấm bài: <strong>"' . $dataUserTest["test_name"] . '"</strong> của bạn';
                 $url = Yii::app()->createUrl("wCourseLecture/Viewresult", array("user_test_id" => $dataUserTest["id"]));
                 $content .= "<br/><a href='" . $url . "'>Click Để xem kết quả bài test</a>";
                 WMessage::SendMessage($title, $content, "notifi", Yii::app()->user->id, $dataUserTest["user_id"]);
                 $json = array("result" => "true");
             }
         } else {
             $json = array("result" => "false", "message" => "");
         }
     }
     echo json_encode($json);
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionViewCourse($id)
 {
     if (empty(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createUrl(''));
     }
     $dataCourseLecture = array();
     $listTrainee = array();
     if (!empty($id)) {
         $data = WCourseLecture::model()->findAll('course_id=' . $id);
         $data = CJSON::decode(CJSON::encode($data));
         if (!empty($data)) {
             foreach ($data as $key => $item) {
                 $lectureDetails = WLecture::model()->find('id=' . $item['lecture_id']);
                 if (!empty($lectureDetails)) {
                     $category = $lectureDetails->category;
                     $lectureDetails = CJSON::decode(CJSON::encode($lectureDetails));
                     $dataCourseLecture[$item['id']] = $item;
                     $dataCourseLecture[$item['id']]['details'] = $lectureDetails;
                     $dataCourseLecture[$item['id']]['cat_name'] = $category->cat_name;
                 }
             }
         }
         $dataTrainee = WCourseTrainee::model()->findAll('course_id=' . $id);
         $dataTrainee = CJSON::decode(CJSON::encode($dataTrainee));
         if (!empty($dataTrainee)) {
             foreach ($dataTrainee as $item) {
                 $traineeDetails = WUser::model()->find('id=' . $item['trainee_id']);
                 if (!empty($traineeDetails)) {
                     $traineeDetails = CJSON::decode(CJSON::encode($traineeDetails));
                     $listTrainee[$traineeDetails['id']]['id'] = $traineeDetails['id'];
                     $listTrainee[$traineeDetails['id']]['course_id'] = $id;
                     $listTrainee[$traineeDetails['id']]['fullname'] = $traineeDetails['fullname'];
                     $listTrainee[$traineeDetails['id']]['username'] = $traineeDetails['username'];
                 }
             }
         }
     }
     $this->render('supervisor/view', array('model' => $this->loadModel($id), 'dataCourseLecture' => $dataCourseLecture, 'listTrainee' => $listTrainee));
 }
Exemplo n.º 29
0
    }
    ?>
">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputCompany" class="col-sm-4 control-label">Company</label>
                                <div class="col-sm-8">
                                    <input type="text" id="inputCompany" class="form-control" style="margin-bottom: 10px;" name="company" value="<?php 
    if ($data['company']) {
        echo $data['company'];
    }
    ?>
">
                                    <?php 
    echo CHtml::dropDownList("compay_id", "company_id", CHtml::listData(WUser::model()->findAll(), "company", "company"), array('prompt' => '--' . Yii::t('web/home', 'Select Company') . '--', "onchange" => "return OnChangeCompany(this)", "class" => "form-control chosen-select", "style" => "margin-top:10px"));
    ?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputPhone" class="col-sm-4 control-label">Phone</label>
                                <div class="col-sm-8">
                                    <input type="text" id="inputPhone" class="form-control" name="phone" value="<?php 
    if ($data['region']) {
        echo $data['phone'];
    }
    ?>
">
                                </div>
                            </div>
                            <div class="form-group">
Exemplo n.º 30
0
 /**
  * reseting the usr in session
  */
 private function _resetUser()
 {
     try {
         $this->_joobiInfoLog("_resetUser()");
         $uid = WUser::get('uid');
         if (empty($uid)) {
             //reload the user
             WUser::get(null, 'reset');
             $usersSessionC = WUser::session();
             $usersSessionC->resetUser();
         }
         //endif
     } catch (Exception $e) {
         throw new Exception("Problem while resetting user");
     }
 }