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_courses_table_header_course_name'), array('name' => 'description', 'caption' => 'lang:admin_courses_table_header_course_description'), array('name' => 'period', 'caption' => 'lang:admin_courses_table_header_course_period'), array('name' => 'groups', 'caption' => 'lang:admin_courses_table_header_course_groups'), array('name' => 'task_set_types', 'caption' => 'lang:admin_courses_table_header_course_task_set_types'), array('name' => 'task_set_count', 'caption' => 'lang:admin_courses_table_header_course_task_set_count'), array('name' => 'capacity', 'caption' => 'lang:admin_courses_table_header_course_capacity')); $filter = $this->input->post('filter'); $this->store_filter($filter); $this->inject_stored_filter(); $courses = new Course(); $courses->include_related_count('group'); $courses->include_related_count('task_set_type'); $courses->include_related_count('task_set'); $courses->include_related('period', 'name', TRUE); $order_by_direction = $filter['order_by_direction'] == 'desc' ? 'desc' : 'asc'; if ($filter['order_by_field'] == 'name') { $courses->order_by_with_constant('name', $order_by_direction); } elseif ($filter['order_by_field'] == 'period') { $courses->order_by_related('period', 'sorting', $order_by_direction); } elseif ($filter['order_by_field'] == 'created') { $courses->order_by('created', $order_by_direction); } elseif ($filter['order_by_field'] == 'updated') { $courses->order_by('updated', $order_by_direction); } elseif ($filter['order_by_field'] == 'groups') { $courses->order_by('group_count', $order_by_direction); } elseif ($filter['order_by_field'] == 'task_set_types') { $courses->order_by('task_set_type_count', $order_by_direction); } elseif ($filter['order_by_field'] == 'task_set_count') { $courses->order_by('task_set_count', $order_by_direction); } elseif ($filter['order_by_field'] == 'capacity') { $courses->order_by('capacity', $order_by_direction); } $courses->get_iterated(); $this->lang->init_overlays('courses', $courses->all_to_array(), array('description')); $this->parser->parse('backend/courses/table_content.tpl', array('courses' => $courses, 'fields_config' => $fields_config)); }
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); }
/** * 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); } }
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); }
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); }