Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
event * @var array */ private $events = array(); /** * Events already set? * @var boolean */ private $eventsSet = false; // ################################################################### /** * Constructor * * @param integer The start day * @param integer Month (numeric) * @param integer Year (4-digit) */ public function __construct($startDay, $month, $year) { $this->nextDay = $startDay; $this->stopDay = $startDay + 6; $this->month = $month; $this->year = $year; } // ################################################################### /** * Gets the calendar's month * * @return integer Month number */ public function getMonth() { return $this->month; } // ################################################################### /** * Gets the calendar's year * * @return integer Year (four-digit) */ public function getYear() { return $this->year; } // ################################################################### /** * Sets the displayed start day of the week * * @param integer Day of the week to start on */ public function setWeekStartDay($startdow) { $this->weekStartDay = $startdow; } // ################################################################### /** * Sets the entire events table and prevents any other events to be * fetched. * * @param array Events table */ public function setEvents($events) { $this->events = $events; $this->eventsSet = true; } // ################################################################### /** * Calls a series of internal routines to generate all the calendar * HTML and process data. */ public function generate() { if (!$this->eventsSet) { $this->_getEvents(); } } // ################################################################### /** * Returns the next day number to render, INT for valid, -1 for blank * * @return integer The day number to print, -1 for an empty day */ public function getNextDay() { if ($this->nextDay > $this->stopDay) { return false; } if ($this->nextDay < 1) { // TODO - we can use CalendarDay to grab events from previous months here $this->nextDay++; return -1; } else if ($this->nextDay > $this->_getDaysInMonth()) { // TODO - we can use CalendarDay to grab events from previous months here $this->nextDay++; return -1; } else { $day = new CalendarDay($this->nextDay, $this->month, $this->year); $day->setEvents($this->events[ $this->nextDay ]); $day->generate(); $this->nextDay++; return $day; } } // ################################################################### /** * Gets the number of days in the current month * * @return integer Number of days in the month */ private function _getDaysInMonth() { return gmdate('t', gmmktime(0, 0, 0, $this->month, 1, $this->year)); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>