Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_views/includes/date_views.views.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4
 * Defines date-related Views data and plugins:
5
 * Defines date-related Views data and plugins:.
5 6
 *
6 7
 * Date argument:
7 8
 *   A generic date argument that has an option to select one or more
......
126 127
 * Implements hook_views_data_alter().
127 128
 */
128 129
function date_views_views_data_alter(&$data) {
129

  
130 130
  // Mark all the core date handlers as date fields.
131 131
  // This will identify all handlers that directly use the _date handlers,
132 132
  // will not pick up any that extend those handlers.
......
146 146
 *
147 147
 * In the SQL date handler.
148 148
 *
149
 * The date handler will use this information to decide if the
150
 * database value needs a timezone conversion.
149
 * The date handler will use this information to decide if the database value
150
 * needs a timezone conversion.
151 151
 *
152
 * In Views, we will always be comparing to a local date value,
153
 * so the goal is to convert the database value to the right
154
 * value to compare to the local value.
152
 * In Views, we will always be comparing to a local date value, so the goal is
153
 * to convert the database value to the right value to compare to the local
154
 * value.
155 155
 */
156 156
function date_views_set_timezone(&$date_handler, &$view, $field) {
157 157
  switch ($field['tz_handling']) {
......
174 174
    default:
175 175
      $date_handler->db_timezone = 'UTC';
176 176
      $date_handler->local_timezone = date_default_timezone();
177
      break;
178 177
  }
179 178
}
180 179

  
......
183 182
 *
184 183
 * @param object $view
185 184
 *   A View object.
186
 *
187 185
 * @param array $extra_params
188 186
 *   An extra parameters.
189 187
 *
......
192 190
 */
193 191
function date_views_querystring($view, $extra_params = array()) {
194 192
  $query_params = array_merge($_GET, $extra_params);
193

  
195 194
  // Allow NULL params to be removed from the query string.
196 195
  foreach ($extra_params as $key => $value) {
197 196
    if (!isset($value)) {
198 197
      unset($query_params[$key]);
199 198
    }
200 199
  }
200

  
201 201
  // Filter the special "q" and "view" variables out of the query string.
202 202
  $exclude = array('q');
203

  
203 204
  // If we don't explicitly add a value for "view", filter it out.
204 205
  if (empty($extra_params['view'])) {
205 206
    $exclude[] = 'view';
206 207
  }
208

  
207 209
  // Clear out old date pager settings if not explicitly added.
208 210
  if (!empty($view->date_info->pager_id) && empty($extra_params[$view->date_info->pager_id])) {
209 211
    $exclude[] = $view->date_info->pager_id;
210 212
  }
211 213

  
212 214
  $query = drupal_get_query_parameters($query_params, $exclude);
215

  
213 216
  // To prevent an empty query string from adding a "?" on to the end of a URL,
214 217
  // we return NULL.
215 218
  return !empty($query) ? $query : NULL;

Formats disponibles : Unified diff