当前位置: 首页>>代码示例>>PHP>>正文


PHP Teacher::model方法代码示例

本文整理汇总了PHP中Teacher::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::model方法的具体用法?PHP Teacher::model怎么用?PHP Teacher::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Teacher的用法示例。


在下文中一共展示了Teacher::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionView

 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));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:26,代码来源:LessonController.php

示例2: getModel

 private function getModel()
 {
     if (!$this->isGuest && $this->_model === null) {
         $this->_model = Teacher::model()->findByPk($this->id, array('select' => 'role'));
     }
     return $this->_model;
 }
开发者ID:DostonAkhmedov,项目名称:Dars_jadvali,代码行数:7,代码来源:WebUser.php

示例3: actionIndex

 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));
 }
开发者ID:BigMacckk,项目名称:kepsch,代码行数:25,代码来源:ActivityController.php

示例4: actionIndex

 /**
  * Отображение главной страницы
  *
  * @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]);
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:13,代码来源:SiteController.php

示例5: searchTeacher

 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;
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:8,代码来源:SearchController.php

示例6: loadModel

 public function loadModel($id)
 {
     $model = Teacher::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:alexey-tichonoff,项目名称:accounting-system,代码行数:8,代码来源:TeacherController.php

示例7: actionSubject

 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));
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:58,代码来源:ListOfSubjectController.php

示例8: actionIndex

 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));
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:9,代码来源:TeacherController.php

示例9: actionTeacher

 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)));
 }
开发者ID:BigMacckk,项目名称:kepsch,代码行数:10,代码来源:SchController.php

示例10: schData

 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;
 }
开发者ID:BigMacckk,项目名称:kepsch,代码行数:12,代码来源:Sch.php

示例11: actionUpdate

 /**
  * Редактирование Предмета.
  *
  * @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]);
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:20,代码来源:SubjectBackendController.php

示例12: actionView

 /**
  * Отображает Предмет по указанному идентификатору
  *
  * @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, 'Ошибка прав доступа.');
     }
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:20,代码来源:SubjectController.php

示例13: getUserName

    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;
    }
开发者ID:nico13051995,项目名称:IntITA,代码行数:15,代码来源:ConsultationsHelper.php

示例14: renderContent

 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");
     }
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:46,代码来源:BoxTeacher.php

示例15: actionGetTeacherDepartment

 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();
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:17,代码来源:TeacherController.php


注:本文中的Teacher::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。