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


PHP Lesson::model方法代码示例

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


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

示例1: 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

示例2: actionGetSubjectSchedule

 /**
  * 日历课程接口
  */
 public function actionGetSubjectSchedule()
 {
     if (!isset($_REQUEST['teacherId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['date'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('teacherId', null));
     $token = trim(Yii::app()->request->getParam('token', null));
     $date = trim(Yii::app()->request->getParam('date', null));
     if (!ctype_digit($user_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     // 用户名不存在,返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     // 验证日期格式合法
     if (!$this->isDate($date)) {
         $this->_return('MSG_ERR_FAIL_DATE_FORMAT');
     }
     $year = mb_substr($date, 0, 4, 'utf8');
     $month = mb_substr($date, 5, 2, 'utf8');
     $day = mb_substr($date, 8, 2, 'utf8');
     if (empty($year) || empty($month) || empty($day)) {
         $this->_return('MSG_ERR_FAIL_DATE_LESS');
     }
     // 验证token
     if (Token::model()->verifyToken($user_id, $token)) {
         // 获取日历课程
         $data = Lesson::model()->getSubjectSchedule($user_id, $year, $month, $day, $date);
         $this->_return('MSG_SUCCESS', $data);
     } else {
         $this->_return('MSG_ERR_TOKEN');
     }
 }
开发者ID:hucongyang,项目名称:student_cnhutong,代码行数:37,代码来源:LessonController.php

示例3: beforeSave

 public function beforeSave()
 {
     if (!$this->weight || !$this->number) {
         $criteria = new CDbCriteria();
         $criteria->condition = "courseId=" . intval($this->courseId);
         $criteria->select = "max(weight) as maxWeight,max(number) as maxNumber";
         $chapter = self::model()->find($criteria);
         $lesson = Lesson::model()->find($criteria);
     }
     if (!$this->weight) {
         if (!$chapter && !$lesson) {
             $this->weight = 1;
         } else {
             if (!$lesson) {
                 $this->weight = $chapter->maxWeight + 1;
             } elseif (!$chapter) {
                 $this->weight = $lesson->maxWeight + 1;
             } else {
                 $this->weight = max(array($chapter->maxWeight, $lesson->maxWeight)) + 1;
             }
         }
     }
     if (!$this->number) {
         if ($chapter) {
             $this->number = $chapter->maxNumber + 1;
         } else {
             $this->number = 1;
         }
     }
     return parent::beforeSave();
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:31,代码来源:Chapter.php

示例4: actionHome

 /**
  * 主界面
  */
 public function actionHome()
 {
     //查询课程
     $lessons = Lesson::model()->findAll(array('select' => array('catalog_id', 'arrivals', 'price')));
     //学员活跃度
     $studentAllCount = Student::model()->count();
     $criteria = new CDbCriteria();
     $criteria->distinct = true;
     $criteria->addCondition('is_pays=:is_pay');
     $criteria->params[':is_pay'] = 1;
     $studentActiveCount = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay", array(':is_pay' => 1));
     $studentPercentage = round($studentActiveCount / $studentAllCount * 100) . '%';
     //获取课程分类数组
     $catalogs = Catalog::model()->findAllByAttributes(array('parent_id' => 6));
     $allCountLesson = Lesson::model()->count();
     foreach ($catalogs as $catalog) {
         //初始化
         $lessonMoney[$catalog[id]] = 0;
         $allLesson[$catalog[id]] = 0;
         $catalogName[$catalog[catalog_name]] = $catalog[id];
         //各分类中已报名课程和发布课程总量
         $allLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id", array(":catalog_id" => $catalog[id]));
         $applyLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id AND actual_students<>:actual_students", array(":catalog_id" => $catalog[id], ":actual_students" => 0));
     }
     //成交总金额
     foreach ($lessons as $lesson) {
         $lessonMoney[$lesson[catalog_id]] = (int) $lesson[arrivals] * (int) $lesson[price];
     }
     $this->render('home', array('catalogName' => json_encode($catalogName), 'lessonMoney' => json_encode($lessonMoney), 'allLesson' => json_encode($allLesson), 'applyLesson' => json_encode($applyLesson), 'studentPercentage' => $studentPercentage));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:33,代码来源:DefaultController.php

示例5: loadModel

 private function loadModel($id)
 {
     $model = Lesson::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:8,代码来源:LessonController.php

示例6: 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

示例7: 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

示例8: actionIndex

 public function actionIndex()
 {
     $this->_seoTitle = '我要去上课 - 亲子成长';
     $criteria = new CDbCriteria();
     $criteria->addCondition("catalog_id = 24");
     //分页
     $count = Lesson::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 5;
     $pager->applyLimit($criteria);
     $lessons = Lesson::model()->findAll($criteria->addCondition("status = 1"));
     $this->render('index', array('lessons' => $lessons, 'count' => $count, 'pager' => $pager));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:13,代码来源:FamilyController.php

示例9: actionLesson

 public function actionLesson($courseId, $lessonid)
 {
     $course = Course::model()->findByPk($courseId);
     $course->viewNum = $course->viewNum + 1;
     $lesson = Lesson::model()->findByPk($lessonid);
     $lesson->viewNum = $lesson->viewNum + 1;
     if ($course->save() && $lesson->save()) {
         $lessonView = new LessonView();
         $lessonView->userId = Yii::app()->user->isGuest ? 0 : Yii::app()->user->id;
         $lessonView->ip = Yii::app()->request->getUserHostAddress();
         $lessonView->lessonid = $lessonid;
         $lessonView->save();
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:ViewCountController.php

示例10: refreshStat

 public function refreshStat()
 {
     $criteria = new CDbCriteria();
     $criteria->select = "mediaId";
     $criteria->condition = "mediaType='quiz' and courseId=" . intval($this->courseId);
     $lessons = Lesson::model()->findAll($criteria);
     $this->arrQuizIds = array();
     foreach ($lessons as $lesson) {
         $this->arrQuizIds[] = $lesson->mediaId;
     }
     $this->totalScore = $this->totalScoreCount;
     $this->quizNum = $this->quizCount;
     $this->avgScore = $this->quizNum == 0 ? 0 : $this->totalScore / $this->quizNum;
     $this->save();
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:15,代码来源:CourseQuizReport.php

示例11: name

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

示例12: actionReview

 public function actionReview()
 {
     $message = false;
     $lesson = Lesson::model()->findByPk($_GET['id']);
     $model = StudentTeacher::model()->findByAttributes(array('student_id' => $this->_user['studentId'], 'teacher_id' => $lesson['teacher_id']));
     if (!count($model)) {
         $model = new StudentTeacher();
     }
     if (isset($_POST['StudentTeacher'])) {
         $model->attributes = $_POST['StudentTeacher'];
         $model->student_id = $this->_user['studentId'];
         $model->teacher_id = $lesson['teacher_id'];
         if ($model->save()) {
             $message = true;
         }
     }
     $this->render('review', array('lesson' => $lesson, 'message' => $message, 'model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:LessonController.php

示例13: actionView

 public function actionView($id)
 {
     $teacher = $this->loadModel($id);
     $this->_seoTitle = '名师 - ' . $teacher->name;
     $userId = $this->_cookiesGet('userId');
     $userType = $this->_cookiesGet('userType');
     $reviewModel = new Review();
     if ($userType === 'student' and isset($_POST['Review'])) {
         $reviewModel->attributes = $_POST['Review'];
         $reviewModel->teacher_id = $id;
         $reviewModel->student_id = $userId;
         $reviewModel->ctime = time();
         if ($reviewModel->validate() and $reviewModel->save()) {
             Yii::app()->user->setFlash('success', '保存成功');
         }
     }
     $criteria = new CDbCriteria();
     $books = Book::model()->findAllByAttributes(array('teacher_id' => $id));
     $lessons = array();
     $reviews = array();
     $list = yii::app()->request->getParam('list');
     if ($list === null or $list === 'lesson') {
         $model = Lesson::model();
         $count = $model->count($criteria->addCondition("teacher_id = {$id}"));
         $pager = new CPagination($count);
         $pager->pageSize = 4;
         $pager->applyLimit($criteria);
         $lessons = $model->findAll($criteria);
     } else {
         $model = Review::model();
         $count = $model->count($criteria->addCondition("teacher_id = {$id}"));
         $pager = new CPagination($count);
         $pager->pageSize = 4;
         $pager->applyLimit($criteria);
         $reviews = Yii::app()->db->createCommand()->select('s.*, r.contents, r.ctime')->from('seed_review r')->leftjoin('seed_student s', 's.id=r.student_id')->where('r.teacher_id=:teacher_id', array(':teacher_id' => $id))->order('ctime desc')->limit(4, $pager->currentPage * $pager->pageSize)->queryAll();
     }
     //判断学员已关注老师
     if ($userType === 'student') {
         $is_focus = StudentTeacher::model()->findByAttributes(array('student_id' => $userId, 'teacher_id' => $id));
     }
     $this->render('view', array('is_focus' => $is_focus, 'teacher' => $teacher, 'lessons' => $lessons, 'reviews' => $reviews, 'books' => $books, 'userType' => $userType, 'reviewModel' => $reviewModel, 'count' => $count, 'pager' => $pager, 'list' => $_GET['list']));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:42,代码来源:TeacherController.php

示例14: actionHome

 /**
  * 主界面
  */
 public function actionHome()
 {
     //查询课程
     $lessons = Lesson::model()->findAll(array('select' => array('catalog_id', 'arrivals', 'price')));
     //学员活跃度
     $studentAllCount = Student::model()->count();
     $studentActiveCount = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay", array(':is_pay' => 1));
     $studentPercentage = @round($studentActiveCount / $studentAllCount * 100) . '%';
     //学员月活跃度
     $time = date('Y-m', time());
     for ($i = -1; $i < 8; $i++) {
         $m = date('m', time());
         $m = $m - $i - 1;
         $ii = $i + 1;
         $startTime[$m] = date('Y-m-d H:i:s', strtotime("{$time} -{$ii} month"));
         $endTime[$m] = date('Y-m-d H:i:s', strtotime("{$time} -{$i} month"));
         $sMoAcCount[$m] = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay AND pay_time>=:start_time AND pay_time<:end_time", array(':is_pay' => 1, ':start_time' => $startTime[$m], ':end_time' => $endTime[$m]));
         $sAllMoAcCount[$m] = Student::model()->countBySql('SELECT COUNT(id) FROM `seed_student` WHERE register_time>=:start_time AND register_time<:end_time', array(':start_time' => $startTime[$m], ':end_time' => $endTime[$m]));
         if ($sAllMoAcCount[$m] == 0) {
             $sMoPercentage[$m] = "0%";
         } else {
             $sMoPercentage[$m] = round($sMoAcCount[$m] / $sAllMoAcCount[$m] * 100) . '%';
         }
     }
     //获取课程分类数组
     $catalogs = Catalog::model()->findAllByAttributes(array('parent_id' => 6));
     $allCountLesson = Lesson::model()->count();
     foreach ($catalogs as $catalog) {
         //初始化
         $lessonMoney[$catalog[id]] = 0;
         $allLesson[$catalog[id]] = 0;
         $catalogName[$catalog[catalog_name]] = $catalog[id];
         //各分类中已报名课程和发布课程总量
         $allLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id", array(":catalog_id" => $catalog[id]));
         $applyLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id AND actual_students<>:actual_students", array(":catalog_id" => $catalog[id], ":actual_students" => 0));
     }
     //成交总金额
     foreach ($lessons as $lesson) {
         $lessonMoney[$lesson[catalog_id]] = (int) $lesson[arrivals] * (int) $lesson[price];
     }
     $this->render('home', array('catalogName' => json_encode($catalogName), 'lessonMoney' => json_encode($lessonMoney), 'allLesson' => json_encode($allLesson), 'applyLesson' => json_encode($applyLesson), 'studentPercentage' => $studentPercentage, 'sMoPercentage' => $sMoPercentage));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:45,代码来源:DefaultController.php

示例15: actionIndex

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


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