1 | <?php |
||
9 | class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider { |
||
10 | |||
11 | /** |
||
12 | * Specifies default items per page |
||
13 | * |
||
14 | * @config |
||
15 | * @var int |
||
16 | */ |
||
17 | private static $default_items_per_page = 15; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $itemsPerPage; |
||
23 | |||
24 | /** |
||
25 | * Which template to use for rendering |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $itemClass = 'GridFieldPaginator_Row'; |
||
30 | |||
31 | /** |
||
32 | * See {@link setThrowExceptionOnBadDataType()} |
||
33 | */ |
||
34 | protected $throwExceptionOnBadDataType = true; |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * @param int $itemsPerPage - How many items should be displayed per page |
||
39 | */ |
||
40 | public function __construct($itemsPerPage=null) { |
||
44 | |||
45 | /** |
||
46 | * Determine what happens when this component is used with a list that isn't {@link SS_Filterable}. |
||
47 | * |
||
48 | * - true: An exception is thrown |
||
49 | * - false: This component will be ignored - it won't make any changes to the GridField. |
||
50 | * |
||
51 | * By default, this is set to true so that it's clearer what's happening, but the predefined |
||
52 | * {@link GridFieldConfig} subclasses set this to false for flexibility. |
||
53 | */ |
||
54 | public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) { |
||
57 | |||
58 | /** |
||
59 | * See {@link setThrowExceptionOnBadDataType()} |
||
60 | */ |
||
61 | public function getThrowExceptionOnBadDataType() { |
||
64 | |||
65 | /** |
||
66 | * Check that this dataList is of the right data type. |
||
67 | * Returns false if it's a bad data type, and if appropriate, throws an exception. |
||
68 | */ |
||
69 | protected function checkDataType($dataList) { |
||
80 | |||
81 | /** |
||
82 | * |
||
83 | * @param GridField $gridField |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getActions($gridField) { |
||
91 | |||
92 | /** |
||
93 | * |
||
94 | * @param GridField $gridField |
||
95 | * @param string $actionName |
||
96 | * @param string $arguments |
||
97 | * @param array $data |
||
98 | * @return void |
||
99 | */ |
||
100 | public function handleAction(GridField $gridField, $actionName, $arguments, $data) { |
||
109 | |||
110 | protected $totalItems = 0; |
||
111 | |||
112 | /** |
||
113 | * Retrieves/Sets up the state object used to store and retrieve information |
||
114 | * about the current paging details of this GridField |
||
115 | * @param GridField $gridField |
||
116 | * @return GridState_Data |
||
117 | */ |
||
118 | protected function getGridPagerState(GridField $gridField) { |
||
126 | |||
127 | /** |
||
128 | * |
||
129 | * @param GridField $gridField |
||
130 | * @param SS_List $dataList |
||
131 | * @return SS_List |
||
132 | */ |
||
133 | public function getManipulatedData(GridField $gridField, SS_List $dataList) { |
||
155 | |||
156 | /** |
||
157 | * Determines arguments to be passed to the template for building this field |
||
158 | * @return ArrayData|null If paging is available this will be an ArrayData |
||
159 | * object of paging details with these parameters: |
||
160 | * <ul> |
||
161 | * <li>OnlyOnePage: boolean - Is there only one page?</li> |
||
162 | * <li>FirstShownRecord: integer - Number of the first record displayed</li> |
||
163 | * <li>LastShownRecord: integer - Number of the last record displayed</li> |
||
164 | * <li>NumRecords: integer - Total number of records</li> |
||
165 | * <li>NumPages: integer - The number of pages</li> |
||
166 | * <li>CurrentPageNum (optional): integer - If OnlyOnePage is false, the number of the current page</li> |
||
167 | * <li>FirstPage (optional): GridField_FormAction - Button to go to the first page</li> |
||
168 | * <li>PreviousPage (optional): GridField_FormAction - Button to go to the previous page</li> |
||
169 | * <li>NextPage (optional): GridField_FormAction - Button to go to the next page</li> |
||
170 | * <li>LastPage (optional): GridField_FormAction - Button to go to last page</li> |
||
171 | * </ul> |
||
172 | */ |
||
173 | public function getTemplateParameters(GridField $gridField) { |
||
255 | |||
256 | /** |
||
257 | * |
||
258 | * @param GridField $gridField |
||
259 | * @return array |
||
260 | */ |
||
261 | public function getHTMLFragments($gridField) { |
||
271 | |||
272 | /** |
||
273 | * @param Int |
||
274 | */ |
||
275 | public function setItemsPerPage($num) { |
||
279 | |||
280 | /** |
||
281 | * @return Int |
||
282 | */ |
||
283 | public function getItemsPerPage() { |
||
286 | |||
287 | } |
||
288 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.