本文整理汇总了PHP中Course::order_by_with_constant方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::order_by_with_constant方法的具体用法?PHP Course::order_by_with_constant怎么用?PHP Course::order_by_with_constant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::order_by_with_constant方法的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: _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: 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);
}