Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/plugins/views_plugin_pager_none.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
class views_plugin_pager_none extends views_plugin_pager { |
14 | 14 |
|
15 |
function init(&$view, &$display, $options = array()) { |
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function init(&$view, &$display, $options = array()) { |
|
16 | 19 |
parent::init($view, $display, $options); |
17 | 20 |
|
18 | 21 |
// If the pager is set to none, then it should show all items. |
19 | 22 |
$this->set_items_per_page(0); |
20 | 23 |
} |
21 | 24 |
|
22 |
function summary_title() { |
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public function summary_title() { |
|
23 | 29 |
if (!empty($this->options['offset'])) { |
24 | 30 |
return t('All items, skip @skip', array('@skip' => $this->options['offset'])); |
25 | 31 |
} |
26 | 32 |
return t('All items'); |
27 | 33 |
} |
28 | 34 |
|
29 |
function option_definition() { |
|
35 |
/** |
|
36 |
* {@inheritdoc} |
|
37 |
*/ |
|
38 |
public function option_definition() { |
|
30 | 39 |
$options = parent::option_definition(); |
31 | 40 |
$options['offset'] = array('default' => 0); |
32 | 41 |
|
... | ... | |
36 | 45 |
/** |
37 | 46 |
* Provide the default form for setting options. |
38 | 47 |
*/ |
39 |
function options_form(&$form, &$form_state) { |
|
48 |
public function options_form(&$form, &$form_state) {
|
|
40 | 49 |
parent::options_form($form, $form_state); |
41 | 50 |
$form['offset'] = array( |
42 | 51 |
'#type' => 'textfield', |
... | ... | |
46 | 55 |
); |
47 | 56 |
} |
48 | 57 |
|
49 |
function use_pager() { |
|
58 |
/** |
|
59 |
* {@inheritdoc} |
|
60 |
*/ |
|
61 |
public function use_pager() { |
|
50 | 62 |
return FALSE; |
51 | 63 |
} |
52 | 64 |
|
53 |
function use_count_query() { |
|
65 |
/** |
|
66 |
* {@inheritdoc} |
|
67 |
*/ |
|
68 |
public function use_count_query() { |
|
54 | 69 |
return FALSE; |
55 | 70 |
} |
56 | 71 |
|
57 |
function get_items_per_page() { |
|
72 |
/** |
|
73 |
* {@inheritdoc} |
|
74 |
*/ |
|
75 |
public function get_items_per_page() { |
|
58 | 76 |
return 0; |
59 | 77 |
} |
60 | 78 |
|
61 |
function execute_count_query(&$count_query) { |
|
62 |
// If we are displaying all items, never count. But we can update the count in post_execute. |
|
79 |
/** |
|
80 |
* {@inheritdoc} |
|
81 |
*/ |
|
82 |
public function execute_count_query(&$count_query) { |
|
83 |
// If we are displaying all items, never count. But we can update the count |
|
84 |
// in post_execute. |
|
63 | 85 |
} |
64 | 86 |
|
65 |
function post_execute(&$result) { |
|
87 |
/** |
|
88 |
* {@inheritdoc} |
|
89 |
*/ |
|
90 |
public function post_execute(&$result) { |
|
66 | 91 |
$this->total_items = count($result); |
67 | 92 |
} |
68 | 93 |
|
69 |
function query() { |
|
94 |
/** |
|
95 |
* {@inheritdoc} |
|
96 |
*/ |
|
97 |
public function query() { |
|
70 | 98 |
// The only query modifications we might do are offsets. |
71 | 99 |
if (!empty($this->options['offset'])) { |
72 | 100 |
$this->view->query->set_offset($this->options['offset']); |
73 | 101 |
} |
74 | 102 |
} |
103 |
|
|
75 | 104 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules