本文整理汇总了PHP中Department::order_by方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::order_by方法的具体用法?PHP Department::order_by怎么用?PHP Department::order_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::order_by方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: department_list
function department_list($id = null)
{
if ($id) {
$dept = new Department($id);
$list = new Department();
$list->where('parent_id', $id);
$list->order_by('orders', 'asc');
$list->get();
child_personnel(0, $id, $dept->title);
foreach ($list as $key_tmp => $tmp) {
department_list($tmp->id);
}
}
}
示例2: index
public function index($offset = 0)
{
$this->filter_access('Departement', 'roled_select', base_url());
$dept_list = new Department();
switch ($this->input->get('c')) {
case "1":
$data['col'] = "dept_name";
break;
case "2":
$data['col'] = "dept_id";
break;
default:
$data['col'] = "dept_id";
}
if ($this->input->get('d') == "1") {
$data['dir'] = "DESC";
} else {
$data['dir'] = "ASC";
}
$data['title'] = "Departments";
$data['btn_add'] = anchor('departments/add', 'Add New', array("class" => "btn btn-primary"));
$data['btn_home'] = anchor(base_url(), 'Home');
$uri_segment = 3;
$offset = $this->uri->segment($uri_segment);
if ($this->input->get('search_by')) {
$total_rows = $dept_list->like($_GET['search_by'], $_GET['q'])->count();
$dept_list->like($_GET['search_by'], $_GET['q'])->order_by($data['col'], $data['dir']);
} else {
$total_rows = $dept_list->count();
$dept_list->order_by($data['col'], $data['dir']);
}
$data['dept_list'] = $dept_list->get($this->limit, $offset)->all;
$config['base_url'] = site_url("departments/index");
$config['total_rows'] = $total_rows;
$config['per_page'] = $this->limit;
$config['uri_segment'] = $uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$this->load->view('departments/index', $data);
}