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


PHP Course::where_related方法代码示例

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


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

示例1: index

 public function index()
 {
     $this->_initialize_student_menu();
     $this->_select_student_menu_pagetag('groups');
     $this->parser->add_css_file('frontend_groups.css');
     $cache_id = $this->usermanager->get_student_cache_id();
     if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/groups/index.tpl'), $cache_id)) {
         $student = new Student();
         $student->get_by_id($this->usermanager->get_student_id());
         $course = new Course();
         $course->where_related_active_for_student($student);
         $course->where_related('participant/student', $student);
         $course->where_related_participant('allowed', 1);
         $course->get();
         $can_change_group = FALSE;
         if ($course->exists()) {
             if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
                 $can_change_group = TRUE;
             }
         }
         smarty_inject_days();
         $this->parser->assign(array('course' => $course, 'can_change_group' => $can_change_group));
     }
     $this->parser->parse('frontend/groups/index.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:25,代码来源:groups.php

示例2: _initialize_student_menu

 /**
  * Loads and injects page navigation for student's frontend.
  * Also loads all courses, in which current student is participating.
  * Smarty template variable $list_pagemenu will be created.
  */
 protected function _initialize_student_menu()
 {
     $this->config->load('pagemenu');
     $this->parser->assign('list_pagemenu', $this->config->item('pagemenu'));
     $this->_load_student_langfile('pagemenu');
     if ($this->usermanager->is_student_session_valid()) {
         $courses = new Course();
         $courses->where_related('participant', 'student_id', $this->usermanager->get_student_id());
         $courses->where_related('participant', 'allowed', 1);
         $courses->include_related('period', 'name');
         $courses->order_by_related_with_constant('period', 'sorting', 'asc');
         $courses->order_by_with_constant('name', 'asc');
         $courses->get_iterated();
         $this->parser->assign('list_student_courses', $courses);
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:21,代码来源:LIST_Controller.php

示例3: get_task_set_by_id

 private function get_task_set_by_id(&$course, &$group, &$student, $task_set_id)
 {
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where_related('active_for_student', 'id', $student->id);
     $course->where_related('participant', 'student_id', $student->id);
     $course->where_related('participant', 'allowed', 1);
     $course->include_related('period', 'name');
     $course->get();
     $task_set = new Task_set();
     $task_set2 = new Task_set();
     $group = new Group();
     if ($course->exists()) {
         $group->where_related_participant('student_id', $student->id);
         $group->where_related_participant('course_id', $course->id);
         $group->get();
         $task_set->select('`task_sets`.*, `rooms`.`time_day` AS `pb_time_day`, `rooms`.`time_begin` AS `pb_time_begin`, `rooms`.`id` AS `pb_room_id`, `task_sets`.`publish_start_time` AS `pb_publish_start_time`, `task_sets`.`upload_end_time` AS `pb_upload_end_time`');
         $task_set->where('published', 1);
         $task_set->where_related_course($course);
         $task_set->include_related('solution');
         $task_set->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
         $task_set->group_start();
         $task_set->or_where('group_id', NULL);
         $task_set->or_where('group_id', $group->id);
         $task_set->group_end();
         $task_set->include_related('room', '*', TRUE, TRUE);
         $task_set->include_related_count('task', 'total_tasks');
         $task_set->include_related('task_set_type');
         $task_set->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set->where('id', $task_set_id);
         $task_set->include_related('course', 'test_scoring_deadline');
         $task_set->where('content_type', 'task_set');
         $task_set2->select('`task_sets`.*, `task_set_permission_rooms`.`time_day` AS `pb_time_day`, `task_set_permission_rooms`.`time_begin` AS `pb_time_begin`, `task_set_permission_rooms`.`id` AS `pb_room_id`, `task_set_permissions`.`publish_start_time` AS `pb_publish_start_time`, `task_set_permissions`.`upload_end_time` AS `pb_upload_end_time`');
         $task_set2->where('published', 1);
         $task_set2->where_related_course($course);
         $task_set2->where_related('task_set_permission', 'group_id', $group->id);
         $task_set2->where_related('task_set_permission', 'enabled', 1);
         $task_set2->include_related('solution');
         $task_set2->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set2->include_related('task_set_permission/room', '*', 'room', TRUE);
         $task_set2->include_related_count('task', 'total_tasks');
         $task_set2->include_related('task_set_type');
         $task_set2->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set2->where('id', $task_set_id);
         $task_set2->include_related('course', 'test_scoring_deadline');
         $task_set2->where('content_type', 'task_set');
         $task_set3 = new Task_set();
         $task_set3->select('`task_sets`.*, NULL AS `pb_time_day`, NULL AS `pb_time_begin`, NULL AS `pb_room_id`, NULL AS `pb_publish_start_time`, "0000-00-00 00:00:00" AS `pb_upload_end_time`', FALSE);
         $task_set3->where('published', 1);
         $task_set3->where_related_course($course);
         $task_set3->include_related('solution');
         $task_set3->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set3->where_related('solution', 'student_id', $student->id);
         $task_set3->include_related('room', '*', TRUE, TRUE);
         $task_set3->include_related_count('task', 'total_tasks');
         $task_set3->include_related('task_set_type');
         $task_set3->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set3->where('id', $task_set_id);
         $task_set3->include_related('course', 'test_scoring_deadline');
         $task_set3->where('content_type', 'task_set');
         $task_set2->union(array($task_set, $task_set3), FALSE, '', 1, 0, 'id');
     }
     return $task_set2;
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:66,代码来源:tasks.php

示例4: get_task_set_overview

 private function get_task_set_overview($task_set_id, &$course)
 {
     $task_set = new Task_set();
     $task_set->where('published', 1);
     $task_set->include_related_count('task', 'total_tasks');
     $task_set->where('content_type', 'project');
     $task_set->order_by('publish_start_time', 'asc');
     $task_set->order_by('upload_end_time', 'asc');
     $task_set->order_by_with_overlay('name', 'asc');
     $task_set->get_by_id((int) $task_set_id);
     $course = new Course();
     $course->where_related('task_set', 'id', (int) $task_set->id);
     $course->include_related('period');
     $course->get();
     return $task_set;
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:16,代码来源:projects.php


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