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_query.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Defines the base query class, which is the underlying layer in a View.
5
 * Definition of views_plugin_query.
6 6
 */
7 7

  
8 8
/**
......
14 14
 */
15 15

  
16 16
/**
17
 * Object used to create a SELECT query.
17
 * The base query class, which is the underlying layer in a View.
18 18
 */
19 19
class views_plugin_query extends views_plugin {
20

  
20 21
  /**
21 22
   * A pager plugin that should be provided by the display.
22 23
   *
23 24
   * @var views_plugin_pager
24 25
   */
25
  var $pager = NULL;
26
  public $pager = NULL;
26 27

  
27 28
  /**
28 29
   * Constructor; Create the basic query object and fill with default values.
29 30
   */
30
  function init($base_table, $base_field, $options) {
31
  public function init($base_table, $base_field, $options) {
31 32
    $this->base_table = $base_table;
32 33
    $this->base_field = $base_field;
33 34
    $this->unpack_options($this->options, $options);
......
37 38
   * Generate a query and a countquery from all of the information supplied
38 39
   * to the object.
39 40
   *
40
   * @param $get_count
41
   *   Provide a countquery if this is true, otherwise provide a normal query.
41
   * @param bool $get_count
42
   *   Provide a countquery if this is TRUE, otherwise provide a normal query.
42 43
   *
43 44
   * @return SelectQuery
44 45
   *   A SelectQuery object.
45 46
   */
46
  function query($get_count = FALSE) { }
47
  public function query($get_count = FALSE) {
48
  }
47 49

  
48 50
  /**
49 51
   * Let modules modify the query just prior to finalizing it.
......
51 53
   * @param view $view
52 54
   *   The view which is executed.
53 55
   */
54
  function alter(&$view) {  }
56
  public function alter(&$view) {
57
  }
55 58

  
56 59
  /**
57 60
   * Builds the necessary info to execute the query.
......
59 62
   * @param view $view
60 63
   *   The view which is executed.
61 64
   */
62
  function build(&$view) { }
65
  public function build(&$view) {
66
  }
63 67

  
64 68
  /**
65 69
   * Executes the query and fills the associated view object with according
......
74 78
   * @param view $view
75 79
   *   The view which is executed.
76 80
   */
77
  function execute(&$view) {  }
81
  public function execute(&$view) {
82
  }
78 83

  
79 84
  /**
80 85
   * Add a signature to the query, if such a thing is feasible.
......
85 90
   * @param view $view
86 91
   *   The view which is executed.
87 92
   */
88
  function add_signature(&$view) { }
93
  public function add_signature(&$view) {
94
  }
89 95

  
90 96
  /**
91 97
   * Get aggregation info for group by queries.
92 98
   *
93 99
   * If NULL, aggregation is not allowed.
94 100
   */
95
  function get_aggregation_info() { }
101
  public function get_aggregation_info() {
102
  }
96 103

  
97 104
  /**
98 105
   * Add settings for the ui.
99 106
   */
100
  function options_form(&$form, &$form_state) {
107
  public function options_form(&$form, &$form_state) {
101 108
    parent::options_form($form, $form_state);
102 109
  }
103 110

  
104
  function options_validate(&$form, &$form_state) { }
111
  /**
112
   * {@inheritdoc}
113
   */
114
  public function options_validate(&$form, &$form_state) {
115
  }
105 116

  
106
  function options_submit(&$form, &$form_state) { }
117
  /**
118
   * {@inheritdoc}
119
   */
120
  public function options_submit(&$form, &$form_state) {
121
  }
107 122

  
108
  function summary_title() {
123
  /**
124
   * {@inheritdoc}
125
   */
126
  public function summary_title() {
109 127
    return t('Settings');
110 128
  }
111 129

  
112 130
  /**
113 131
   * Set a LIMIT on the query, specifying a maximum number of results.
114 132
   */
115
  function set_limit($limit) {
133
  public function set_limit($limit) {
116 134
    $this->limit = $limit;
117 135
  }
118 136

  
119 137
  /**
120 138
   * Set an OFFSET on the query, specifying a number of results to skip
121 139
   */
122
  function set_offset($offset) {
140
  public function set_offset($offset) {
123 141
    $this->offset = $offset;
124 142
  }
125 143

  
126 144
  /**
127 145
   * Render the pager, if necessary.
128 146
   */
129
  function render_pager($exposed_input) {
147
  public function render_pager($exposed_input) {
130 148
    if (!empty($this->pager) && $this->pager->use_pager()) {
131 149
      return $this->pager->render($exposed_input);
132 150
    }
......
137 155
  /**
138 156
   * Create a new grouping for the WHERE or HAVING clause.
139 157
   *
140
   * @param $type
158
   * @param string $type
141 159
   *   Either 'AND' or 'OR'. All items within this group will be added
142 160
   *   to the WHERE clause with this logical operator.
143
   * @param $group
161
   * @param string $group
144 162
   *   An ID to use for this group. If unspecified, an ID will be generated.
145
   * @param $where
163
   * @param string $where
146 164
   *   'where' or 'having'.
147 165
   *
148
   * @return $group
166
   * @return string
149 167
   *   The group ID generated.
150 168
   */
151
  function set_where_group($type = 'AND', $group = NULL, $where = 'where') {
169
  public function set_where_group($type = 'AND', $group = NULL, $where = 'where') {
152 170
    // Set an alias.
153 171
    $groups = &$this->$where;
154 172

  
......
168 186
  /**
169 187
   * Control how all WHERE and HAVING groups are put together.
170 188
   *
171
   * @param $type
172
   *   Either 'AND' or 'OR'
189
   * @param string $type
190
   *   Either 'AND' or 'OR'.
173 191
   */
174
  function set_group_operator($type = 'AND') {
192
  public function set_group_operator($type = 'AND') {
175 193
    $this->group_operator = strtoupper($type);
176 194
  }
177 195

  
178 196
  /**
179 197
   * Returns the according entity objects for the given query results.
180 198
   */
181
  function get_result_entities($results, $relationship = NULL) {
199
  public function get_result_entities($results, $relationship = NULL) {
182 200
    return FALSE;
183 201
  }
202

  
184 203
}
185 204

  
186 205
/**

Formats disponibles : Unified diff