コード例 #1
0
ファイル: yearevent.php プロジェクト: godboko/modules
 function build($events = array(), $firstDay = null)
 {
     $this->year = $this->calendar->year;
     require_once CALENDAR_ROOT . 'Factory.php';
     $this->calendar->firstDay = $this->calendar->defineFirstDayOfWeek($firstDay);
     $monthsInYear = $this->calendar->cE->getMonthsInYear($this->calendar->thisYear());
     for ($i = 1; $i <= $monthsInYear; $i++) {
         $month = Calendar_Factory::create('Month', $this->year, $i);
         $MonthDecorator = new MonthEvent_Decorator($month);
         $MonthDecorator->build($events);
         $this->children[$i] = $MonthDecorator->calendar;
     }
     $this->calendar->children = $this->children;
     return true;
 }
コード例 #2
0
ファイル: calendardisplay.php プロジェクト: godboko/modules
 public function setup($timeframe, $role_id)
 {
     $data = xarMod::apiFunc('calendar', 'user', 'getUserDateTimeInfo');
     switch ($timeframe) {
         case 'week':
             $WeekEvents = new Calendar_Week($data['cal_year'], $data['cal_month'], $data['cal_day'], CALENDAR_FIRST_DAY_OF_WEEK);
             $start_time = $WeekEvents->thisWeek;
             $end_time = $WeekEvents->nextWeek;
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $WeekDecorator = new WeekEvent_Decorator($WeekEvents);
             $WeekDecorator->build($events);
             $data['Week'] =& $WeekDecorator;
             $data['cal_sdow'] = CALENDAR_FIRST_DAY_OF_WEEK;
             break;
         case 'month':
             $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'] + 1, xarModVars::get('calendar', 'cal_sdow'));
             $end_time = $MonthEvents->getTimestamp();
             $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'], xarModVars::get('calendar', 'cal_sdow'));
             $start_time = $MonthEvents->getTimestamp();
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $MonthDecorator = new MonthEvent_Decorator($MonthEvents);
             $MonthDecorator->build($events);
             $data['Month'] =& $MonthDecorator;
             break;
         case 'year':
             $Year = new Calendar_Year($data['cal_year'] + 1);
             $end_time = $Year->getTimestamp();
             $Year = new Calendar_Year($data['cal_year']);
             $start_time = $Year->getTimestamp();
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $YearDecorator = new YearEvent_Decorator($Year);
             $YearDecorator->build($events);
             $data['Year'] =& $YearDecorator->calendar;
             $data['cal_sdow'] = CALENDAR_FIRST_DAY_OF_WEEK;
             break;
     }
     return $data;
 }