Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/plugins/views_plugin_pager.inc
17 17
 * The base plugin to handle pager.
18 18
 */
19 19
class views_plugin_pager extends views_plugin {
20
  var $current_page = NULL;
21
  var $total_items = 0;
20

  
21
  /**
22
   *
23
   */
24
  public $current_page = NULL;
25

  
26
  /**
27
   *
28
   */
29
  public $total_items = 0;
22 30

  
23 31
  /**
24 32
   * Initialize the plugin.
25 33
   *
26
   * @param $view
34
   * @param view $view
27 35
   *   The view object.
28
   * @param $display
36
   * @param object $display
29 37
   *   The display handler.
30 38
   */
31
  function init(&$view, &$display, $options = array()) {
39
  public function init(&$view, &$display, $options = array()) {
32 40
    $this->view = &$view;
33 41
    $this->display = &$display;
34 42

  
......
41 49
   * All but the leanest pagers should probably return a value here, so
42 50
   * most pagers will not need to override this method.
43 51
   */
44
  function get_items_per_page() {
52
  public function get_items_per_page() {
45 53
    return isset($this->options['items_per_page']) ? $this->options['items_per_page'] : 0;
46 54
  }
47 55

  
......
50 58
   *
51 59
   * This is mostly used for things that will override the value.
52 60
   */
53
  function set_items_per_page($items) {
61
  public function set_items_per_page($items) {
54 62
    $this->options['items_per_page'] = $items;
55 63
  }
56 64

  
......
60 68
   * Even pagers that don't actually page can skip items at the beginning,
61 69
   * so few pagers will need to override this method.
62 70
   */
63
  function get_offset() {
71
  public function get_offset() {
64 72
    return isset($this->options['offset']) ? $this->options['offset'] : 0;
65 73
  }
66 74

  
67 75
  /**
68 76
   * Set the page offset, or how many items to skip.
69 77
   */
70
  function set_offset($offset) {
78
  public function set_offset($offset) {
71 79
    $this->options['offset'] = $offset;
72 80
  }
73 81

  
......
76 84
   *
77 85
   * If NULL, we do not know what the current page is.
78 86
   */
79
  function get_current_page() {
87
  public function get_current_page() {
80 88
    return $this->current_page;
81 89
  }
82 90

  
83 91
  /**
84 92
   * Set the current page.
85 93
   *
86
   * @param $number
94
   * @param int $number
87 95
   *   If provided, the page number will be set to this. If NOT provided,
88 96
   *   the page number will be set from the global page array.
89 97
   */
90
  function set_current_page($number = NULL) {
98
  public function set_current_page($number = NULL) {
91 99
    if (!is_numeric($number) || $number < 0) {
92 100
      $number = 0;
93 101
    }
......
99 107
   *
100 108
   * If NULL, we do not yet know what the total number of items are.
101 109
   */
102
  function get_total_items() {
110
  public function get_total_items() {
103 111
    return $this->total_items;
104 112
  }
105 113

  
106 114
  /**
107
   * Get the pager id, if it exists
115
   * Get the pager id, if it exists.
108 116
   */
109
  function get_pager_id() {
117
  public function get_pager_id() {
110 118
    return !empty($this->options['id']) ? $this->options['id'] : 0;
111 119
  }
112 120

  
113 121
  /**
114
   * Provide the default form form for validating options
122
   * Provide the default form form for validating options.
115 123
   */
116
  function options_validate(&$form, &$form_state) { }
124
  public function options_validate(&$form, &$form_state) {
125
  }
117 126

  
118 127
  /**
119
   * Provide the default form form for submitting options
128
   * Provide the default form form for submitting options.
120 129
   */
121
  function options_submit(&$form, &$form_state) { }
130
  public function options_submit(&$form, &$form_state) {
131
  }
122 132

  
123 133
  /**
124 134
   * Return a string to display as the clickable title for the
125 135
   * pager plugin.
126 136
   */
127
  function summary_title() {
137
  public function summary_title() {
128 138
    return t('Unknown');
129 139
  }
130 140

  
......
133 143
   *
134 144
   * Only a couple of very specific pagers will set this to false.
135 145
   */
136
  function use_pager() {
146
  public function use_pager() {
137 147
    return TRUE;
138 148
  }
139 149

  
......
142 152
   *
143 153
   * If a pager needs a count query, a simple query
144 154
   */
145
  function use_count_query() {
155
  public function use_count_query() {
146 156
    return TRUE;
147 157
  }
148 158

  
......
150 160
   * Execute the count query, which will be done just prior to the query
151 161
   * itself being executed.
152 162
   */
153
  function execute_count_query(&$count_query) {
163
  public function execute_count_query(&$count_query) {
154 164
    $this->total_items = $count_query->execute()->fetchField();
155 165
    if (!empty($this->options['offset'])) {
156 166
      $this->total_items -= $this->options['offset'];
......
164 174
   * If there are pagers that need global values set, this method can
165 175
   * be used to set them. It will be called when the count query is run.
166 176
   */
167
  function update_page_info() {
168

  
177
  public function update_page_info() {
169 178
  }
170 179

  
171 180
  /**
......
173 182
   *
174 183
   * This is called during the build phase and can directly modify the query.
175 184
   */
176
  function query() { }
185
  public function query() {
186
  }
177 187

  
178 188
  /**
179 189
   * Perform any needed actions just prior to the query executing.
180 190
   */
181
  function pre_execute(&$query) { }
191
  public function pre_execute(&$query) {
192
  }
182 193

  
183 194
  /**
184 195
   * Perform any needed actions just after the query executing.
185 196
   */
186
  function post_execute(&$result) { }
197
  public function post_execute(&$result) {
198
  }
187 199

  
188 200
  /**
189 201
   * Perform any needed actions just before rendering.
190 202
   */
191
  function pre_render(&$result) { }
203
  public function pre_render(&$result) {
204
  }
192 205

  
193 206
  /**
194 207
   * Render the pager.
......
196 209
   * Called during the view render process, this will render the
197 210
   * pager.
198 211
   *
199
   * @param $input
212
   * @param array $input
200 213
   *   Any extra GET parameters that should be retained, such as exposed
201 214
   *   input.
202 215
   */
203
  function render($input) { }
216
  public function render($input) {
217
  }
204 218

  
205 219
  /**
206 220
   * Determine if there are more records available.
207 221
   *
208 222
   * This is primarily used to control the display of a more link.
209 223
   */
210
  function has_more_records() {
224
  public function has_more_records() {
211 225
    return $this->get_items_per_page()
212 226
      && $this->total_items > (intval($this->current_page) + 1) * $this->get_items_per_page();
213 227
  }
214 228

  
215
  function exposed_form_alter(&$form, &$form_state) { }
229
  /**
230
   * {@inheritdoc}
231
   */
232
  public function exposed_form_alter(&$form, &$form_state) {
233
  }
216 234

  
217
  function exposed_form_validate(&$form, &$form_state) { }
235
  /**
236
   * {@inheritdoc}
237
   */
238
  public function exposed_form_validate(&$form, &$form_state) {
239
  }
218 240

  
219
  function exposed_form_submit(&$form, &$form_state, &$exclude) { }
241
  /**
242
   * {@inheritdoc}
243
   */
244
  public function exposed_form_submit(&$form, &$form_state, &$exclude) {
245
  }
220 246

  
221
  function uses_exposed() {
247
  /**
248
   * {@inheritdoc}
249
   */
250
  public function uses_exposed() {
222 251
    return FALSE;
223 252
  }
224 253

  
225
  function items_per_page_exposed() {
254
  /**
255
   * {@inheritdoc}
256
   */
257
  public function items_per_page_exposed() {
226 258
    return FALSE;
227 259
  }
228 260

  
229
  function offset_exposed() {
261
  /**
262
   * {@inheritdoc}
263
   */
264
  public function offset_exposed() {
230 265
    return FALSE;
231 266
  }
267

  
232 268
}
233 269

  
234 270
/**

Formats disponibles : Unified diff