Révision 599a39cd
Ajouté par Assos Assos il y a environ 3 ans
drupal7/sites/all/modules/date/date_repeat/date_repeat.module | ||
---|---|---|
1 | 1 |
<?php |
2 |
|
|
2 | 3 |
/** |
3 | 4 |
* @file |
4 | 5 |
* This module creates a form element that allows users to select |
... | ... | |
70 | 71 |
/** |
71 | 72 |
* Helper function for FREQ options. |
72 | 73 |
* |
73 |
* Translated and untranslated arrays of the iCal day of week names. |
|
74 |
* We need the untranslated values for date_modify(), translated
|
|
75 |
* values when displayed to user.
|
|
74 |
* Translated and untranslated arrays of the iCal day of week names. We need the
|
|
75 |
* untranslated values for date_modify(), translated values when displayed to
|
|
76 |
* user. |
|
76 | 77 |
*/ |
77 | 78 |
function date_repeat_dow_day_options($translated = TRUE) { |
78 | 79 |
return array( |
... | ... | |
104 | 105 |
|
105 | 106 |
default: |
106 | 107 |
$context = ''; |
107 |
break; |
|
108 | 108 |
} |
109 | 109 |
foreach (date_repeat_dow_day_untranslated() as $key => $day) { |
110 | 110 |
$return[$key] = $translated ? t(substr($day, 0, $length), array(), array('context' => $context)) : substr($day, 0, $length); |
... | ... | |
125 | 125 |
'WE' => 'Wednesday', |
126 | 126 |
'TH' => 'Thursday', |
127 | 127 |
'FR' => 'Friday', |
128 |
'SA' => 'Saturday' |
|
128 |
'SA' => 'Saturday',
|
|
129 | 129 |
); |
130 | 130 |
} |
131 | 131 |
return $date_repeat_weekdays; |
... | ... | |
157 | 157 |
/** |
158 | 158 |
* Helper function for BYDAY options. |
159 | 159 |
* |
160 |
* Creates options like -1SU and 2TU |
|
160 |
* Creates options like -1SU and 2TU.
|
|
161 | 161 |
*/ |
162 | 162 |
function date_repeat_dow_options() { |
163 | 163 |
$options = array(); |
... | ... | |
172 | 172 |
/** |
173 | 173 |
* Translate a day of week position to the iCal day name. |
174 | 174 |
* |
175 |
* Used with date_format($date, 'w') or get_variable('date_first_day'), |
|
176 |
* which return 0 for Sunday, 1 for Monday, etc.
|
|
175 |
* Used with date_format($date, 'w') or get_variable('date_first_day'), which
|
|
176 |
* return 0 for Sunday, 1 for Monday, etc. |
|
177 | 177 |
* |
178 | 178 |
* dow 2 becomes 'TU', dow 3 becomes 'WE', and so on. |
179 | 179 |
*/ |
... | ... | |
183 | 183 |
} |
184 | 184 |
|
185 | 185 |
/** |
186 |
* Shift the array of iCal day names into the right order for a specific week start day. |
|
186 |
* Shift the array of iCal day names into the right order. |
|
187 |
* |
|
188 |
* @param $week_start_day |
|
187 | 189 |
*/ |
188 | 190 |
function date_repeat_days_ordered($week_start_day) { |
189 | 191 |
$days = array_flip(array_keys(date_repeat_dow_day_options(FALSE))); |
... | ... | |
247 | 249 |
|
248 | 250 |
default: |
249 | 251 |
$description['!interval'] = format_plural($rrule['INTERVAL'], 'every day', 'every @count days') . ' '; |
250 |
break; |
|
251 | 252 |
} |
252 | 253 |
|
253 | 254 |
if (!empty($rrule['BYDAY'])) { |
... | ... | |
265 | 266 |
array( |
266 | 267 |
'!repeats_every_interval ' => '', |
267 | 268 |
'!date_order' => $order, |
268 |
'!day_of_week' => $days[$day] |
|
269 |
'!day_of_week' => $days[$day],
|
|
269 | 270 |
))); |
270 | 271 |
} |
271 | 272 |
else { |
... | ... | |
287 | 288 |
array( |
288 | 289 |
'!repeats_every_interval ' => '', |
289 | 290 |
'!month_days' => implode(', ', $rrule['BYMONTHDAY']), |
290 |
'!month_names' => implode(', ', $results) |
|
291 |
'!month_names' => implode(', ', $results),
|
|
291 | 292 |
))); |
292 | 293 |
} |
293 | 294 |
else { |
294 | 295 |
$description['!bymonth'] = trim(t('!repeats_every_interval on !month_names', |
295 | 296 |
array( |
296 | 297 |
'!repeats_every_interval ' => '', |
297 |
'!month_names' => implode(', ', $results) |
|
298 |
'!month_names' => implode(', ', $results),
|
|
298 | 299 |
))); |
299 | 300 |
} |
300 | 301 |
} |
... | ... | |
312 | 313 |
$description['!until'] = trim(t('!repeats_every_interval until !until_date', |
313 | 314 |
array( |
314 | 315 |
'!repeats_every_interval ' => '', |
315 |
'!until_date' => date_format_date($until, 'custom', $format) |
|
316 |
'!until_date' => date_format_date($until, 'custom', $format),
|
|
316 | 317 |
))); |
317 | 318 |
} |
318 | 319 |
if ($exceptions) { |
... | ... | |
325 | 326 |
$description['!except'] = trim(t('!repeats_every_interval except !except_dates', |
326 | 327 |
array( |
327 | 328 |
'!repeats_every_interval ' => '', |
328 |
'!except_dates' => implode(', ', $values) |
|
329 |
'!except_dates' => implode(', ', $values),
|
|
329 | 330 |
))); |
330 | 331 |
} |
331 | 332 |
if (!empty($rrule['WKST'])) { |
Formats disponibles : Unified diff
Weekly update of contrib modules