|
@@ -0,0 +1,43 @@
|
|
|
+# event_school_calendar
|
|
|
+
|
|
|
+if $ARGS[0] = 'schoolMode':
|
|
|
+
|
|
|
+ gs 'event_school_calendar','schoolModeCalculate'
|
|
|
+
|
|
|
+ _dayOfWeek_esc = FUNC('util_time','dayOfWeek',time_current)
|
|
|
+
|
|
|
+ if time_current >= school_calendar['vacation_summer_start'] and time_current < school_calendar['vacation_summer_end']:
|
|
|
+ $RESULT = 'vacation_summer'
|
|
|
+ elseif (time_current >= school_calendar['vacation_xmas_start'] and time_current < school_calendar['vacation_xmas_end_nextYear']) or time_current < school_calendar['vacation_xmas_end_thisYear']:
|
|
|
+ $RESULT = 'vacation_xmas'
|
|
|
+
|
|
|
+ elseif _dayOfWeek_esc = 5 or _dayOfWeek_esc = 6:
|
|
|
+ $RESULT = 'weekend'
|
|
|
+ else:
|
|
|
+ $RESULT = 'schoolday'
|
|
|
+ end
|
|
|
+
|
|
|
+elseif $ARGS[0] = 'schoolModeCalculate':
|
|
|
+ gs 'util_time','timeInfo_load',time_current
|
|
|
+ _year = time_year
|
|
|
+ if school_calendar_calculatedYear ! _year:
|
|
|
+
|
|
|
+ school_calendar['vacation_summer_start'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,7,3),5)
|
|
|
+ school_calendar['vacation_summer_end'] = school_calendar['vacation_summer_start'] + (6 * 7 + 2) * 86400
|
|
|
+
|
|
|
+ *PL FUNC('util_time','time2date',school_calendar['vacation_summer_start'])
|
|
|
+ *PL FUNC('util_time','time2date',school_calendar['vacation_summer_end'])
|
|
|
+
|
|
|
+ school_calendar['vacation_xmas_start'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,12,24) - 6 * 86400,5)
|
|
|
+ school_calendar['vacation_xmas_end_nextYear'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year+1,1,2),0)
|
|
|
+ school_calendar['vacation_xmas_end_thisYear'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,1,2),0)
|
|
|
+
|
|
|
+ *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_start'])
|
|
|
+ *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_end_thisYear'])
|
|
|
+ *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_end_nextYear'])
|
|
|
+
|
|
|
+ school_calendar_calculatedYear = _year
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+-
|