function build($events = array()) { /*include_once CALENDAR_ROOT . 'Day.php'; include_once CALENDAR_ROOT . 'Table/Helper.php'; $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay); $this->cE = & $this->getEngine(); $this->year = $this->thisYear(); $this->month = $this->thisMonth(); */ // require_once CALENDAR_ROOT.'Day.php'; include_once CALENDAR_ROOT . 'Table/Helper.php'; $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay); $this->cE =& $this->getEngine(); $this->year = $this->cE->stampToYear($this->calendar->thisWeek); $this->month = $this->cE->stampToMonth($this->calendar->thisWeek); $this->day = $this->cE->stampToDay($this->calendar->thisWeek); $end = $this->cE->getDaysInWeek($this->year, $this->month, $this->day); /* $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); for ($i=1; $i<=$daysInMonth; $i++) { $Day = new Calendar_Day(2000,1,1); // Create Day with dummy values $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); $this->children[$i] = new Event($Day); } */ for ($i = 1; $i <= $end; $i++) { $Day = new Calendar_Day(2000, 1, 1); // Create Day with dummy values $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $this->day++)); $this->children[$i] = new Event($Day); /* $stamp = $this->cE->dateToStamp($year, $month, $day++); $this->children[$i] = new Calendar_Day( $this->cE->stampToYear($stamp), $this->cE->stampToMonth($stamp), $this->cE->stampToDay($stamp)); */ } $this->calendar->children = $this->children; if (count($events) > 0) { $this->setSelection($events); } //set empty days (@see Calendar_Month_Weeks::build()) if ($this->calendar->firstWeek) { $eBefore = $this->tableHelper->getEmptyDaysBefore(); for ($i = 1; $i <= $eBefore; $i++) { $this->children[$i]->setEmpty(); } } if ($this->calendar->lastWeek) { $eAfter = $this->tableHelper->getEmptyDaysAfterOffset(); for ($i = $eAfter + 1; $i <= $end; $i++) { $this->children[$i]->setEmpty(); } } return true; }
function build($events = array()) { require_once CALENDAR_ROOT . 'Day.php'; require_once CALENDAR_ROOT . 'Table/Helper.php'; $this->tableHelper =& new Calendar_Table_Helper($this, $this->firstDay); $this->cE =& $this->getEngine(); $this->year = $this->thisYear(); $this->month = $this->thisMonth(); $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); for ($i = 1; $i <= $daysInMonth; $i++) { $Day = new Calendar_Day(2000, 1, 1); // Create Day with dummy values $Day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); $this->children[$i] = new DiaryEvent($Day); } if (count($events) > 0) { $this->setSelection($events); } Calendar_Month_Weekdays::buildEmptyDaysBefore(); Calendar_Month_Weekdays::shiftDays(); Calendar_Month_Weekdays::buildEmptyDaysAfter(); Calendar_Month_Weekdays::setWeekMarkers(); return true; }
/** * Returns the next weekday * @param string (default = 'int') return value format * @return int numeric day of week or timestamp * @access public */ function nextWeekDay($format = 'int') { $ts = $this->calendar->nextDay('timestamp'); $Day = new Calendar_Day(2000, 1, 1); $Day->setTimeStamp($ts); $day = $this->calendar->cE->getDayOfWeek($Day->thisYear(), $Day->thisMonth(), $Day->thisDay()); $day = $this->adjustWeekScale($day); return $this->returnValue('Day', $format, $ts, $day); }
/** * setSelection * * @access public * @return void */ public function setSelection() { $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); for ($i = 1; $i <= $daysInMonth; $i++) { $day = new Calendar_Day(2000, 1, 1); // Create Day with dummy values $day->setTimeStamp($this->cE->dateToStamp($this->year, $this->month, $i)); $this->children[$i] = new TimetableEvent($day); $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i + 1); foreach ($this->timetable->events as $event) { if ($stamp1 >= $event['start'] && $stamp1 < $event['end'] || $stamp2 > $event['start'] && $stamp2 <= $event['end'] || $stamp1 <= $event['start'] && $stamp2 >= $event['end']) { $this->children[$i]->addEntry($event); $this->children[$i]->setSelected(); } } } Calendar_Month_Weekdays::buildEmptyDaysBefore(); Calendar_Month_Weekdays::shiftDays(); Calendar_Month_Weekdays::buildEmptyDaysAfter(); Calendar_Month_Weekdays::setWeekMarkers(); }