本文整理汇总了PHP中Course::include_related方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::include_related方法的具体用法?PHP Course::include_related怎么用?PHP Course::include_related使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::include_related方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$course = new Course();
$course->include_related('period');
$course->get_by_id((int) @$this->config['course_id']);
$this->parser->assign('course', $course);
if ($course->exists()) {
$solutions = new Solution();
$solutions->select_func('COUNT', '@id', 'count');
$solutions->where('revalidate', 1);
$solutions->where_related('task_set', 'id', '${parent}.id');
$solutions->where_related('student/participant/course', 'id', $course->id);
$solutions->where_related('student/participant', 'allowed', 1);
$task_sets = new Task_set();
$task_sets->select('*');
$task_sets->select_subquery($solutions, 'solutions_count');
$task_sets->where_related($course);
$task_sets->where_related('solution', 'revalidate', 1);
$task_sets->where_related('solution/student/participant/course', 'id', $course->id);
$task_sets->where_related('solution/student/participant', 'allowed', 1);
$task_sets->group_by('id');
$task_sets->order_by_with_overlay('name', 'ASC');
$task_sets->get_iterated();
$this->parser->assign('task_sets', $task_sets);
}
$this->parser->parse('widgets/admin/unevaluated_solutions/main.tpl');
}
示例2: preConfigureForm
public function preConfigureForm()
{
$courses = new Course();
$courses->include_related('period');
$courses->order_by_related('period', 'sorting', 'asc');
$courses->order_by_with_constant('name');
$courses->get_iterated();
$courses_list = array('' => '');
foreach ($courses as $course) {
$courses_list[$this->lang->text($course->period_name)][$course->id] = $this->lang->text($course->name);
}
$this->parser->assign('courses', $courses_list);
}
示例3: _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);
}
}
示例4: inject_courses
private function inject_courses()
{
$courses = new Course();
$courses->include_related('period', 'name');
$courses->order_by_related('period', 'sorting', 'ASC');
$courses->order_by_with_constant('name', 'ASC');
$courses->get_iterated();
$this->parser->assign('courses', $courses);
}
示例5: mail_to_course
public function mail_to_course($course_id)
{
$course = new Course();
$course->include_related('period', 'name');
$course->get_by_id((int) $course_id);
if ($course->exists()) {
$groups = new Group();
$groups->where_related_course('id', $course->id);
$groups->order_by_with_constant('name', 'asc');
$groups->get_iterated();
$groups_students = array();
foreach ($groups as $group) {
$groups_students[$group->id] = array('name' => $group->name, 'students' => array());
}
$groups_students[0] = array('name' => 'lang:admin_courses_mail_to_course_group_name_unassigned_students', 'students' => array());
$participants = new Participant();
$participants->where('allowed', 1);
$participants->include_related('student');
$participants->where_related_course('id', $course->id);
$participants->order_by_related_as_fullname('student', 'fullname', 'asc');
$participants->get_iterated();
foreach ($participants as $participant) {
$groups_students[(int) $participant->group_id]['students'][(int) $participant->student_id] = array('fullname' => $participant->student_fullname, 'email' => $participant->student_email);
}
$this->parser->assign('groups_students', $groups_students);
}
$this->_add_tinymce4();
$this->parser->add_js_file('admin_courses/mail_form.js');
$this->parser->add_css_file('admin_courses.css');
$this->parser->parse('backend/courses/mail_to_course.tpl', array('course' => $course));
}
示例6: show_details
public function show_details($course_id, $lang = NULL)
{
$this->parser->add_css_file('frontend_courses.css');
if (!is_null($lang)) {
$this->_init_specific_language($lang);
}
$cache_id = 'course_' . $course_id . '|lang_' . $this->lang->get_current_idiom();
if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/courses/course_details.tpl'), $cache_id)) {
$course = new Course();
$course->include_related('period');
$course->get_by_id($course_id);
smarty_inject_days();
$this->parser->assign(array('course' => $course));
}
$this->parser->parse('frontend/courses/course_details.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
}
示例7: get_valuation_table
public function get_valuation_table()
{
$filter = $this->input->post('filter');
$this->store_valuation_tables_filter($filter);
$this->inject_stored_valuation_tables_filter();
$this->parser->assign('table_data', $this->get_valuation_table_data(intval(@$filter['course']), @$filter['group'], (bool) @$filter['simple']));
$course = new Course();
$course->include_related('period');
$course->get_by_id(intval(@$filter['course']));
$group = new Group();
$group->get_by_id(@$filter['group']);
$this->parser->parse('backend/solutions/valuation_table_content.tpl', array('course' => $course, 'group' => $group));
}
示例8: inject_courses
private function inject_courses()
{
$courses = new Course();
$courses->include_related('period', 'name');
$courses->order_by_related_with_constant('period', 'sorting', 'asc');
$courses->order_by_with_constant('name');
$courses->get_iterated();
$data = array();
foreach ($courses as $course) {
$data[$this->lang->text($course->period_name)][$course->id] = $this->lang->text($course->name);
}
$this->parser->assign('courses', $data);
}
示例9: 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;
}
示例10: 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;
}