/** * Builds Calendar_Day objects for this Week * @param array (optional) Calendar_Day objects representing selected dates * @return boolean * @access public */ function build($sDates = array()) { require_once CALENDAR_ROOT . 'Day.php'; $year = $this->cE->stampToYear($this->thisWeek); $month = $this->cE->stampToMonth($this->thisWeek); $day = $this->cE->stampToDay($this->thisWeek); $end = $this->cE->getDaysInWeek($this->thisYear(), $this->thisMonth(), $this->thisDay()); for ($i = 1; $i <= $end; $i++) { $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)); } //set empty days (@see Calendar_Month_Weeks::build()) if ($this->firstWeek) { $eBefore = $this->tableHelper->getEmptyDaysBefore(); for ($i = 1; $i <= $eBefore; $i++) { $this->children[$i]->setEmpty(); } } if ($this->lastWeek) { $eAfter = $this->tableHelper->getEmptyDaysAfterOffset(); for ($i = $eAfter + 1; $i <= $end; $i++) { $this->children[$i]->setEmpty(); } } if (count($sDates) > 0) { $this->setSelection($sDates); } return true; }
function testGetEmptyDaysAfterOffset() { $Helper = new Calendar_Table_Helper($this->mockcal); $this->assertEqual($Helper->getEmptyDaysAfterOffset(), 5); }