This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
|
static | convertDateToUtcDBTimestamp (?\ilDateTime $date=null) |
|
static | _isToday (ilDateTime $date) |
|
static | _numericMonthToString (int $a_month, bool $a_long=true, ?ilLanguage $lng=null) |
| numeric month to string More...
|
|
static | _numericDayToString (int $a_day, bool $a_long=true, ?ilLanguage $lng=null) |
|
static | _buildWeekDayList (ilDate $a_day, int $a_weekstart) |
| build week day list public More...
|
|
static | _buildMonthDayList (int $a_month, int $a_year, int $weekstart) |
| Build a month day list. More...
|
|
static | initJSCalendar () |
|
static | getZoneInfoFile ($a_tz) |
|
static | _getShortTimeZoneList () |
| get short timezone list More...
|
|
static | _isLeapYear (int $a_year) |
| check if a given year is a leap year More...
|
|
static | _getMaxDayOfMonth (int $a_year, int $a_month) |
| get max day of month 2008,2 => 29 More...
|
|
static | calculateFontColor (string $a_html_color_code) |
| Calculate best font color from html hex color code. More...
|
|
static | getHourSelection (int $a_format) |
| Get hour selection depending on user specific hour format. More...
|
|
static | initDefaultCalendarByType (int $a_type_id, int $a_usr_id, string $a_title, bool $a_create=false) |
| Init the default calendar for given type and user. More...
|
|
static | getUserDateFormat (int $a_add_time=0, bool $a_for_parsing=false) |
| Parse current user setting into date/time format. More...
|
|
static | initDateTimePicker () |
|
static | parseDateString (string $date, bool $add_time=false, ?string $force_format=null) |
| Parse (incoming) string to date/time object. More...
|
|
static | parseIncomingDate ($value, bool $add_time=false) |
| Try to parse incoming value to date object. More...
|
|
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilCalendarUtil
- Author
- Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Definition at line 23 of file class.ilCalendarUtil.php.
◆ _buildMonthDayList()
static ilCalendarUtil::_buildMonthDayList |
( |
int |
$a_month, |
|
|
int |
$a_year, |
|
|
int |
$weekstart |
|
) |
| |
|
static |
Build a month day list.
- Parameters
-
int | month |
int | year |
int | weekstart (0 => Sunday,1 => Monday) |
- Returns
- ilDateList
Definition at line 118 of file class.ilCalendarUtil.php.
References IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, IL_CAL_UNIX, and ilDateList\TYPE_DATE.
Referenced by ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), and ilCalendarMonthGUI\show().
122 $prev_month = ($a_month == 1) ? 12 : $a_month - 1;
123 $prev_year = ($prev_month == 12) ? $a_year - 1 : $a_year;
124 $next_month = $a_month == 12 ? 1 : $a_month + 1;
125 $next_year = $a_month == 12 ? $a_year + 1 : $a_year;
127 $days_in_month = self::_getMaxDayOfMonth($a_year, $a_month);
128 $days_in_prev_month = self::_getMaxDayOfMonth($a_year, $prev_month);
130 $week_day[
'year'] = $a_year;
131 $week_day[
'mon'] = $a_month;
132 $week_day[
'mday'] = 1;
133 $week_day[
'hours'] = 0;
134 $week_day[
'minutes'] = 0;
138 $first_day_offset = (($weekday - $weekstart) < 0) ? 6 : $weekday - $weekstart;
140 for ($i = 0; $i < 42; $i++) {
141 if ($i < $first_day_offset) {
142 $day = $days_in_prev_month - $first_day_offset + $i + 1;
144 $day_list->add(
new ilDate(
150 $days_in_prev_month - $first_day_offset + $i + 1,
155 } elseif ($i < $days_in_month + $first_day_offset) {
156 $day = $i - $first_day_offset + 1;
158 $day_list->add(
new ilDate(
164 $i - $first_day_offset + 1,
170 $day = $i - $days_in_month - $first_day_offset + 1;
171 $day_list->add(
new ilDate(
177 $i - $days_in_month - $first_day_offset + 1,
183 if ($i == 34 and ($day < 15 or $day == $days_in_month)) {
◆ _buildWeekDayList()
static ilCalendarUtil::_buildWeekDayList |
( |
ilDate |
$a_day, |
|
|
int |
$a_weekstart |
|
) |
| |
|
static |
◆ _getMaxDayOfMonth()
static ilCalendarUtil::_getMaxDayOfMonth |
( |
int |
$a_year, |
|
|
int |
$a_month |
|
) |
| |
|
static |
get max day of month 2008,2 => 29
Definition at line 385 of file class.ilCalendarUtil.php.
Referenced by ilCalendarRecurrenceCalculator\applyBYMONTHDAYRules(), ilCalendarRecurrenceCalculator\getMonthWeekDays(), and ilCalendarSchedule\initPeriod().
387 if (function_exists(
'cal_days_in_month')) {
388 return cal_days_in_month(CAL_GREGORIAN, $a_month, $a_year);
390 return (
int) date(
't', mktime(0, 0, 0, $a_month, 1, $a_year));
◆ _getShortTimeZoneList()
static ilCalendarUtil::_getShortTimeZoneList |
( |
| ) |
|
|
static |
get short timezone list
Definition at line 288 of file class.ilCalendarUtil.php.
Referenced by ilObjCalendarSettingsGUI\initFormSettings(), ilPersonalSettingsGUI\initGeneralSettingsForm(), and ilCalendarUserSettingsGUI\initSettingsForm().
291 'Pacific/Samoa' =>
'GMT-11: Midway Islands, Samoa',
292 'US/Hawaii' =>
'GMT-10:00: Hawaii, Polynesia',
293 'US/Alaska' =>
'GMT-9:00: Alaska',
294 'America/Los_Angeles' =>
'GMT-8:00: Tijuana, Los Angeles, Seattle, Vancouver',
295 'US/Arizona' =>
'GMT-7:00: Arizona',
296 'America/Chihuahua' =>
'GMT-7:00: Chihuahua, La Paz, Mazatlan',
297 'America/Denver' =>
'GMT-7:00: Arizona, Denver, Salt Lake City, Calgary',
298 'America/Chicago' =>
'GMT-6:00: Chicago, Dallas, Kansas City, Winnipeg',
299 'America/Monterrey' =>
'GMT-6:00: Guadalajara, Mexico City, Monterrey',
300 'Canada/Saskatchewan' =>
'GMT-6:00: Saskatchewan',
301 'US/Central' =>
'GMT-6:00: Central America',
302 'America/Bogota' =>
'GMT-5:00: Bogota, Lima, Quito',
303 'US/East-Indiana' =>
'GMT-5:00: East-Indiana',
304 'America/New_York' =>
'GMT-5:00: New York, Miami, Atlanta, Detroit, Toronto',
305 'Canada/Atlantic' =>
'GMT-4:00: Atlantic (Canada)',
306 'America/La_Paz' =>
'GMT-4:00: Carcas, La Paz',
307 'America/Santiago' =>
'GMT-4:00: Santiago',
308 'Canada/Newfoundland' =>
'GMT-3:00: Newfoundland',
309 'Brazil/East' =>
'GMT-3:00: Sao Paulo',
310 'America/Argentina/Buenos_Aires' =>
'GMT-3:00: Buenes Aires, Georgtown',
311 'Etc/GMT+3' =>
'GMT-3:00: Greenland, Uruguay, Surinam',
312 'Atlantic/Cape_Verde' =>
'GMT-2:00: Cape Verde, Greenland, South Georgia',
313 'Atlantic/Azores' =>
'GMT-1:00: Azores',
314 'Africa/Casablanca' =>
'GMT+0:00: Casablanca, Monrovia',
315 'Europe/London' =>
'GMT+0:00: Dublin, Edinburgh, Lisbon, London',
316 'Europe/Berlin' =>
'GMT+1:00: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
317 'Europe/Belgrade' =>
'GMT+1:00: Belgrade, Bratislava, Budapest, Ljubljana, Prague',
318 'Europe/Paris' =>
'GMT+1:00: Brussels, Copenhagen, Paris, Madrid',
319 'Europe/Sarajevo' =>
'GMT+1:00: Sarajevo, Skopje, Warsaw, Zagreb',
320 'Africa/Lagos' =>
'GMT+1:00: West-Central Africa',
321 'Europe/Athens' =>
'GMT+2:00: Athens, Beirut, Istanbul, Minsk',
322 'Europe/Bucharest' =>
'GMT+2:00: Bucharest',
323 'Africa/Harare' =>
'GMT+2:00: Harare, Pratoria',
324 'Europe/Helsinki' =>
'GMT+2:00: Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius',
325 'Asia/Jerusalem' =>
'GMT+2:00: Jerusalem',
326 'Africa/Cairo' =>
'GMT+2:00: Cairo',
327 'Asia/Baghdad' =>
'GMT+3:00: Baghdad',
328 'Asia/Kuwait' =>
'GMT+3:00: Kuwait, Riyadh',
329 'Europe/Moscow' =>
'GMT+3:00: Moscow, Saint Petersburg',
330 'Africa/Nairobi' =>
'GMT+3:00: Nairobi',
331 'Asia/Tehran' =>
'GMT+3:30: Tehran',
332 'Asia/Muscat' =>
'GMT+4:00: Abu Dhabi, Muscat',
333 'Asia/Baku' =>
'GMT+4:00: Baku, Tbilisi, Erivan',
334 'Asia/Kabul' =>
'GMT+4:00: Kabul',
335 'Asia/Karachi' =>
'GMT+5:00: Islamabad, Karachi, Taschkent',
336 'Asia/Yekaterinburg' =>
'GMT+5:00: Yekaterinburg',
337 'Asia/Calcutta' =>
'GMT+5:30: New Dehli',
338 'Asia/Katmandu' =>
'GMT+5:45: Katmandu',
339 'Asia/Novosibirsk' =>
'GMT+6:00: Almaty, Novosibirsk',
340 'Asia/Dhaka' =>
'GMT+6:00: Astana, Dhaka',
341 'Asia/Rangoon' =>
'GMT+6:00: Sri Jayawardenepura, Rangoon',
342 'Asia/Jakarta' =>
'GMT+7:00: Bangkok, Hanoi, Jakarta',
343 'Asia/Krasnoyarsk' =>
'GMT+7:00: Krasnoyarsk',
344 'Asia/Irkutsk' =>
'GMT+8:00: Irkutsk, Ulan Bator',
345 'Asia/Singapore' =>
'GMT+8:00: Kuala Lumpour, Singapore',
346 'Asia/Hong_Kong' =>
'GMT+8:00: Beijing, Chongqing, Hong kong, Urumchi',
347 'Australia/Perth' =>
'GMT+8:00: Perth',
348 'Asia/Taipei' =>
'GMT+8:00: Taipei',
349 'Asia/Yakutsk' =>
'GMT+9:00: Yakutsk',
350 'Asia/Tokyo' =>
'GMT+9:00: Osaka, Sapporo, Tokyo',
351 'Asia/Seoul' =>
'GMT+9:00: Seoul, Darwin, Adelaide',
352 'Australia/Brisbane' =>
'GMT+10:00: Brisbane',
353 'Australia/Sydney' =>
'GMT+10:00: Canberra, Melbourne, Sydney',
354 'Pacific/Guam' =>
'GMT+10:00: Guam, Port Moresby',
355 'Australia/Hobart' =>
'GMT+10:00: Hobart',
356 'Asia/Vladivostok' =>
'GMT+10:00: Vladivostok',
357 'Asia/Magadan' =>
'GMT+11:00: Salomon Islands, New Caledonia, Magadan',
358 'Pacific/Auckland' =>
'GMT+12:00: Auckland, Wellington',
359 'Pacific/Fiji' =>
'GMT+12:00: Fiji, Kamchatka, Marshall-Islands'
◆ _isLeapYear()
static ilCalendarUtil::_isLeapYear |
( |
int |
$a_year | ) |
|
|
static |
◆ _isToday()
static ilCalendarUtil::_isToday |
( |
ilDateTime |
$date | ) |
|
|
static |
◆ _numericDayToString()
static ilCalendarUtil::_numericDayToString |
( |
int |
$a_day, |
|
|
bool |
$a_long = true , |
|
|
?ilLanguage |
$lng = null |
|
) |
| |
|
static |
- Parameters
-
int | day of week (0 for sunday, 1 for monday) |
bool | short or long day translation |
Definition at line 72 of file class.ilCalendarUtil.php.
References $DIC, and $lng.
Referenced by ilCalendarWeekGUI\addHeaderDate(), ilMiniCalendarGUI\addMiniMonth(), ilCalendarBlockGUI\addMiniMonth(), ilRecurrenceInputGUI\buildMonthlyByDaySelection(), ilRecurrenceInputGUI\buildWeekDaySelection(), ilRecurrenceInputGUI\buildYearlyByDaySelection(), ilSessionStatisticsGUI\exportCSV(), ilBookingReservationsTableGUI\fillRow(), ilBookingReservationsTableGUI\fillRowCSV(), ilBookingReservationsTableGUI\fillRowExcel(), ilSessionStatisticsGUI\getChart(), ILIAS\BookingManager\BookingProcess\WeekGridGUI\getHoursOfDay(), ilCalendarHeaderNavigationGUI\getHTML(), ilBookingReservationsTableGUI\initFilter(), ilCalendarDayGUI\show(), and ilCalendarMonthGUI\show().
79 $lng->loadLanguageModule(
'dateplaner');
80 static $days = array(
'Su',
'Mo',
'Tu',
'We',
'Th',
'Fr',
'Sa',
'Su');
82 return $a_long ?
$lng->txt($days[$a_day] .
'_long') :
$lng->txt($days[$a_day] .
'_short');
◆ _numericMonthToString()
static ilCalendarUtil::_numericMonthToString |
( |
int |
$a_month, |
|
|
bool |
$a_long = true , |
|
|
?ilLanguage |
$lng = null |
|
) |
| |
|
static |
◆ calculateFontColor()
static ilCalendarUtil::calculateFontColor |
( |
string |
$a_html_color_code | ) |
|
|
static |
Calculate best font color from html hex color code.
- Parameters
-
- Returns
- string #ffffff or #000000
Definition at line 398 of file class.ilCalendarUtil.php.
Referenced by ilCalendarWeekGUI\showAppointment(), ilCalendarDayGUI\showAppointment(), ilCalendarMonthGUI\showEvents(), ilCalendarWeekGUI\showFulldayAppointment(), and ilCalendarDayGUI\showFulldayAppointment().
400 if (strpos($a_html_color_code,
'#') !== 0 or strlen($a_html_color_code) != 7) {
405 $lum = round(hexdec(substr($a_html_color_code, 1, 2)) * 0.2126 +
406 hexdec(substr($a_html_color_code, 3, 2)) * 0.7152 +
407 hexdec(substr($a_html_color_code, 5, 2)) * 0.0722);
408 return ($lum <= 128) ?
"#FFFFFF" :
"#000000";
◆ convertDateToUtcDBTimestamp()
static ilCalendarUtil::convertDateToUtcDBTimestamp |
( |
?\ilDateTime |
$date = null | ) |
|
|
static |
◆ getHourSelection()
static ilCalendarUtil::getHourSelection |
( |
int |
$a_format | ) |
|
|
static |
◆ getUserDateFormat()
static ilCalendarUtil::getUserDateFormat |
( |
int |
$a_add_time = 0 , |
|
|
bool |
$a_for_parsing = false |
|
) |
| |
|
static |
Parse current user setting into date/time format.
- Parameters
-
| ?int | $a_add_time 1=hh:mm, 2=hh:mm:ss |
bool | $a_for_parsing | |
- Returns
- string
Definition at line 478 of file class.ilCalendarUtil.php.
References $DIC, and ilCalendarSettings\TIME_FORMAT_24.
Referenced by ilPRGActionNoteBuilder\getUserDateFormat(), ilStudyProgrammeUserTable\getUserDateFormat(), and ILIAS\EmployeeTalk\Notification\NotificationHandler\send().
482 $ilUser = $DIC[
'ilUser'];
484 $format = (string) $ilUser->getDateFormat();
490 if ($a_add_time == 2) {
496 if (!$a_for_parsing) {
497 $format = str_replace(
"d",
"DD", $format);
498 $format = str_replace(
"m",
"MM", $format);
499 $format = str_replace(
"i",
"mm", $format);
500 $format = str_replace(
"Y",
"YYYY", $format);
501 $format = str_replace(
"H",
"HH", $format);
502 $format = str_replace(
"h",
"hh", $format);
503 $format = str_replace(
"s",
"ss", $format);
◆ getZoneInfoFile()
static ilCalendarUtil::getZoneInfoFile |
( |
|
$a_tz | ) |
|
|
static |
Definition at line 275 of file class.ilCalendarUtil.php.
Referenced by ilCalendarExport\createTimezones().
277 if (!array_key_exists($a_tz, self::_getShortTimeZoneList())) {
280 $timezone_filename = str_replace(
'/',
'_', $a_tz);
281 $timezone_filename .=
'.ics';
282 return '../components/ILIAS/Calendar/zoneinfo/' . $timezone_filename;
◆ initDateTimePicker()
static ilCalendarUtil::initDateTimePicker |
( |
| ) |
|
|
static |
◆ initDefaultCalendarByType()
static ilCalendarUtil::initDefaultCalendarByType |
( |
int |
$a_type_id, |
|
|
int |
$a_usr_id, |
|
|
string |
$a_title, |
|
|
bool |
$a_create = false |
|
) |
| |
|
static |
◆ initJSCalendar()
static ilCalendarUtil::initJSCalendar |
( |
| ) |
|
|
static |
Definition at line 190 of file class.ilCalendarUtil.php.
References $DIC, and $lng.
197 if (self::$init_done ==
"done") {
201 $lng->loadLanguageModule(
"jscalendar");
203 "CALENDAR_LANG_JAVASCRIPT",
204 "calendar_javascript",
206 "components/ILIAS/Calendar" 208 $tpl->setCurrentBlock(
"calendar_javascript");
209 $tpl->setVariable(
"FULL_SUNDAY",
$lng->txt(
"l_su"));
210 $tpl->setVariable(
"FULL_MONDAY",
$lng->txt(
"l_mo"));
211 $tpl->setVariable(
"FULL_TUESDAY",
$lng->txt(
"l_tu"));
212 $tpl->setVariable(
"FULL_WEDNESDAY",
$lng->txt(
"l_we"));
213 $tpl->setVariable(
"FULL_THURSDAY",
$lng->txt(
"l_th"));
214 $tpl->setVariable(
"FULL_FRIDAY",
$lng->txt(
"l_fr"));
215 $tpl->setVariable(
"FULL_SATURDAY",
$lng->txt(
"l_sa"));
216 $tpl->setVariable(
"SHORT_SUNDAY",
$lng->txt(
"s_su"));
217 $tpl->setVariable(
"SHORT_MONDAY",
$lng->txt(
"s_mo"));
218 $tpl->setVariable(
"SHORT_TUESDAY",
$lng->txt(
"s_tu"));
219 $tpl->setVariable(
"SHORT_WEDNESDAY",
$lng->txt(
"s_we"));
220 $tpl->setVariable(
"SHORT_THURSDAY",
$lng->txt(
"s_th"));
221 $tpl->setVariable(
"SHORT_FRIDAY",
$lng->txt(
"s_fr"));
222 $tpl->setVariable(
"SHORT_SATURDAY",
$lng->txt(
"s_sa"));
223 $tpl->setVariable(
"FULL_JANUARY",
$lng->txt(
"l_01"));
224 $tpl->setVariable(
"FULL_FEBRUARY",
$lng->txt(
"l_02"));
225 $tpl->setVariable(
"FULL_MARCH",
$lng->txt(
"l_03"));
226 $tpl->setVariable(
"FULL_APRIL",
$lng->txt(
"l_04"));
227 $tpl->setVariable(
"FULL_MAY",
$lng->txt(
"l_05"));
228 $tpl->setVariable(
"FULL_JUNE",
$lng->txt(
"l_06"));
229 $tpl->setVariable(
"FULL_JULY",
$lng->txt(
"l_07"));
230 $tpl->setVariable(
"FULL_AUGUST",
$lng->txt(
"l_08"));
231 $tpl->setVariable(
"FULL_SEPTEMBER",
$lng->txt(
"l_09"));
232 $tpl->setVariable(
"FULL_OCTOBER",
$lng->txt(
"l_10"));
233 $tpl->setVariable(
"FULL_NOVEMBER",
$lng->txt(
"l_11"));
234 $tpl->setVariable(
"FULL_DECEMBER",
$lng->txt(
"l_12"));
235 $tpl->setVariable(
"SHORT_JANUARY",
$lng->txt(
"s_01"));
236 $tpl->setVariable(
"SHORT_FEBRUARY",
$lng->txt(
"s_02"));
237 $tpl->setVariable(
"SHORT_MARCH",
$lng->txt(
"s_03"));
238 $tpl->setVariable(
"SHORT_APRIL",
$lng->txt(
"s_04"));
239 $tpl->setVariable(
"SHORT_MAY",
$lng->txt(
"s_05"));
240 $tpl->setVariable(
"SHORT_JUNE",
$lng->txt(
"s_06"));
241 $tpl->setVariable(
"SHORT_JULY",
$lng->txt(
"s_07"));
242 $tpl->setVariable(
"SHORT_AUGUST",
$lng->txt(
"s_08"));
243 $tpl->setVariable(
"SHORT_SEPTEMBER",
$lng->txt(
"s_09"));
244 $tpl->setVariable(
"SHORT_OCTOBER",
$lng->txt(
"s_10"));
245 $tpl->setVariable(
"SHORT_NOVEMBER",
$lng->txt(
"s_11"));
246 $tpl->setVariable(
"SHORT_DECEMBER",
$lng->txt(
"s_12"));
247 $tpl->setVariable(
"ABOUT_CALENDAR",
$lng->txt(
"about_calendar"));
248 $tpl->setVariable(
"ABOUT_CALENDAR_LONG",
$lng->txt(
"about_calendar_long"));
249 $tpl->setVariable(
"ABOUT_TIME_LONG",
$lng->txt(
"about_time"));
250 $tpl->setVariable(
"PREV_YEAR",
$lng->txt(
"prev_year"));
251 $tpl->setVariable(
"PREV_MONTH",
$lng->txt(
"prev_month"));
252 $tpl->setVariable(
"GO_TODAY",
$lng->txt(
"go_today"));
253 $tpl->setVariable(
"NEXT_MONTH",
$lng->txt(
"next_month"));
254 $tpl->setVariable(
"NEXT_YEAR",
$lng->txt(
"next_year"));
255 $tpl->setVariable(
"SEL_DATE",
$lng->txt(
"select_date"));
256 $tpl->setVariable(
"DRAG_TO_MOVE",
$lng->txt(
"drag_to_move"));
257 $tpl->setVariable(
"PART_TODAY",
$lng->txt(
"part_today"));
258 $tpl->setVariable(
"DAY_FIRST",
$lng->txt(
"day_first"));
259 $tpl->setVariable(
"CLOSE",
$lng->txt(
"close"));
260 $tpl->setVariable(
"TODAY",
$lng->txt(
"today"));
261 $tpl->setVariable(
"TIME_PART",
$lng->txt(
"time_part"));
262 $tpl->setVariable(
"DEF_DATE_FORMAT",
$lng->txt(
"def_date_format"));
263 $tpl->setVariable(
"TT_DATE_FORMAT",
$lng->txt(
"tt_date_format"));
264 $tpl->setVariable(
"WK",
$lng->txt(
"wk"));
265 $tpl->setVariable(
"TIME",
$lng->txt(
"time"));
266 $tpl->parseCurrentBlock();
267 $tpl->setCurrentBlock(
"CalendarJS");
268 $tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR",
"./components/ILIAS/Calendar/js/calendar.js");
269 $tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR_SETUP",
"./components/ILIAS/Calendar/js/calendar-setup.js");
270 $tpl->parseCurrentBlock();
272 self::$init_done =
"done";
◆ parseDateString()
static ilCalendarUtil::parseDateString |
( |
string |
$date, |
|
|
bool |
$add_time = false , |
|
|
?string |
$force_format = null |
|
) |
| |
|
static |
Parse (incoming) string to date/time object.
- Parameters
-
string | $date | |
bool | $add_time | 1=hh:mm, 2=hh:mm:ss |
bool | $a_use_generic_format | |
- Returns
- array date, warnings, errors
- Exceptions
-
Definition at line 532 of file class.ilCalendarUtil.php.
References $DIC, IL_CAL_DATE, IL_CAL_DATETIME, and null.
536 $ilUser = $DIC[
'ilUser'];
537 if (!$force_format) {
538 $out_format = self::getUserDateFormat($add_time,
true);
540 $out_format = $force_format;
543 $tmp = date_parse_from_format($out_format, $date);
546 if (!$tmp[
"error_count"] &&
547 !$tmp[
"warning_count"]) {
548 $format = $tmp[
"year"] .
"-" .
549 str_pad($tmp[
"month"], 2,
"0", STR_PAD_LEFT) .
"-" .
550 str_pad($tmp[
"day"], 2,
"0", STR_PAD_LEFT);
554 str_pad($tmp[
"hour"], 2,
"0", STR_PAD_LEFT) .
":" .
555 str_pad($tmp[
"minute"], 2,
"0", STR_PAD_LEFT) .
":" .
556 str_pad($tmp[
"second"], 2,
"0", STR_PAD_LEFT);
565 "date" => $return_date
567 "warnings" =>
sizeof($tmp[
"warnings"])
571 "errors" =>
sizeof($tmp[
"errors"])
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ parseIncomingDate()
static ilCalendarUtil::parseIncomingDate |
( |
|
$value, |
|
|
bool |
$add_time = false |
|
) |
| |
|
static |
Try to parse incoming value to date object.
- Parameters
-
- Returns
- ilDateTime|ilDate
Definition at line 583 of file class.ilCalendarUtil.php.
References null.
Referenced by ilDateTimeInputGUI\checkInput(), ilDclGenericMultiInputGUI\checkInput(), ilDateDurationInputGUI\checkInput(), ilAdvancedMDFieldDefinitionDate\getLuceneSearchString(), ilAdvancedMDFieldDefinitionDateTime\getLuceneSearchString(), ilSessionStatisticsGUI\importDate(), ilADTDateSearchBridgeSingle\importFromPost(), ilADTDateTimeSearchBridgeSingle\importFromPost(), ilADTDateSearchBridgeRange\importFromPost(), ilADTDateTimeSearchBridgeRange\importFromPost(), ilDclGenericMultiInputGUI\setValue(), ilDateTimeInputGUI\setValueByArray(), ilDateDurationInputGUI\setValueByArray(), ilCourseContentGUI\updateManagedTimings(), and ilCourseContentGUI\updatePersonalTimings().
588 } elseif (!trim($value)) {
593 $parsed = self::parseDateString($value, $add_time);
594 if (is_object($parsed[
'date'])) {
595 return $parsed[
'date'];
599 $format = $add_time ?
'Y-m-d H:i:s' :
'Y-m-d';
600 $parsed = self::parseDateString($value, $add_time, $format);
601 if (is_object($parsed[
'date'])) {
602 return $parsed[
'date'];
611 $parsed = self::parseDateString($value, $add_time, $format);
612 if (is_object($parsed[
'date'])) {
613 return $parsed[
'date'];
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ $default_calendar
array ilCalendarUtil::$default_calendar = array() |
|
staticprivate |
◆ $init_datetimepicker
bool ilCalendarUtil::$init_datetimepicker = false |
|
staticprotected |
◆ $init_done
string ilCalendarUtil::$init_done |
|
static |
◆ $today
The documentation for this class was generated from the following file: