private function getCalendar($w = 0, $community = null) { $old_error_level = error_reporting(); error_reporting($old_error_level & ~(E_STRICT | E_DEPRECATED)); include_once 'Calendar/Week.php'; $time = strtotime($w . ' week'); $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 1); $Week->build(); $dayofweek = array('class' => array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'), 'item' => array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')); $calendar = array(); $i = 0; while ($Day = $Week->fetch()) { $y = $Day->thisYear(); $m = $Day->thisMonth(); $d = $Day->thisDay(); $item = array('year' => $y, 'month' => $m, 'day' => $d, 'today' => 0 === $w && (int) date('d') === $d, 'dayofweek_class_name' => $dayofweek['class'][$i], 'dayofweek_item_name' => $dayofweek['item'][$i], 'holidays' => Doctrine::getTable('Holiday')->getByYearAndMonthAndDay($y, $m, $d)); if (null === $community) { // member home or profile home calendar. $item['births'] = $this->isSelf ? opCalendarPluginExtension::getScheduleBirthMemberByTargetDay($m, $d) : array(); $item['events'] = $this->isSelf ? opCalendarPluginExtension::getMyCommunityEventByTargetDay($y, $m, $d) : array(); $item['schedules'] = Doctrine::getTable('Schedule')->getScheduleByThisDayAndMember($y, $m, $d, $this->member); } else { // community home calendar. $item['events'] = array(); $item['schedules'] = array(); if ('all' === $this->calendar_show_flag || 'only_community_event' === $this->calendar_show_flag) { // only open to all sns member schedule. $item['events'] = opCalendarPluginExtension::getMyCommunityEventByTargetDayInCommunity($community, $y, $m, $d); } if ('all' === $this->calendar_show_flag || 'only_member_schedule' === $this->calendar_show_flag) { // only open to all sns member schedule. $item['schedules'] = Doctrine::getTable('Schedule')->getScheduleByThisDayAndMemberInCommunity($community, $y, $m, $d, $this->member); } } $calendar[$i++] = $item; } error_reporting($old_error_level); return $calendar; }