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


PHP Course::model方法代码示例

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


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

示例1: loadModel

 public function loadModel($id)
 {
     if (($model = Course::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:7,代码来源:CourseBackendController.php

示例2: loadCourse

 /**
  * 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 Lesson the loaded model
  * @throws CHttpException
  */
 public function loadCourse($courseId)
 {
     $model = Course::model()->findByPk($courseId);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:15,代码来源:CaController.php

示例3: beforeAction

 protected function beforeAction($action)
 {
     $actions = array('index', 'create');
     if (in_array($action->id, $actions)) {
         $this->course_id = (int) Yii::app()->getRequest()->getParam('course_id');
         $this->course = Course::model()->findByPk($this->course_id);
     }
     return parent::beforeAction($action);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:9,代码来源:PackageBackendController.php

示例4: actionNote

 /**
  * 列出某个课程下的所有笔记
  * Enter description here ...
  * @param unknown_type $courseId
  */
 public function actionNote($courseId)
 {
     $courseId = intval($courseId);
     $course = Course::model()->findByPk($courseId);
     $sql = "select n.*,l.id as lessonId from ew_course c inner join ew_lesson l on c.id=l.courseId inner join ew_note n on n.noteableEntityId=l.entityId where c.id={$courseId}";
     $notes = Note::model()->findAllBySql($sql);
     $dataProvider = new CArrayDataProvider($notes);
     $this->render('my_notes', array('dataProvider' => $dataProvider, 'course' => $course));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:MeController.php

示例5: getProgramsNavigation

 public function getProgramsNavigation()
 {
     $programsMenu = array('icon' => 'list', 'label' => 'Программы', 'items' => array());
     $programs = Course::model()->findAll();
     foreach ($programs as $program) {
         $programsMenu['items'][] = array('icon' => 'list', 'label' => $program->title, 'items' => array(array('icon' => 'list-alt', 'label' => 'Виды', 'url' => array('/classroom/courseTypeBackend/index', 'course_id' => $program->id)), array('icon' => 'list-alt', 'label' => 'Пакеты', 'url' => array('/classroom/packageBackend/index', 'course_id' => $program->id)), array('icon' => 'list-alt', 'label' => 'Таблицы', 'url' => array('/bazi/tableBackend/index', 'course_id' => $program->id)), array('icon' => 'list-alt', 'label' => 'Опросы', 'url' => array('/poll/pollBackend/index', 'course_id' => $program->id))));
     }
     return array($programsMenu);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:9,代码来源:ClassroomModule.php

示例6: actionShow

 public function actionShow($alias)
 {
     // Курс
     $model = Course::model()->published()->with(array('types' => array('scopes' => 'published'), 'blocks' => array('scopes' => 'published'), 'images' => array('scopes' => 'published', 'order' => 'images.sort ASC')))->find('t.alias = :alias', array(':alias' => $alias));
     if (!$model || $model->disabled) {
         throw new CHttpException(404);
     }
     // Вывод в шаблон
     $this->render('show', array('model' => $model));
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:10,代码来源:CourseController.php

示例7: actionCourseRate

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

示例8: beforeAction

 protected function beforeAction($action)
 {
     $actions = array('index', 'create');
     if (in_array($action->id, $actions)) {
         $this->item_id = (int) Yii::app()->getRequest()->getParam('item_id');
         if (!$this->item_id) {
             throw new CHttpException(400, 'Не установлен ID программы');
         }
         if (($item = Course::model()->findByPk($this->item_id)) === null) {
             throw new CHttpException(404, 'Программа не найдена');
         }
     }
     return parent::beforeAction($action);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:14,代码来源:CourseImageBackendController.php

示例9: getNavigation

 public function getNavigation($full = true)
 {
     if ($full) {
         Yii::import("application.modules.classroom.models.Course");
         $programsMenu = array('icon' => 'list', 'label' => 'Страницы программ', 'items' => array());
         $programs = Course::model()->findAll();
         foreach ($programs as $program) {
             $programsMenu['items'][] = array('icon' => 'list', 'label' => $program->title, 'items' => array(array('icon' => 'list-alt', 'label' => 'Страница', 'url' => array('/classroom/courseBackend/update', 'id' => $program->id)), array('icon' => 'list-alt', 'label' => 'Блоки', 'url' => array('/classroom/blockBackend/index', 'entity_type' => 'Course', 'entity_id' => $program->id)), array('icon' => 'list-alt', 'label' => 'Отзывы', 'url' => array('/classroom/courseImageBackend/index', 'item_id' => $program->id))));
         }
     } else {
         $programsMenu = array();
     }
     $menu = array_merge(array($programsMenu), array(array('icon' => 'list', 'label' => 'Общие страницы', 'items' => array(array('icon' => 'list-alt', 'label' => Yii::t('PageModule.page', 'Pages list'), 'url' => array('/page/pageBackend/index')), array('icon' => 'plus-sign', 'label' => Yii::t('PageModule.page', 'Create page'), 'url' => array('/page/pageBackend/create')))), array('icon' => 'list', 'label' => 'Способы оплаты', 'items' => array(array('icon' => 'list-alt', 'label' => 'Способы оплаты', 'url' => array('/dictionary/dictionaryDataBackend/index', 'group_id' => 1)), array('icon' => 'plus-sign', 'label' => 'Добавить способ оплаты', 'url' => array('/dictionary/dictionaryDataBackend/create', 'group_id' => 1))))));
     return $menu;
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:15,代码来源:PageModule.php

示例10: actionView

 public function actionView()
 {
     if (isset($_REQUEST['code'])) {
         if ($model = Course::model()->with('category')->findByPk(trim($_REQUEST['code']))) {
             $this->render('view', array('model' => $model));
             Yii::app()->end();
         } else {
             $this->render('//misc/unavailable', array('messageTitle' => 'Page Not Found', 'message' => 'The requested page does not exist.'));
             Yii::app()->end();
         }
     }
     $this->render('//misc/unavailable', array('messageTitle' => 'Page Not Found', 'message' => 'The requested page does not exist.'));
     Yii::app()->end();
     //Yii::app()->getUser()
 }
开发者ID:jayrulez,项目名称:kcconline,代码行数:15,代码来源:CourseController.php

示例11: allowOnlyAdmin

 public function allowOnlyAdmin()
 {
     // 如果是站点管理员
     if (Yii::app()->user->checkAccess('admin')) {
         return true;
     }
     // 如果是课程管理员
     $course = Course::model()->findByPk(intval($_GET['courseId']));
     $member = $course->findMember(array('userId' => Yii::app()->user->id));
     if ($member && $member->inRoles(array('admin', 'superAdmin'))) {
         return true;
     }
     // 否则返回false
     return false;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:15,代码来源:AnnouncementController.php

示例12: parseUrl

 public function parseUrl($manager,$request,$pathInfo,$rawPathInfo)
 {
     if (preg_match('%^(\w+)(/(\w+))?$%', $pathInfo, $matches))
     {
         // совпадают ли $matches[1] и $matches[3] с
         // производителем и моделью в базе?
         // если да, выставляем $_GET['manufacturer'] и/или $_GET['model']
         // и возвращаем 'car/index'
         $alias = Course::model()->findByAttributes(array('alias' => $matches[1]))->course_ID;
         if($alias){
             $_GET['id'] = $alias;
             return 'course/index';
         }
     }
     return false;  // не применяем правило
 }
开发者ID:nico13051995,项目名称:IntITA,代码行数:16,代码来源:CoursesRule.php

示例13: actionCreate

 /**
  * Create
  * @param integer $groupId
  * @param integer $courseId
  */
 public function actionCreate($groupId, $courseId)
 {
     $model = new GroupCourse();
     $course = Course::model()->findByPk($courseId);
     $group = Group::model()->findByPk($groupId);
     //		$member = $group->findMember(array('userId'=>Yii::app()->user->id));
     $member = GroupMember::model()->findByAttributes(array('groupId' => $groupId, 'userId' => Yii::app()->user->id));
     if ($course && $member && $member->inRoles(array('admin', 'superAdmin'))) {
         $model->groupId = $groupId;
         $model->courseId = $courseId;
         $model->userId = Yii::app()->user->id;
         $model->addTime = time();
         echo $model->save();
         Yii::app()->user->setFlash('success', '收藏成功!');
     }
     echo false;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:22,代码来源:CourseController.php

示例14: actionIndex

 /**
  * Отображение главной страницы
  *
  * @return void
  */
 public function actionIndex()
 {
     // Загружаем главную страницу
     Yii::import("application.modules.page.models.Page");
     $page = Page::model()->findByPath("index");
     // Страница не найдена
     if ($page === null) {
         throw new CHttpException('404', Yii::t('PageModule.page', 'Страница не найдена'));
     }
     // Список блоков
     Yii::import("application.modules.block.models.MainPageBlock");
     $blocks = MainPageBlock::model()->published()->root()->findAll();
     // Список программ
     Yii::import("application.modules.classroom.models.*");
     $programs = Course::model()->published()->subscribeEnabled()->with(array('images' => array('scopes' => 'published', 'order' => 'images.sort ASC')))->findAll(array('order' => 't.sort ASC'));
     $this->render('index', array('page' => $page, 'blocks' => $blocks, 'programs' => $programs));
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:22,代码来源:SiteController.php

示例15: actionCreate

 /**
  * 添加课程
  * @param unknown_type $id
  */
 public function actionCreate($courseId)
 {
     $course = Course::model()->findByPk($courseId);
     $model = new Chapter();
     if (isset($_POST['Chapter'])) {
         $model->attributes = $_POST['Chapter'];
         $model->userId = Yii::app()->user->id;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('app', '添加成功!'));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('app', '添加失败!'));
         }
         $this->redirect(array('lesson/index', 'courseId' => $model->courseId));
     }
     $model->courseId = $courseId;
     $this->layout = "/layouts/nonav_column1";
     $this->renderPartial('create_fancy', array('course' => $course, 'model' => $model), false, true);
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:22,代码来源:ChapterController.php


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