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); }
public function get_table_content() { $fields_config = array(array('name' => 'created', 'caption' => 'lang:common_table_header_created'), array('name' => 'updated', 'caption' => 'lang:common_table_header_updated'), array('name' => 'name', 'caption' => 'lang:admin_groups_table_header_group_name'), array('name' => 'course', 'caption' => 'lang:admin_groups_table_header_group_course'), array('name' => 'rooms', 'caption' => 'lang:admin_groups_table_header_group_rooms'), array('name' => 'capacity', 'caption' => 'lang:admin_groups_table_header_group_capacity')); smarty_inject_days(); $groups = new Group(); $rooms = $groups->room; $rooms->select_min('capacity'); $rooms->where('group_id', '${parent}.id', FALSE); $filter = $this->input->post('filter'); $this->store_filter($filter); $this->inject_stored_filter(); if (isset($filter['course_id']) && intval($filter['course_id']) > 0) { $groups->where_related_course('id', intval($filter['course_id'])); } $groups->include_related('course', 'name', TRUE); $groups->include_related('course/period', 'name', TRUE); $groups->select_subquery($rooms, 'group_capacity'); $order_by_direction = $filter['order_by_direction'] == 'desc' ? 'desc' : 'asc'; if ($filter['order_by_field'] == 'course') { $groups->order_by_related('course/period', 'sorting', $order_by_direction); $groups->order_by_related_with_constant('course', 'name', $order_by_direction); } elseif ($filter['order_by_field'] == 'created') { $groups->order_by('created', $order_by_direction); } elseif ($filter['order_by_field'] == 'updated') { $groups->order_by('updated', $order_by_direction); } elseif ($filter['order_by_field'] == 'capacity') { $groups->order_by('group_capacity', $order_by_direction); } elseif ($filter['order_by_field'] == 'name') { $groups->order_by_with_constant('name', $order_by_direction); } $groups->get_paged_iterated(isset($filter['page']) ? intval($filter['page']) : 1, isset($filter['rows_per_page']) ? intval($filter['rows_per_page']) : 25); $this->parser->parse('backend/groups/table_content.tpl', array('groups' => $groups, 'fields_config' => $fields_config)); }
public function edit($group_id) { $this->parser->add_js_file('translation_selector.js'); $this->parser->add_js_file('admin_rooms/form.js'); $this->parser->add_js_file('admin_rooms/edit.js'); $url = $this->uri->ruri_to_assoc(4); $room_id = isset($url['room_id']) ? intval($url['room_id']) : 0; $room = new Room(); $room->get_by_id($room_id); smarty_inject_days(); $this->inject_teachers(); $this->parser->parse('backend/rooms/edit.tpl', array('room' => $room, 'group_id' => $group_id)); }
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); }