예제 #1
0
파일: group.php 프로젝트: ratbird/hope
 public function month_action($range_id = null)
 {
     $this->range_id = $range_id ?: $this->range_id;
     $month_start = mktime(12, 0, 0, date('n', $this->atime), 1, date('Y', $this->atime));
     $month_end = mktime(12, 0, 0, date('n', $this->atime), date('t', $this->atime), date('Y', $this->atime));
     $adow = strftime('%u', $month_start) - 1;
     $cor = date('n', $this->atime) == 3 ? 1 : 0;
     $this->first_day = $month_start - $adow * 86400;
     $this->last_day = ((42 - ($adow + date('t', $this->atime))) % 7 + $cor) * 86400 + $month_end;
     // one calendar each day for the actual user
     for ($start_day = $this->first_day; $start_day <= $this->last_day; $start_day += 86400) {
         $this->calendars[0][] = SingleCalendar::getDayCalendar($GLOBALS['user']->id, $start_day);
     }
     // check and get the group
     $group = $this->getGroup($this->calendars[0][0]);
     $n = 1;
     // get the calendars of the group members
     foreach ($group->members as $member) {
         $calendar = new SingleCalendar($member->user_id);
         if ($calendar->havePermission(Calendar::PERMISSION_READABLE)) {
             for ($start_day = $this->first_day; $start_day <= $this->last_day; $start_day += 86400) {
                 $this->calendars[$n][] = SingleCalendar::getDayCalendar($member->user_id, $start_day);
             }
             $n++;
         }
     }
     PageLayout::setTitle($this->getTitle($group) . ' - ' . _('Monatssicht'));
     Navigation::activateItem('/calendar/calendar');
     $this->last_view = 'month';
     $this->createSidebar('month');
     $this->createSidebarFilter();
 }
예제 #2
0
파일: single.php 프로젝트: ratbird/hope
 public function month_action($range_id = null)
 {
     $this->range_id = $range_id ?: $this->range_id;
     $month_start = mktime(12, 0, 0, date('n', $this->atime), 1, date('Y', $this->atime));
     $month_end = mktime(12, 0, 0, date('n', $this->atime), date('t', $this->atime), date('Y', $this->atime));
     $adow = strftime('%u', $month_start) - 1;
     $cor = date('n', $this->atime) == 3 ? 1 : 0;
     $this->first_day = $month_start - $adow * 86400;
     $this->last_day = ((42 - ($adow + date('t', $this->atime))) % 7 + $cor) * 86400 + $month_end;
     for ($start_day = $this->first_day; $start_day <= $this->last_day; $start_day += 86400) {
         $this->calendars[] = SingleCalendar::getDayCalendar($this->range_id, $start_day, null, $this->restrictions);
     }
     PageLayout::setTitle($this->getTitle($this->calendars[0], _('Monatsansicht')));
     $this->last_view = 'month';
     $this->createSidebar('month', $this->calendars[0]);
     $this->createSidebarFilter();
 }