73 $this->iDay = date(
'd');
75 $this->sMonthName =
_t($aMonths[(
int)$this->iMonth]);
77 $this->iNumDaysInMonth = date(
't', mktime(0, 0, 0, $this->iMonth+1, $iDay, $this->iYear));
78 $this->iFirstWeekDay = (int)date(
'w', mktime(0, 0, 0, $this->iMonth, 1, $this->iYear));
82 $this->iPrevMonth = $this->iMonth - 1;
83 if ( $this->iPrevMonth <= 0 ) {
84 $this->iPrevMonth = 12;
89 $this->iNextMonth = $this->iMonth + 1;
90 if ( $this->iNextMonth > 12 ) {
91 $this->iNextMonth = 1;
96 list ($this->iWeekStart, $this->iWeekEnd) = (
getParam(
'sys_calendar_starts_sunday') ==
'on') ? array (0, 7) : array (1, 8);
97 if ($this->iFirstWeekDay < $this->iWeekStart)
98 $this->iFirstWeekDay = $this->iWeekEnd-1;
106 if(0 == $this->iWeekStart)
107 $aWeek[] = array(
'name' =>
_t(
'_week_sun' . $sPostfix));
108 $aWeek[] = array(
'name' =>
_t(
'_week_mon' . $sPostfix));
109 $aWeek[] = array(
'name' =>
_t(
'_week_tue' . $sPostfix));
110 $aWeek[] = array(
'name' =>
_t(
'_week_wed' . $sPostfix));
111 $aWeek[] = array(
'name' =>
_t(
'_week_thu' . $sPostfix));
112 $aWeek[] = array(
'name' =>
_t(
'_week_fri' . $sPostfix));
113 $aWeek[] = array(
'name' =>
_t(
'_week_sat' . $sPostfix));
114 if(8 == $this->iWeekEnd)
115 $aWeek[] = array(
'name' =>
_t(
'_week_sun' . $sPostfix));
123 $aCalendar = array ();
125 foreach ($aEvents
as $a) {
126 $aCalendar[$a[
'Day']] += 1;
130 $aCalendarGrid = array ();
132 for ($i = 0; $i < 6; $i++) {
134 if ($this->iFirstWeekDay == $j || $i > 0 || $iCurrentDay > 0) {
136 if ($iCurrentDay > $this->iNumDaysInMonth)
break 2;
137 $aCalendarGrid[$i][$j][
'day'] = $iCurrentDay;
138 $aCalendarGrid[$i][$j][
'today'] = ($this->iYear == date(
'Y') && $this->iMonth == date(
'm') && $iCurrentDay == $this->iDay);
139 $aCalendarGrid[$i][$j][
'num'] = isset($aCalendar[$iCurrentDay]) && $aCalendar[$iCurrentDay] > 0 ? $aCalendar[$iCurrentDay] :
'';
152 for ($i = 0; $i < 6; $i++) {
154 $aRow = array (
'ch_repeat:cell');
161 if ($aCalendarGrid[$i][$j][
'today']) {
162 $aCell[
'class'] =
'sys_cal_cell sys_cal_today';
163 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
164 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
165 'num' => $aCalendarGrid[$i][$j][
'num'],
166 'href' => $sBrowseUri . $this->iYear .
'/' . $this->iMonth .
'/' . $aCell[
'day'],
167 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
170 } elseif (isset($aCalendarGrid[$i][$j][
'day'])) {
171 $aCell[
'class'] =
'sys_cal_cell';
172 $aCell[
'day'] = $aCalendarGrid[$i][$j][
'day'];
173 $aCell[
'ch_if:num'] = array (
'condition' => $aCalendarGrid[$i][$j][
'num'],
'content' => array(
174 'num' => $aCalendarGrid[$i][$j][
'num'],
175 'href' => $sBrowseUri . $this->iYear .
'/' . $this->iMonth .
'/' . $aCell[
'day'],
176 'entries' => 1 == $aCalendarGrid[$i][$j][
'num'] ? $sEntriesSingle : $sEntriesMul,
180 $aCell[
'class'] =
'sys_cal_cell_blank';
182 $aCell[
'ch_if:num'] = array (
'condition' =>
false,
'content' => array(
190 $aRow[
'ch_repeat:cell'][] = $aCell;
193 if ($aRow[
'ch_repeat:cell'] && !$isRowEmpty) {
249 return CH_WSB_URL_ROOT;
271 return array(
_t(
'_item'),
_t(
'_items'));
279 return $this->
getBaseUri () . ($isNextMoths ?
"{$this->iNextYear}/{$this->iNextMonth}" :
"{$this->iPrevYear}/{$this->iPrevMonth}");