Beispiel #1
0
 public function actionView($id)
 {
     $lesson = $this->loadModel($id);
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $this->_seoTitle = '课程 - ' . $lesson->name;
     //取报名人数
     $actual_students_criteria = new CDbCriteria();
     $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id));
     $lesson->actual_students = $actual_students;
     $teacher = Teacher::model()->findByPk($lesson->teacher_id);
     $place = Place::model()->findByPk($lesson->place_id);
     //教学环境图片显示
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     //判断学员已收藏的课程
     if ($userType === 'student') {
         $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($place->pic_other) {
         $imageList = unserialize($place->pic_other);
     }
     $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher, 'imageList' => $imageList));
 }
 private function getModel()
 {
     if (!$this->isGuest && $this->_model === null) {
         $this->_model = Teacher::model()->findByPk($this->id, array('select' => 'role'));
     }
     return $this->_model;
 }
 public function actionIndex()
 {
     Yii::app()->getModule('aud');
     Yii::app()->getModule('group');
     Yii::app()->getModule('lesson');
     Yii::app()->getModule('sch');
     Yii::app()->getModule('spec');
     Yii::app()->getModule('teacher');
     $schs = Sch::model()->findAll(array('order' => 'modified_time DESC', 'limit' => 100));
     $auds = Aud::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
     $specs = Spec::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
     $groups = Group::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
     $lessons = Lesson::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
     $teachers = Teacher::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
     $entries = $this->addEntries(array($auds, $specs, $groups, $lessons, $teachers));
     foreach ($schs as $value) {
         $entries[] = array('id' => $value->group_id, 'module' => strtolower(get_class($value)), 'time' => $value->modified_time . rand(100000, 999999), 'time' => $value->modified_time, 'user' => $value->modified_by, 'action' => 'update');
     }
     $entriesNew = array();
     foreach ($entries as $value) {
         $entriesNew[$value['time'] . rand(10000, 99999)] = $value;
     }
     krsort($entriesNew);
     $this->render('index', array('entries' => $entriesNew));
 }
 /**
  * Отображение главной страницы
  *
  * @return void
  */
 public function actionIndex()
 {
     $branch = \Branch::model()->findAll();
     $teacher = \Teacher::model()->findAll();
     $positions = $this->gavno();
     $salary = \User::model()->findBySql('SELECT DAY(t1.salary_date) FROM spbp_user_user t1 WHERE t1.is_test <> 1 AND DAY(t1.salary_date)=' . date('d'));
     $this->render('index', ['branchs' => $branch, 'teachers' => $teacher, 'salary' => $salary, 'positions' => $positions]);
 }
 public function searchTeacher($teacher_name)
 {
     $teacherCriteria = new CDbCriteria();
     $teacherCriteria->select = "*";
     $teacherCriteria->addSearchCondition('teacher_name', $teacher_name);
     $teacher_result = Teacher::model()->findAll($teacherCriteria);
     return $teacher_result;
 }
 public function loadModel($id)
 {
     $model = Teacher::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionSubject()
 {
     $subject_id = "";
     if (isset($_GET["subject_id"])) {
         $subject_id = StringHelper::filterString($_GET["subject_id"]);
     } else {
         if (isset($_GET["subject_code"])) {
             $subject_code = StringHelper::filterString($_GET["subject_code"]);
             $subject_by_code = Subject::model()->findByAttributes(array('subject_code' => $subject_code));
             $subject_id = $subject_by_code->subject_id;
         }
     }
     $subjectCriteria = new CDbCriteria();
     $subjectCriteria->select = "*";
     $subjectCriteria->condition = "subject_id = :subject_id";
     $subjectCriteria->params = array(":subject_id" => $subject_id);
     $subject = Subject::model()->findAll($subjectCriteria);
     $teachers = Teacher::model()->with(array("subject_teacher" => array("select" => false, "condition" => "subject_id = :subject_id", "params" => array(":subject_id" => $subject_id))))->findAll();
     //            $doc = Doc::model()->with(array("docs" => array(
     //                            "select" => "*",
     //                            "condition" => "subject_id = :subject_id and active = 1",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll(array("limit" => "3", "order" => "RAND()"));
     //
     //            $reference = Doc::model()->with(array("docs" => array(
     //                            "select" => "*",
     //                            "condition" => "subject_id = :subject_id and active = 0",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll(array("limit" => "3", "order" => "RAND()"));
     $lesson = Lesson::model()->findAll(array("select" => "*", "condition" => "lesson_subject = :lesson_subject", "params" => array(":lesson_subject" => $subject_id), "order" => "lesson_weeks ASC"));
     //            $doc_related = Doc::model()->with(array("docs" => array(
     //                            "condition" => "subject_id = :subject_id",
     //                            "params" => array(":subject_id" => $subject_id)
     //                )))->findAll();
     //   $sql = "SELECT * FROM tbl_doc JOIN tbl_subject_doc ON tbl_doc.doc_id = tbl_subject_doc.doc_id WHERE tbl_subject_doc.subject_id = " . $subject_id;
     // $doc_related = Yii::app()->db->createCommand($sql)->query();
     $criteria = new CDbCriteria();
     $criteria->select = 't.*';
     $criteria->join = 'JOIN tbl_subject_doc ON t.doc_id = tbl_subject_doc.doc_id';
     $criteria->condition = 'tbl_subject_doc.subject_id = :value';
     $criteria->params = array(":value" => $subject_id);
     $doc_related = Doc::model()->findAll($criteria);
     //            $doc_related = SubjectDoc::model()->findAll(array(
     //                'select' => '*',
     //                'condition' => 'subject_id = :subject_id',
     //                'params' => array(':subject_id' => $subject_id)));
     foreach ($subject as $subject_detail) {
         $title = $subject_detail->subject_name . " | Bluebee - UET";
         $des = $subject_detail->subject_target;
     }
     $this->pageTitle = $title;
     Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
     Yii::app()->clientScript->registerMetaTag(Yii::app()->createAbsoluteUrl('listOfSubject/subject?subject_id=') . $subject_id, null, null, array('property' => 'og:url'));
     Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
     $category_father = Faculty::model()->findAll();
     $subject_type = SubjectType::model()->findAll();
     $this->render('subject', array('subject' => $subject, 'category_father' => $category_father, 'subject_type' => $subject_type, 'teacher' => $teachers, 'lesson' => $lesson, 'doc_related' => $doc_related));
 }
Beispiel #8
0
 public function actionIndex()
 {
     $criteria = new CDbCriteria(array('condition' => 'status=1', 'order' => 'pos ASC', 'limit' => '0,1'));
     $teacher = Teacher::model()->find($criteria);
     $teacher->view += 1;
     $teacher->update(array('view'));
     $this->registerScripts();
     $this->render('view', array('teacher' => $teacher));
 }
Beispiel #9
0
 public function actionTeacher($id)
 {
     Yii::app()->getModule('teacher');
     if (!($teacher = Teacher::model()->findByPk($id))) {
         Yii::app()->user->setFlash('danger', Yii::app()->params['errors']['no_teacher']);
         $this->redirect('/teacher');
     }
     $week = isset($_GET['week']) ? Yii::app()->sch->getWeek($_GET['week']) : Yii::app()->sch->getWeek();
     $this->render('teacher', array('week' => $week, 'teacher' => $teacher, 'sch' => Tch::model()->teacherSch($id, $week)));
 }
Beispiel #10
0
 public function schData()
 {
     Yii::app()->getModule('aud');
     Yii::app()->getModule('spec');
     Yii::app()->getModule('lesson');
     Yii::app()->getModule('teacher');
     $data = array();
     $data['auds'] = Aud::model()->getAll();
     $data['lessons'] = Lesson::model()->getAll();
     $data['teachers'] = Teacher::model()->getAll();
     return $data;
 }
 /**
  * Редактирование Предмета.
  *
  * @param integer $id Идинтификатор Предмет для редактирования
  *
  * @return void
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $teachers = Teacher::model()->findAll();
     if (Yii::app()->getRequest()->getPost('Subject') !== null) {
         $model->setAttributes(Yii::app()->getRequest()->getPost('Subject'));
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('SubjectModule.subject', 'Запись обновлена!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
         }
     }
     $this->render('update', ['model' => $model, 'teachers' => $teachers]);
 }
 /**
  * Отображает Предмет по указанному идентификатору
  *
  * @param integer $id Идинтификатор Предмет для отображения
  *
  * @return void
  */
 public function actionView($id)
 {
     $roles = ['1', '5', '4'];
     $role = \Yii::app()->user->role;
     if (array_intersect($role, $roles)) {
         $teachers = Teacher::model()->with('subject');
         $teachers1 = $teachers->findAllBySql("SELECT * FROM spbp_user_teacher WHERE id <> ALL(SELECT t1.teacher_id FROM spbp_user_teacher_to_subject t1\n                                                            JOIN spbp_user_teacher t2 ON t1.teacher_id = t2.id\n                                                                    WHERE t1.subject_id ={$id}) AND is_test = 0");
         $teachers2 = $teachers->findAllBySql("SELECT * FROM spbp_user_teacher t1 JOIN spbp_user_teacher_to_subject t2 ON t2.teacher_id = t1.id WHERE t2.subject_id ={$id} AND t1.is_test=0");
         $this->render('view', ['model' => $this->loadModel($id), 'teachers1' => $teachers1, 'teachers2' => $teachers2]);
     } else {
         throw new CHttpException(403, 'Ошибка прав доступа.');
     }
 }
    public static function getUserName($id,$dp)
    {

        $teacher = Teacher::model()->find("user_id=:user_id", array(':user_id'=>$id));

        if($teacher){
            $result=StudentReg::model()->findByPk($dp->user_id)->firstName." ".StudentReg::model()->findByPk($dp->user_id)->secondName;
            if($result==' ')
                $result=StudentReg::model()->findByPk($dp->user_id)->email;
        }
        else
            $result=Teacher::model()->findByPk($dp->teacher_id)->first_name." ".Teacher::model()->findByPk($dp->teacher_id)->last_name;

        return $result;
    }
Beispiel #14
0
 public function renderContent()
 {
     $criteria1 = new CDbCriteria(array('condition' => 'status=1'));
     $all = (int) Teacher::model()->count($criteria1);
     if ($all > 5) {
         $offset = rand(0, $all - 5);
     } else {
         $offset = rand(0, $all);
     }
     $criteria = new CDbCriteria(array('condition' => 'status=1', 'order' => 'RAND()', 'limit' => '5,' . $offset));
     //echo $all;
     $teachers = Teacher::model()->findAll($criteria);
     if ($teachers) {
         echo CHtml::openTag("ul");
         foreach ($teachers as $teacher) {
             $img = '';
             if ($teacher->picture) {
                 Yii::import('application.extensions.image.Image');
                 $thumbImage = new Image(Yii::getPathOfAlias('webroot') . $teacher->picture);
                 $img_url = $thumbImage->createThumb(70, 60);
                 /*$thumbImage->resize(70, 60, Image::WIDTH);
                   $arr = explode("/",$teacher->picture);
                   $file_name = $arr[count($arr)-1];
                   $thumb = Yii::getPathOfAlias('webroot') . '/resources/images/85x72/' . $file_name;
                   $thumbImage->save($thumb);*/
                 $img = '<img src="' . $img_url . '" />';
             }
             echo CHtml::openTag("li", array('class' => 'clearfix'));
             echo CHtml::openTag("div", array('class' => 'avatar'));
             echo CHtml::link($img, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo "<div>Giảng viên</div>";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('class' => 'title'));
             echo CHtml::link($teacher->name, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'margin-top:10px;float:left;width:80px;height:14px;background:#ce1f46;color:#fff;padding:8px 0px;text-align:center'));
             echo "5.1232";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'float:right;text-align:left;width:127px;margin-top:10px;font-weight:bold;color:#a8a8a8;'));
             echo $teacher->videoCount . " bài giảng | " . $teacher->likeTeachersCount . " " . CHtml::ajaxLink(CHtml::image(Yii::app()->baseUrl . '/images/tim_03.jpg', 'Like', array('title' => 'Yêu thích')), Yii::app()->createUrl('/teacher/like', array('id' => $teacher->id)), array('success' => 'js:function(res){alert(res.msg);}'), array('class' => 'teacher_like'));
             echo CHtml::closeTag("div");
             echo CHtml::closeTag("li");
         }
         echo CHtml::closeTag("ul");
     }
 }
 public function actionGetTeacherDepartment()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $dept_id = $request->getPost('dept_id');
             $faculty_id = $request->getPost('faculty_id');
             $teacher_data = Teacher::model()->findAllByAttributes(array('teacher_dept' => $dept_id, "teacher_faculty" => $faculty_id));
             $this->retVal->teacher_data = $teacher_data;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
Beispiel #16
0
 public function name($module = null, $id = null)
 {
     Yii::app()->getModule('aud');
     Yii::app()->getModule('group');
     Yii::app()->getModule('lesson');
     Yii::app()->getModule('sch');
     Yii::app()->getModule('spec');
     Yii::app()->getModule('teacher');
     $item = '';
     switch ($module) {
         case 'aud':
             if ($aud = Aud::model()->findByPk($id)) {
                 $item = $aud->name . ' (' . Yii::app()->params['aud_types'][$aud->type] . ')';
             }
             break;
         case 'group':
             if ($group = Group::model()->findByPk($id)) {
                 $item = $group->group_spec->code . '-' . $group->year . '-0' . $group->number . ' (' . $group->group_spec->name . ', ' . Yii::app()->sch->course($group->year) . ' курс)';
             }
             break;
         case 'lesson':
             if ($lesson = Lesson::model()->findByPk($id)) {
                 $item = isset($lesson->fullname) ? $lesson->fullname : $lesson->name;
             }
             break;
         case 'sch':
             if ($sch = Sch::model()->findByPk($id)) {
                 $item = $sch->group->groupName() . ' (' . $sch->group->group_spec->name . ', ' . Yii::app()->sch->course($sch->group->year) . ' курс)';
             }
             break;
         case 'spec':
             if ($spec = Spec::model()->findByPk($id)) {
                 $item = $spec->name;
             }
             break;
         case 'teacher':
             if ($teacher = Teacher::model()->findByPk($id)) {
                 $item = $teacher->surname . ' ' . $teacher->initials;
             }
             break;
         default:
             $item = '';
             break;
     }
     return $item;
 }
Beispiel #17
0
 public function actionView($id)
 {
     $lesson = $this->loadModel($id);
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $this->_seoTitle = '课程 - ' . $lesson->name;
     //取报名人数
     $actual_students_criteria = new CDbCriteria();
     $actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id));
     $lesson->actual_students = $actual_students;
     $teacher = Teacher::model()->findByPk($lesson->teacher_id);
     $place = Place::model()->findByPk($lesson->place_id);
     //判断学员已收藏的课程
     if ($userType === 'student') {
         $is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
     }
     $this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher));
 }
 public function authenticate()
 {
     // Производим стандартную аутентификацию, описанную в руководстве.
     $user = Teacher::model()->find('LOWER(login)=?', array(strtolower($this->username)));
     if ($user === null || $this->password !== $user->password) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         // В качестве идентификатора будем использовать id, а не username,
         // как это определено по умолчанию. Обязательно нужно переопределить
         // метод getId(см. ниже).
         $this->_id = $user->id;
         // Далее логин нам не понадобится, зато имя может пригодится
         // в самом приложении. Используется как Yii::app()->user->name.
         // realName есть в нашей модели. У вас это может быть name, firstName
         // или что-либо ещё.
         $this->username = $user->login;
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }
    public function actionIndex($id){
        $this->initialize($id);
        $editMode = $this->checkEditMode($id, Yii::app()->user->getId());

        $lecture = Lecture::model()->findByPk($id);

        $criteria = new CDbCriteria();
        $criteria->addCondition('id_lecture='.$id);

        $dataProvider = new CActiveDataProvider('LectureElement');
        $dataProvider->criteria = $criteria;
        $criteria->order = 'block_order ASC';
        $dataProvider->setPagination(array(
                'pageSize' => '200',
            )
        );

        $owners = [];

        $criteria1 = new CDbCriteria();
        $criteria1->alias='teacher_module';
        $criteria1->select = 'idTeacher';
        $criteria1->addCondition('idModule='.$lecture->idModule);
        $criteria1->toArray();
        $temp = TeacherModule::model()->findAll($criteria1); //info about owners
        for($i = 0; $i < count($temp);$i++){
            array_push($owners, $temp[$i]->idTeacher);
        }
        $teachers = Teacher::model()->findAllByPk($owners);

        $countBlocks = LectureElement::model()->count('id_lecture = :id', array(':id' => $id));

        $this->render('index', array(
            'dataProvider' => $dataProvider,
            'lecture' => $lecture,
            'editMode' => $editMode,
            'countBlocks' => $countBlocks,
            'teachers' => $teachers,
        ));
    }
Beispiel #20
0
 public function actionIndex()
 {
     $this->_seoTitle = '中国传统文化教育|东方美学|中式精致生活|我要去上课';
     $placeCriteria = new CDbCriteria();
     $teacherCriteria = new CDbCriteria();
     $picCriteria = new CDbCriteria();
     $placeCriteria->limit = '3';
     $placeCriteria->order = 'id DESC';
     $placeCriteria->addCondition('status = :status');
     $placeCriteria->params[':status'] = 1;
     $teacherCriteria->limit = '8';
     $teacherCriteria->order = 'id DESC';
     $teacherCriteria->addCondition('status = :status');
     $teacherCriteria->params[':status'] = 1;
     $picCriteria->limit = '4';
     $picCriteria->order = 'id DESC';
     $picCriteria->addCondition('check_status = :check_status');
     $picCriteria->params[':check_status'] = 1;
     $lesson = Lesson::model()->findByAttributes(array('id' => '5'));
     $place = Place::model()->findAll($placeCriteria);
     $teacher = Teacher::model()->findAll($teacherCriteria);
     $pic = Lesson::model()->findAll($picCriteria);
     $this->render('index', array('place' => $place, 'teacher' => $teacher, 'lesson' => $lesson, 'pic' => $pic));
 }
 public function verifyOldPassword($attribute, $params)
 {
     if (Teacher::model()->findByPk(Yii::app()->controller->_user['masterId'])->password != $this->hashPassword($this->{$attribute})) {
         $this->addError($attribute, "原密码不正确");
     }
 }
Beispiel #22
0
echo $this->createUrl('/lesson/view', array('id' => $lesson['id']));
?>
">
											<img class="media-object" src="<?php 
echo $lesson['pic'];
?>
">
										</a>
										<figcaption class="media-body">
											<h4><?php 
echo $lesson->name;
?>
</h4>
											<p>讲师:
											<?php 
$teacher = Teacher::model()->findByPk($lesson['teacher_id']);
echo $teacher->name;
?>
											</p>
											<p>时间:<s><?php 
echo $lesson->start_date_time . '&nbsp&nbsp至&nbsp&nbsp' . $lesson->end_date_time;
?>
</s></p>
											<p><input type="text" value="<?php 
echo $lesson['rank'];
?>
" class="form-control rating" readonly="readonly"></p>
										</figcaption>
									</figure>
								</header>
Beispiel #23
0
echo $form->labelEx($model, 'max');
?>
        <?php 
echo $form->textField($model, 'max', array('maxlength' => 255, 'size' => 70));
?>
        <?php 
echo $form->error($model, 'max');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'teacher_id');
?>
        <?php 
echo $form->dropDownList($model, 'teacher_id', GxHtml::listDataEx(Teacher::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'teacher_id');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'tid');
?>
        <?php 
echo $form->dropDownList($model, 'tid', GxHtml::listDataEx(Training::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'tid');
Beispiel #24
0
    ?>
">
                                        <div class="rating-stars"></div>
                                    </div>

                                    <span class="number"><b><?php 
    echo $lesson->rank;
    ?>
</b>分</span>

                                </div>
                                <!--rating-wrap END-->

                                <ul class="list-inline">
                                    <?php 
    $teacher = Teacher::model()->findByAttributes(array('id' => $lesson->teacher_id));
    ?>

                                    <li>主讲人:<?php 
    echo $teacher->name;
    ?>
</li>

                                    <li>
                                        时间:<?php 
    echo DATE_FORMAT(DATE_CREATE($lesson->start_date_time), 'Y.m.d');
    ?>
                                        至 <?php 
    echo DATE_FORMAT(DATE_CREATE($lesson->end_date_time), 'Y.m.d');
    ?>
                                    </li>
 public function actionGetTeacher($time, $form, $subject, $branch)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $times = explode(',', $time);
         $tCount = count($times);
         $crTimes = $times;
         $schedule = [];
         $j = 0;
         $k = 0;
         $form = Form::model()->findByPk($form);
         for ($i = 0; $i < $tCount; $i++) {
             $times[$i] = substr($times[$i], strpos($times[$i], 'T') + 1);
         }
         for ($i = 0; $i < $form->number; $i++) {
             if ($j == $tCount) {
                 $j = 0;
                 $k++;
             }
             $schedule[$i] = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week", strtotime($crTimes[$j]))));
             $j++;
         }
         $condT = '';
         $condition = '';
         $first = 0;
         foreach ($times as $cr) {
             $condT .= " AND `t`.`start_time`<='{$cr}' AND SUBTIME(`t`.`end_time`,'01:00:00')>='{$cr}'";
         }
         foreach ($schedule as $sch) {
             if ($first == 0) {
                 $condition .= "`schedule`.`start_time` ='{$sch}'";
                 $first++;
             } else {
                 $condition .= " OR `schedule`.`start_time` ='{$sch}'";
             }
         }
         $models = Teacher::model()->with('user', 'schedule', 'subject')->findAllBySql("SELECT  `t`.* FROM spbp_user_teacher `t` " . "WHERE `t`.`id` <> ALL(" . "SELECT `t`.`id` FROM spbp_user_teacher `t` JOIN spbp_listner_position `position` " . "ON `position`.`teacher_id` = `t`.`id` JOIN spbp_listner_schedule `schedule` " . "ON `schedule`.`position_id` = `position`.`id` WHERE {$condition}) {$condT}");
         $arr = [];
         foreach ($models as $teacher) {
             $checks = TeacherToSubject::model()->find("teacher_id={$teacher->id} AND subject_id={$subject}");
             if ($checks['teacher_id'] == $teacher->id) {
                 array_push($arr, $teacher);
             }
         }
         $arr1 = [];
         foreach ($arr as $teacher) {
             $checks = Teacher::model()->with('user', 'schedule', 'subject')->findAll('user_id=' . $teacher->user_id);
             if (count($checks) >= 1) {
                 foreach ($checks as $check) {
                     if ($check->branch_id == $branch) {
                         array_push($arr1, $check);
                     }
                 }
             }
         }
         echo CJSON::encode($this->convertModelToArray($arr1));
         Yii::app()->end();
     } else {
         throw new CHttpException(404, Yii::t('ListnerModule.listner', 'Запрошенная страница не найдена.'));
     }
 }
Beispiel #26
0
 public static function generateTeachersList(){
     $teachers = Teacher::model()->findAll();
     $count = count($teachers);
     $result = [];
     for($i = 0; $i < $count; $i++){
         $result[$i]['id'] = $teachers[$i]->teacher_id;
         $result[$i]['alias'] = $teachers[$i]->first_name." ".$teachers[$i]->last_name.", ".$teachers[$i]->email;
     }
     return $result;
 }
Beispiel #27
0
 public static function getTeacherName($id){
     return Teacher::model()->findByPk($id)->last_name." ".Teacher::model()->findByPk($id)->first_name;
 }
Beispiel #28
0
<?php

$this->breadcrumbs = array(Yii::t('app', 'Quản lý video'));
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('video-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Quản lý Video');
?>
</h1>
<!--
<?php 
/*echo GxHtml::link(Yii::t('app', 'Tìm kiếm'), '#', array('class' => 'search-button')); */
?>
<div class="search-form">
<?php 
/*$this->renderPartial('_search', array(
	'model' => $model,
)); */
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'video-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'title', 'link_youtube', array('name' => 'term_id', 'value' => 'GxHtml::valueEx($data->term)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=2'))), array('name' => 'teacher_id', 'value' => 'GxHtml::valueEx($data->teacher)', 'filter' => GxHtml::listDataEx(Teacher::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn', 'template' => '{update},{delete}'))));
Beispiel #29
0
                                <th>预订人</th>
                                <th>交通便利</th>
                                <th>设施齐全</th>
                                <th>美观舒适</th>
                                <th>服务质量</th>
                                <th>综合</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php 
        foreach ($placeReview as $pReview) {
            ?>
                                <tr>
                                    <td width="60">
                                        <?php 
            $t = Teacher::model()->findByPk($pReview['teacher_id']);
            echo $t['name'];
            ?>
                                    </td>
                                    <td width="50"><?php 
            echo $pReview['traffic'];
            ?>
</td>
                                    <!--使用转义字符是个好的习惯-->
                                    <td width="50"><?php 
            echo $pReview['equipment'];
            ?>
</td>
                                    <!--务必为已过期添加s标签-->
                                    <td width="50"><?php 
            echo $pReview->feel;
 public function actionListTeacherFaculty()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $listSubjectData = array('faculty_id' => StringHelper::filterString($_POST['faculty_id']));
             $faculty_data = Faculty::model()->findAllByAttributes(array('faculty_id' => $listSubjectData['faculty_id']));
             $teacher_data = Teacher::model()->findAllByAttributes(array('teacher_faculty' => $listSubjectData['faculty_id']));
             $this->retVal->teacher_data = $teacher_data;
             $this->retVal->faculty_data = $faculty_data;
             $this->retVal->message = 1;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }