Révision b720ea3e
Ajouté par Assos Assos il y a plus de 8 ans
drupal7/sites/all/modules/date/date_views/theme/theme.inc | ||
---|---|---|
4 | 4 |
* @file |
5 | 5 |
* Theme files for Date Pager. |
6 | 6 |
*/ |
7 |
|
|
7 | 8 |
/** |
8 | 9 |
* Jump in and move the pager. |
9 | 10 |
*/ |
... | ... | |
15 | 16 |
$vars['header'] .= $vars['pager']; |
16 | 17 |
$vars['pager'] = ''; |
17 | 18 |
break; |
19 |
|
|
18 | 20 |
case 'both': |
19 | 21 |
$vars['header'] .= $vars['pager']; |
20 | 22 |
break; |
23 |
|
|
21 | 24 |
default: |
22 | 25 |
// Already on the bottom. |
23 | 26 |
} |
... | ... | |
66 | 69 |
} |
67 | 70 |
|
68 | 71 |
if (empty($date_info->hide_nav)) { |
69 |
$prev_date = clone($min_date); |
|
70 |
date_modify($prev_date, '-1 ' . $granularity); |
|
71 |
$next_date = clone($min_date); |
|
72 |
date_modify($next_date, '+1 ' . $granularity); |
|
73 |
$format = array('year' => 'Y', 'month' => 'Y-m', 'day' => 'Y-m-d'); |
|
74 |
switch ($granularity) { |
|
75 |
case 'week': |
|
76 |
$next_week = date_week(date_format($next_date, 'Y-m-d')); |
|
77 |
$prev_week = date_week(date_format($prev_date, 'Y-m-d')); |
|
78 |
$next_arg = date_format($next_date, 'o-\W') . date_pad($next_week); |
|
79 |
$prev_arg = date_format($prev_date, 'o-\W') . date_pad($prev_week); |
|
80 |
break; |
|
81 |
default: |
|
82 |
$next_arg = date_format($next_date, $format[$granularity]); |
|
83 |
$prev_arg = date_format($prev_date, $format[$granularity]); |
|
72 |
$prev_date = $date_info->prev_date; |
|
73 |
$next_date = $date_info->next_date; |
|
74 |
|
|
75 |
$format = array('year' => 'Y', 'month' => 'Y-m', 'day' => 'Y-m-d', 'hour' => 'Y-m-d\TH'); |
|
76 |
if (!empty($prev_date)) { |
|
77 |
switch ($granularity) { |
|
78 |
case 'week': |
|
79 |
$prev_week = date_week(date_format($prev_date, 'Y-m-d')); |
|
80 |
$prev_arg = date_format($prev_date, 'Y-\W') . date_pad($prev_week); |
|
81 |
break; |
|
82 |
default: |
|
83 |
$prev_arg = date_format($prev_date, $format[$granularity]); |
|
84 |
} |
|
85 |
$prev_path = str_replace($date_info->date_arg, $prev_arg, $date_info->url); |
|
86 |
$prev_args[$pos] = $prev_arg; |
|
87 |
$vars['prev_url'] = date_pager_url($view, NULL, $prev_arg); |
|
84 | 88 |
} |
85 |
$next_path = str_replace($date_info->date_arg, $next_arg, $date_info->url); |
|
86 |
$prev_path = str_replace($date_info->date_arg, $prev_arg, $date_info->url); |
|
87 |
$next_args[$pos] = $next_arg; |
|
88 |
$prev_args[$pos] = $prev_arg; |
|
89 |
$vars['next_url'] = date_pager_url($view, NULL, $next_arg); |
|
90 |
$vars['prev_url'] = date_pager_url($view, NULL, $prev_arg); |
|
89 |
if (!empty($next_date)) { |
|
90 |
switch ($granularity) { |
|
91 |
case 'week': |
|
92 |
$next_week = date_week(date_format($next_date, 'Y-m-d')); |
|
93 |
$next_arg = date_format($next_date, 'Y-\W') . date_pad($next_week); |
|
94 |
break; |
|
95 |
default: |
|
96 |
$next_arg = date_format($next_date, $format[$granularity]); |
|
97 |
} |
|
98 |
$next_path = str_replace($date_info->date_arg, $next_arg, $date_info->url); |
|
99 |
$next_args[$pos] = $next_arg; |
|
100 |
$vars['next_url'] = date_pager_url($view, NULL, $next_arg); |
|
101 |
} |
|
102 |
|
|
91 | 103 |
$vars['next_options'] = $vars['prev_options'] = array(); |
92 | 104 |
} |
93 | 105 |
else { |
... | ... | |
117 | 129 |
$prev_title = t('Navigate to previous year'); |
118 | 130 |
$next_title = t('Navigate to next year'); |
119 | 131 |
break; |
132 |
|
|
120 | 133 |
case 'month': |
121 | 134 |
$prev_title = t('Navigate to previous month'); |
122 | 135 |
$next_title = t('Navigate to next month'); |
123 | 136 |
break; |
137 |
|
|
124 | 138 |
case 'week': |
125 | 139 |
$prev_title = t('Navigate to previous week'); |
126 | 140 |
$next_title = t('Navigate to next week'); |
127 | 141 |
break; |
142 |
|
|
128 | 143 |
case 'day': |
129 | 144 |
$prev_title = t('Navigate to previous day'); |
130 | 145 |
$next_title = t('Navigate to next day'); |
... | ... | |
157 | 172 |
} |
158 | 173 |
|
159 | 174 |
/** |
160 |
* Theme the calendar title |
|
175 |
* Theme the calendar title.
|
|
161 | 176 |
*/ |
162 | 177 |
function theme_date_nav_title($params) { |
178 |
$title = ''; |
|
163 | 179 |
$granularity = $params['granularity']; |
164 | 180 |
$view = $params['view']; |
165 | 181 |
$date_info = $view->date_info; |
166 | 182 |
$link = !empty($params['link']) ? $params['link'] : FALSE; |
167 | 183 |
$format = !empty($params['format']) ? $params['format'] : NULL; |
168 |
$format_with_year = variable_get('date_views_' . $granularity . 'format_with_year', 'l, F j, Y'); |
|
169 |
$format_without_year = variable_get('date_views_' . $granularity . 'format_without_year', 'l, F j'); |
|
184 |
$format_with_year = variable_get('date_views_' . $granularity . '_format_with_year', 'l, F j, Y');
|
|
185 |
$format_without_year = variable_get('date_views_' . $granularity . '_format_without_year', 'l, F j');
|
|
170 | 186 |
switch ($granularity) { |
171 | 187 |
case 'year': |
172 | 188 |
$title = $date_info->year; |
173 | 189 |
$date_arg = $date_info->year; |
174 | 190 |
break; |
191 |
|
|
175 | 192 |
case 'month': |
176 | 193 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year); |
177 | 194 |
$title = date_format_date($date_info->min_date, 'custom', $format); |
178 | 195 |
$date_arg = $date_info->year . '-' . date_pad($date_info->month); |
179 | 196 |
break; |
197 |
|
|
180 | 198 |
case 'day': |
181 | 199 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year); |
182 | 200 |
$title = date_format_date($date_info->min_date, 'custom', $format); |
183 |
$date_arg = $date_info->year . '-' . date_pad($date_info->month) . '-' . date_pad($date_info->day); |
|
201 |
$date_arg = $date_info->year; |
|
202 |
$date_arg .= '-'; |
|
203 |
$date_arg .= date_pad($date_info->month); |
|
204 |
$date_arg .= '-'; |
|
205 |
$date_arg .= date_pad($date_info->day); |
|
184 | 206 |
break; |
207 |
|
|
185 | 208 |
case 'week': |
186 | 209 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year); |
187 |
$title = t('Week of @date', array('@date' => date_format_date($date_info->min_date, 'custom', $format))); |
|
210 |
$title = t('Week of @date', array( |
|
211 |
'@date' => date_format_date($date_info->min_date, 'custom', $format), |
|
212 |
)); |
|
188 | 213 |
$date_arg = $date_info->year . '-W' . date_pad($date_info->week); |
189 | 214 |
break; |
190 | 215 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules