24 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
49 if(!is_object(self::$today))
69 $month = $a_month < 10 ?
'0'.$a_month : $a_month;
71 return $a_long ? $lng->txt(
'month_'.$month.
'_long') : $lng->txt(
'month_'.$month.
'_short');
87 $lng->loadLanguageModule(
'dateplaner');
88 static $days = array(
'Su',
'Mo',
'Tu',
'We',
'Th',
'Fr',
'Sa',
'Su');
90 return $a_long ? $lng->txt($days[$a_day].
'_long') : $lng->txt($days[$a_day].
'_short');
104 include_once(
'Services/Calendar/classes/class.ilDateList.php');
109 $day_diff = $a_weekstart - $start_info[
'isoday'];
116 for($i = 1; $i < 7;$i++)
136 include_once(
'Services/Calendar/classes/class.ilDateList.php');
139 $prev_month = ($a_month == 1) ? 12 : $a_month - 1;
140 $prev_year = ($prev_month == 12) ? $a_year - 1 : $a_year;
141 $next_month = $a_month == 12 ? 1 : $a_month + 1;
142 $next_year = $a_month == 12 ? $a_year + 1 : $a_year;
147 $week_day[
'year'] = $a_year;
148 $week_day[
'mon'] = $a_month;
149 $week_day[
'mday'] = 1;
150 $week_day[
'hours'] = 0;
151 $week_day[
'minutes'] = 0;
155 $first_day_offset = (($weekday - $weekstart) < 0) ? 6 : $weekday - $weekstart;
158 for($i = 0;$i < 42;$i++)
161 if($i < $first_day_offset)
163 $day = $days_in_prev_month - $first_day_offset + $i + 1;
165 $day_list->add(
new ilDate(gmmktime(0,0,0,$prev_month,
166 $days_in_prev_month - $first_day_offset + $i + 1,
170 elseif($i < $days_in_month + $first_day_offset)
172 $day = $i - $first_day_offset + 1;
175 $day_list->add(
new ilDate(gmmktime(0,0,0,$a_month,
176 $i - $first_day_offset + 1,
182 $day = $i - $days_in_month - $first_day_offset + 1;
183 $day_list->add(
new ilDate(gmmktime(0,0,0,$next_month,
184 $i - $days_in_month - $first_day_offset + 1,
188 if($i == 34 and ($day < 15 or $day == $days_in_month))
203 if (self::$init_done ==
"done")
208 $lng->loadLanguageModule(
"jscalendar");
209 $tpl->addBlockFile(
"CALENDAR_LANG_JAVASCRIPT",
"calendar_javascript",
"tpl.calendar.html");
210 $tpl->setCurrentBlock(
"calendar_javascript");
211 $tpl->setVariable(
"FULL_SUNDAY", $lng->txt(
"l_su"));
212 $tpl->setVariable(
"FULL_MONDAY", $lng->txt(
"l_mo"));
213 $tpl->setVariable(
"FULL_TUESDAY", $lng->txt(
"l_tu"));
214 $tpl->setVariable(
"FULL_WEDNESDAY", $lng->txt(
"l_we"));
215 $tpl->setVariable(
"FULL_THURSDAY", $lng->txt(
"l_th"));
216 $tpl->setVariable(
"FULL_FRIDAY", $lng->txt(
"l_fr"));
217 $tpl->setVariable(
"FULL_SATURDAY", $lng->txt(
"l_sa"));
218 $tpl->setVariable(
"SHORT_SUNDAY", $lng->txt(
"s_su"));
219 $tpl->setVariable(
"SHORT_MONDAY", $lng->txt(
"s_mo"));
220 $tpl->setVariable(
"SHORT_TUESDAY", $lng->txt(
"s_tu"));
221 $tpl->setVariable(
"SHORT_WEDNESDAY", $lng->txt(
"s_we"));
222 $tpl->setVariable(
"SHORT_THURSDAY", $lng->txt(
"s_th"));
223 $tpl->setVariable(
"SHORT_FRIDAY", $lng->txt(
"s_fr"));
224 $tpl->setVariable(
"SHORT_SATURDAY", $lng->txt(
"s_sa"));
225 $tpl->setVariable(
"FULL_JANUARY", $lng->txt(
"l_01"));
226 $tpl->setVariable(
"FULL_FEBRUARY", $lng->txt(
"l_02"));
227 $tpl->setVariable(
"FULL_MARCH", $lng->txt(
"l_03"));
228 $tpl->setVariable(
"FULL_APRIL", $lng->txt(
"l_04"));
229 $tpl->setVariable(
"FULL_MAY", $lng->txt(
"l_05"));
230 $tpl->setVariable(
"FULL_JUNE", $lng->txt(
"l_06"));
231 $tpl->setVariable(
"FULL_JULY", $lng->txt(
"l_07"));
232 $tpl->setVariable(
"FULL_AUGUST", $lng->txt(
"l_08"));
233 $tpl->setVariable(
"FULL_SEPTEMBER", $lng->txt(
"l_09"));
234 $tpl->setVariable(
"FULL_OCTOBER", $lng->txt(
"l_10"));
235 $tpl->setVariable(
"FULL_NOVEMBER", $lng->txt(
"l_11"));
236 $tpl->setVariable(
"FULL_DECEMBER", $lng->txt(
"l_12"));
237 $tpl->setVariable(
"SHORT_JANUARY", $lng->txt(
"s_01"));
238 $tpl->setVariable(
"SHORT_FEBRUARY", $lng->txt(
"s_02"));
239 $tpl->setVariable(
"SHORT_MARCH", $lng->txt(
"s_03"));
240 $tpl->setVariable(
"SHORT_APRIL", $lng->txt(
"s_04"));
241 $tpl->setVariable(
"SHORT_MAY", $lng->txt(
"s_05"));
242 $tpl->setVariable(
"SHORT_JUNE", $lng->txt(
"s_06"));
243 $tpl->setVariable(
"SHORT_JULY", $lng->txt(
"s_07"));
244 $tpl->setVariable(
"SHORT_AUGUST", $lng->txt(
"s_08"));
245 $tpl->setVariable(
"SHORT_SEPTEMBER", $lng->txt(
"s_09"));
246 $tpl->setVariable(
"SHORT_OCTOBER", $lng->txt(
"s_10"));
247 $tpl->setVariable(
"SHORT_NOVEMBER", $lng->txt(
"s_11"));
248 $tpl->setVariable(
"SHORT_DECEMBER", $lng->txt(
"s_12"));
249 $tpl->setVariable(
"ABOUT_CALENDAR", $lng->txt(
"about_calendar"));
250 $tpl->setVariable(
"ABOUT_CALENDAR_LONG", $lng->txt(
"about_calendar_long"));
251 $tpl->setVariable(
"ABOUT_TIME_LONG", $lng->txt(
"about_time"));
252 $tpl->setVariable(
"PREV_YEAR", $lng->txt(
"prev_year"));
253 $tpl->setVariable(
"PREV_MONTH", $lng->txt(
"prev_month"));
254 $tpl->setVariable(
"GO_TODAY", $lng->txt(
"go_today"));
255 $tpl->setVariable(
"NEXT_MONTH", $lng->txt(
"next_month"));
256 $tpl->setVariable(
"NEXT_YEAR", $lng->txt(
"next_year"));
257 $tpl->setVariable(
"SEL_DATE", $lng->txt(
"select_date"));
258 $tpl->setVariable(
"DRAG_TO_MOVE", $lng->txt(
"drag_to_move"));
259 $tpl->setVariable(
"PART_TODAY", $lng->txt(
"part_today"));
260 $tpl->setVariable(
"DAY_FIRST", $lng->txt(
"day_first"));
261 $tpl->setVariable(
"CLOSE", $lng->txt(
"close"));
262 $tpl->setVariable(
"TODAY", $lng->txt(
"today"));
263 $tpl->setVariable(
"TIME_PART", $lng->txt(
"time_part"));
264 $tpl->setVariable(
"DEF_DATE_FORMAT", $lng->txt(
"def_date_format"));
265 $tpl->setVariable(
"TT_DATE_FORMAT", $lng->txt(
"tt_date_format"));
266 $tpl->setVariable(
"WK", $lng->txt(
"wk"));
267 $tpl->setVariable(
"TIME", $lng->txt(
"time"));
268 $tpl->parseCurrentBlock();
269 $tpl->setCurrentBlock(
"CalendarJS");
270 $tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR",
"./Services/Calendar/js/calendar.js");
271 $tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR_SETUP",
"./Services/Calendar/js/calendar-setup.js");
272 $tpl->setVariable(
"LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET",
"./Services/Calendar/css/calendar.css");
273 $tpl->parseCurrentBlock();
275 self::$init_done =
"done";
289 'Pacific/Samoa' =>
'GMT-11: Midway Islands, Samoa',
290 'US/Hawaii' =>
'GMT-10:00: Hawaii, Polynesia',
291 'US/Alaska' =>
'GMT-9:00: Alaska',
292 'America/Los_Angeles' =>
'GMT-8:00: Tijuana, Los Angeles, Seattle, Vancouver',
293 'US/Arizona' =>
'GMT-7:00: Arizona',
294 'America/Chihuahua' =>
'GMT-7:00: Chihuahua, La Paz, Mazatlan',
295 'America/Denver' =>
'GMT-7:00: Arizona, Denver, Salt Lake City, Calgary',
296 'America/Chicago' =>
'GMT-6:00: Chicago, Dallas, Kansas City, Winnipeg',
297 'America/Monterrey' =>
'GMT-6:00: Guadalajara, Mexico City, Monterrey',
298 'Canada/Saskatchewan' =>
'GMT-6:00: Saskatchewan',
299 'US/Central' =>
'GMT-6:00: Central America',
300 'America/Bogota' =>
'GMT-5:00: Bogota, Lima, Quito',
301 'US/East-Indiana' =>
'GMT-5:00: East-Indiana',
302 'America/New_York' =>
'GMT-5:00: New York, Miami, Atlanta, Detroit, Toronto',
303 'Canada/Atlantic' =>
'GMT-4:00: Atlantic (Canada)',
304 'America/La_Paz' =>
'GMT-4:00: Carcas, La Paz',
305 'America/Santiago' =>
'GMT-4:00: Santiago',
306 'Canada/Newfoundland' =>
'GMT-3:00: Newfoundland',
307 'Brazil/East' =>
'GMT-3:00: Sao Paulo',
308 'America/Argentina/Buenos_Aires' =>
'GMT-3:00: Buenes Aires, Georgtown',
309 'Etc/GMT+3' =>
'GMT-3:00: Greenland, Uruguay, Surinam',
310 'Atlantic/Cape_Verde' =>
'GMT-2:00: Cape Verde, Greenland, South Georgia',
311 'Atlantic/Azores' =>
'GMT-1:00: Azores',
312 'Africa/Casablanca' =>
'GMT+0:00: Casablanca, Monrovia',
313 'Europe/London' =>
'GMT+0:00: Dublin, Edinburgh, Lisbon, London',
314 'Europe/Berlin' =>
'GMT+1:00: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
315 'Europe/Belgrade' =>
'GMT+1:00: Belgrade, Bratislava, Budapest, Ljubljana, Prague',
316 'Europe/Paris' =>
'GMT+1:00: Brussels, Copenhagen, Paris, Madrid',
317 'Europe/Sarajevo' =>
'GMT+1:00: Sarajevo, Skopje, Warsaw, Zagreb',
318 'Africa/Lagos' =>
'GMT+1:00: West-Central Africa',
319 'Europe/Athens' =>
'GMT+2:00: Athens, Beirut, Istanbul, Minsk',
320 'Europe/Bucharest' =>
'GMT+2:00: Bucharest',
321 'Africa/Harare' =>
'GMT+2:00: Harare, Pratoria',
322 'Europe/Helsinki' =>
'GMT+2:00: Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius',
323 'Asia/Jerusalem' =>
'GMT+2:00: Jerusalem',
324 'Africa/Cairo' =>
'GMT+2:00: Cairo',
325 'Asia/Baghdad' =>
'GMT+3:00: Baghdad',
326 'Asia/Kuwait' =>
'GMT+3:00: Kuwait, Riyadh',
327 'Europe/Moscow' =>
'GMT+3:00: Moscow, Saint Petersburg',
328 'Africa/Nairobi' =>
'GMT+3:00: Nairobi,Teheran',
329 'Asia/Muscat' =>
'GMT+4:00: Abu Dhabi, Muscat',
330 'Asia/Baku' =>
'GMT+4:00: Baku, Tbilisi, Erivan',
331 'Asia/Kabul' =>
'GMT+4:00: Kabul',
332 'Asia/Karachi' =>
'GMT+5:00: Islamabad, Karachi, Taschkent',
333 'Asia/Yekaterinburg' =>
'GMT+5:00: Yekaterinburg',
334 'Asia/Calcutta' =>
'GMT+5:30: New Dehli',
335 'Asia/Katmandu' =>
'GMT+5:45: Katmandu',
336 'Asia/Novosibirsk' =>
'GMT+6:00: Almaty, Novosibirsk',
337 'Asia/Dhaka' =>
'GMT+6:00: Astana, Dhaka',
338 'Asia/Rangoon' =>
'GMT+6:00: Sri Jayawardenepura, Rangoon',
339 'Asia/Jakarta' =>
'GMT+7:00: Bangkok, Hanoi, Jakarta',
340 'Asia/Krasnoyarsk' =>
'GMT+7:00: Krasnoyarsk',
341 'Asia/Irkutsk' =>
'GMT+8:00: Irkutsk, Ulan Bator',
342 'Asia/Singapore' =>
'GMT+8:00: Kuala Lumpour, Singapore',
343 'Asia/Hong_Kong' =>
'GMT+8:00: Beijing, Chongqing, Hong kong, Urumchi',
344 'Australia/Perth' =>
'GMT+8:00: Perth',
345 'Asia/Taipei' =>
'GMT+8:00: Taipei',
346 'Asia/Yakutsk' =>
'GMT+9:00: Yakutsk',
347 'Asia/Tokyo' =>
'GMT+9:00: Osaka, Sapporo, Tokyo',
348 'Asia/Seoul' =>
'GMT+9:00: Seoul, Darwin, Adelaide',
349 'Australia/Brisbane' =>
'GMT+10:00: Brisbane',
350 'Australia/Sydney' =>
'GMT+10:00: Canberra, Melbourne, Sydney',
351 'Pacific/Guam' =>
'GMT+10:00: Guam, Port Moresby',
352 'Australia/Hobart' =>
'GMT+10:00: Hobart',
353 'Asia/Vladivostok' =>
'GMT+10:00: Vladivostok',
354 'Asia/Magadan' =>
'GMT+11:00: Salomon Islands, New Caledonia, Magadan',
355 'Pacific/Auckland' =>
'GMT+12:00: Auckland, Wellington',
356 'Pacific/Fiji' =>
'GMT+12:00: Fiji, Kamchatka, Marshall-Islands');
374 if($a_year % 100 == 0)
397 if(@function_exists(
'cal_days_in_month'))
399 return cal_days_in_month(CAL_GREGORIAN,$a_month,$a_year);
401 $months = array(0,31,
402 self::_isLeapYear($a_year) ? 29 : 28,
403 31,30,31,30,31,31,30,31,30,31);
404 return $months[(int) $a_month];
417 if(strpos($a_html_color_code,
'#') !== 0 or strlen($a_html_color_code) != 7)
421 $hex = str_replace(
'#',
'0x',$a_html_color_code);
423 return hexdec($hex) > 8000000 ?
'#000000' :
'#FFFFFF';
436 for($i = 0; $i < 24; $i++)
438 $options[$i] = sprintf(
'%02d:00',$i);
443 for($i = 0; $i < 24; $i++)
445 $options[$i] = date(
'h a',mktime($i,0,0,1,1,2000));
449 return $options ? $options : array();