Changeset 2717
- Timestamp:
- 05/29/2008 04:09:07 PM (5 months ago)
- Location:
- trunk/system
- Files:
-
- 4 modified
-
config/pagination.php (modified) (1 diff)
-
i18n/en_US/pagination.php (modified) (1 diff)
-
i18n/nl_NL/pagination.php (modified) (1 diff)
-
libraries/Pagination.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/config/pagination.php
r2486 r2717 3 3 * @package Pagination 4 4 * 5 * Views folder in which your pagination style templates reside. 5 * Pagination configuration is defined in groups which allows you to easily switch 6 * between different pagination settings for different website sections. 7 * 8 * Group Options: 9 * directory - Views folder in which your pagination style templates reside 10 * style - Pagination style template (matches view filename) 11 * uri_segment - URI segment (int or 'label') in which the current page number can be found 12 * query_string - Alternative to uri_segment: query string key that contains the page number 13 * items_per_page - Number of items to display per page 14 * auto_hide - Automatically hides pagination for single pages 6 15 */ 7 $config['directory'] = 'pagination'; 8 9 /** 10 * Pagination style template (matches view filename). 11 */ 12 $config['style'] = 'classic'; 13 14 /** 15 * URI segment (or 'label') in which the current page number can be found. 16 */ 17 $config['uri_segment'] = 3; 18 19 /** 20 * Number of items to display per page. 21 */ 22 $config['items_per_page'] = 20; 23 24 /** 25 * Automatically hide pagination completely for single pages. 26 */ 27 $config['auto_hide'] = FALSE; 16 $config['default'] = array 17 ( 18 'directory' => 'pagination', 19 'style' => 'classic', 20 'uri_segment' => 3, 21 'query_string' => '', 22 'items_per_page' => 20, 23 'auto_hide' => FALSE, 24 ); -
trunk/system/i18n/en_US/pagination.php
r1297 r2717 3 3 $lang = array 4 4 ( 5 'undefined_group' => 'The %s group is not defined in your pagination configuration.', 5 6 'page' => 'page', 6 7 'pages' => 'pages', -
trunk/system/i18n/nl_NL/pagination.php
r1524 r2717 3 3 $lang = array 4 4 ( 5 'undefined_group' => 'De %s groep werd niet gedefinieerd in uw pagination configuratie.', 5 6 'page' => 'pagina', 6 7 'pages' => 'pagina\'s', -
trunk/system/libraries/Pagination.php
r2665 r2717 22 22 protected $auto_hide = FALSE; 23 23 24 // Auto maticallygenerated values24 // Autogenerated values 25 25 protected $url; 26 26 protected $current_page; … … 38 38 * Constructs and returns a new Pagination object. 39 39 * 40 * @param array configuration 40 * @param string configuration group name 41 * @param array configuration items that overwrite group defaults 41 42 * @return object 42 43 */ 43 public function factory($ config = array())44 { 45 return new Pagination($ config);44 public function factory($group = NULL, $config = array()) 45 { 46 return new Pagination($group, $config); 46 47 } 47 48 … … 49 50 * Constructs the Pagination object. 50 51 * 51 * @param array configuration 52 * @param string configuration group name 53 * @param array configuration items that overwrite group defaults 52 54 * @return void 53 55 */ 54 public function __construct($config = array()) 55 { 56 // Load configuration 57 $config += Config::item('pagination', FALSE, FALSE); 58 56 public function __construct($group = NULL, $config = array()) 57 { 58 // No group name given, only array with custom config 59 // Allows for backward compatibility as well 60 if (is_array($group)) 61 { 62 $config = $group; 63 $group = 'default'; 64 } 65 // Use default group 66 elseif ($group === NULL) 67 { 68 $group = 'default'; 69 } 70 71 // Load and validate config group 72 if ( ! is_array($group_config = Config::item('pagination.'.$group))) 73 throw new Kohana_Exception('pagination.undefined_group', $group); 74 75 // Merge custom config items with group defaults 76 $config += $group_config; 77 78 // Pagination setup 59 79 $this->initialize($config); 60 80
