public function IsSegment($segment) { switch ($segment) { case "today": return $this->startDate->date() == $this->endDate->date(); case "week": if (CalendarUtil::get_first_day_of_week() == sfTime::MONDAY) { return $this->startDate->format('w') == sfTime::MONDAY && $this->startDate->format('w') == sfTime::SUNDAY; } return $this->startDate->format('w') == sfTime::SUNDAY && $this->endDate->format('w') == sfTime::SATURDAY; case "month": return $this->startDate->format('j') == 1 && sfDate::getInstance($this->startDate)->finalDayOfMonth()->format('j') == $this->endDate->format('j'); case "weekend": return $this->startDate->format('w') == sfTime::FRIDAY && $this->endDate->format('w') == sfTime::SUNDAY; } }