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); //Dummy date $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; } function setSelection($events) { $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month); for ($i=1; $i<=$daysInMonth; $i++) { $stamp1 = $this->cE->dateToStamp($this->year, $this->month, $i); $stamp2 = $this->cE->dateToStamp($this->year, $this->month, $i+1); foreach ($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(); } } } } function fetch() { $child = each($this->children); if ($child) { return $child['value']; } else { reset($this->children); return false; } } } ?>