本文整理汇总了PHP中Course::order_by_related方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::order_by_related方法的具体用法?PHP Course::order_by_related怎么用?PHP Course::order_by_related使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::order_by_related方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_table_content
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));
}
示例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: _init_teacher_quick_prefered_course_menu
protected function _init_teacher_quick_prefered_course_menu()
{
$menu = array();
$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();
foreach ($courses as $course) {
$menu[$course->period_name][$course->id] = $course->name;
}
$teacher = new Teacher();
$teacher->get_by_id($this->usermanager->get_teacher_id());
$current_course_name = $this->lang->line('admin_teachers_no_prefered_course');
$current_course_id = NULL;
if ($teacher->exists()) {
$prefered_course = $teacher->prefered_course->get();
if ($prefered_course->exists()) {
$current_course_name = $this->lang->text($prefered_course->name);
$current_course_id = $prefered_course->id;
}
}
$this->parser->assign('list_teacher_prefered_course_name', $current_course_name);
$this->parser->assign('list_teacher_prefered_course_id', $current_course_id);
$this->parser->assign('list_teacher_prefered_course_menu', $menu);
}
示例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: 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();
$data = array('' => '');
foreach ($courses as $course) {
$data[$course->period_name][$course->id] = $course->name;
}
$this->parser->assign('courses', $data);
}