예제 #1
0
 public function index($offset = 0)
 {
     $columns = array(array('key' => 'name', 'title' => '名稱', 'sql' => 'name LIKE ?'));
     $configs = array('admin', $this->get_class(), '%s');
     $conditions = conditions($columns, $configs);
     $limit = 25;
     $total = InvoiceTag::count(array('conditions' => $conditions));
     $offset = $offset < $total ? $offset : 0;
     $this->load->library('pagination');
     $pagination = $this->pagination->initialize(array_merge(array('total_rows' => $total, 'num_links' => 5, 'per_page' => $limit, 'uri_segment' => 0, 'base_url' => '', 'page_query_string' => false, 'first_link' => '第一頁', 'last_link' => '最後頁', 'prev_link' => '上一頁', 'next_link' => '下一頁', 'full_tag_open' => '<ul class="pagination">', 'full_tag_close' => '</ul>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>'), $configs))->create_links();
     $tags = InvoiceTag::find('all', array('offset' => $offset, 'limit' => $limit, 'order' => 'id DESC', 'conditions' => $conditions));
     return $this->set_tab_index(1)->set_subtitle('作品類別列表')->load_view(array('tags' => $tags, 'pagination' => $pagination, 'columns' => $columns));
 }