示例#1
0
 public static function getSearchData()
 {
     return DeepCI_Page_PageBar_Data::get();
 }
示例#2
0
 function getHtml()
 {
     $CI =& get_instance();
     /** 檢測出 uri_segment **/
     $uri_segment = 3;
     for ($i = 3; $i < 8; $i++) {
         if ($CI->uri->segment($i) == $this->offset) {
             $uri_segment = $i;
             break;
         }
     }
     /** 生成html **/
     $config['base_url'] = $this->base_url;
     $config['uri_segment'] = $uri_segment;
     $config['per_page'] = $this->per_page;
     $config['total_rows'] = $this->numResults;
     $config['first_link'] = '&lsaquo; 首頁';
     $config['next_link'] = '下頁 &#187;';
     $config['prev_link'] = '&#171; 上頁';
     $config['last_link'] = '末頁 &rsaquo;';
     $config['num_links'] = 5;
     $CI->load->library('pagination');
     $CI->pagination->initialize($config);
     $html = $CI->pagination->create_links();
     if ($html) {
         $html .= ' <a href="' . $this->base_url . '?per_page=all">顯示所有</a>';
     }
     $html2 = '每頁顯示<select name="per_page" onchange="window.location.href=\'' . $this->base_url . '?per_page=\'+this.value"><option value="all">--</option>';
     foreach ($this->selectPrePage as $i) {
         $selected = $i == $this->per_page ? 'selected' : '';
         $html2 .= '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
     }
     $html2 .= '</select>條,共' . $this->numResults . '條';
     $dql_order = '';
     $sort = DeepCI_Page_PageBar_Data::getDqlSort();
     if (!empty($sort)) {
         $dql_order = "sort_{$sort['type']}='{$sort['field']}'";
     }
     return array('html' => $html, 'select' => $html2, 'sort' => $dql_order);
 }
示例#3
0
文件: Data.php 项目: laiello/deep-ci
 private static function getPageKeyName()
 {
     if (!empty(self::$pageKeyName)) {
         return self::$pageKeyName;
     }
     /** 计算出pageKeyName **/
     $CI =& get_instance();
     $uri =& $CI->uri;
     $directory = trim($CI->router->directory, '/');
     if (empty($directory)) {
         $pageKeyName = $uri->rsegments[1] . '_' . $uri->rsegments[2];
     } else {
         $pageKeyName = $directory . '_' . $uri->rsegments[1] . '_' . $uri->rsegments[2];
     }
     if ($uri->rsegments[2] != self::$indexFunction) {
         $pageKeyName .= '_' . self::$indexFunction;
     }
     self::$pageKeyName = $pageKeyName;
     return $pageKeyName;
 }