ID = $ID."_"; $this->date = isset($Date) ? $Date: NULL; if (isset($_REQUEST[$this->UID('year')])) { $this->year = $_REQUEST[$this->UID('year')]; $this->month = $_REQUEST[$this->UID('month')]; $this->day = $_REQUEST[$this->UID('Day')]; } else { if (isset($Date)) { $DateComponents = explode("-",$Date); $this->year = $DateComponents[0]; $this->month = $DateComponents[1]; $this->day = isset($_REQUEST[$this->UID('Day')]) ? $_REQUEST[$this->UID('Day')] : $DateComponents[2]; } else { $this->year = date("Y"); $this->month = date("n"); $this->day = date("j"); } } } public function Value() { $returnValue=""; if (isset($_REQUEST[$this->UID('Day')])) { $returnValue = isset($this->day) ? $this->year.'-'.$this->month.'-'.$_REQUEST[$this->UID('Day')]: ''; } else if (isset($_REQUEST[$this->UID('calendar')])) { $returnValue = $_REQUEST[$this->UID('calendar')]; } else if (isset($this->date)) { $returnValue = isset($this->day) ? $this->year.'-'.$this->month.'-'.$this->day: ''; } return $returnValue; } // Render the calendar, and add it to a variable - needed for placing the object in a specific area in our output buffer public function Output() { $days = 0; $this->redirect = isset($this->redirect) ? $this->redirect: $_SERVER['PHP_SELF'] ; if ($this->year > 2037) $this->year = 2037; else if ($this->year < 1971) $this->year = 1971; $total_days = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year); $first_spaces = date("w", mktime(0, 0, 0, $this->month, 1, $this->year)); $currentday = $this->UID('Day'); if (isset($this->inForm)) { $CObjID = $this->UID('calendar'); $DateString = ($this->Value()) ? '","'.$this->Value() : ''; $this->output = ''."\n" .''."\n"; } else $this->output = ''; $NavUrls = $this->UrlParams($this->UID('year').','.$this->UID('month').','.$this->UID('Day')); if (($this->month+1) > 12) { $nextMonth = 1; $prevMonth = $this->month -1; $nextYear = $this->year + 1; $prevYear = $this->year; } else { $nextMonth = $this->month+1; $prevMonth = $this->month-1; if ($prevMonth == 0) { $prevMonth = 12; $prevYear = $this->year - 1; } else $prevYear = $this->year; $nextYear = $this->year; } $this->output.= ''; for ($Week=0;$Week<6;$Week++) { $this->output.= ''; for ($Day=0;$Day<7;$Day++) { $days++; $dDay = $days - $first_spaces; $CellID = $this->UID('item['.$days.']'); if ($days > $first_spaces && ($dDay) < $total_days + 1) { $LinkID = $this->UID('hlink['.$days.']'); $currentSelectedDay = ''; } else { $this->output.=''."\n"; } } $this->output.=""; } $this->output.= '
< '.date("F", mktime(0, 0, 0, $this->month, 1, $this->year)).' '.$this->year.' >
SMTWTFS
output.= $currentSelectedDay; else { $this->output.='currentDateStyle.'">normalDateStyle.'">output.= 'href="'.$this->redirect.'?'.$currentday.'='.$dDay.$this->UrlParams($currentday).'">'.$dDay.'
'; return $this->output; } } ?>