this() 공개 메소드

public this ( $pointer = 'future' )
예제 #1
0
파일: Week.php 프로젝트: jubinpatel/horde
 public function this($pointer = 'future')
 {
     parent::this($pointer);
     switch ($pointer) {
         case 'future':
             $thisWeekStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
             $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
             $sundayRepeater->now = $this->now;
             $thisSundaySpan = $sundayRepeater->this('future');
             $thisWeekEnd = $thisSundaySpan->begin;
             return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
         case 'past':
             $thisWeekEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
             $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
             $sundayRepeater->now = $this->now;
             $lastSundaySpan = $sundayRepeater->next('past');
             $thisWeekStart = $lastSundaySpan->begin;
             return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
         case 'none':
             $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
             $sundayRepeater->now = $this->now;
             $lastSundaySpan = $sundayRepeater->next('past');
             $thisWeekStart = $lastSundaySpan->begin;
             $thisWeekEnd = clone $thisWeekStart;
             $thisWeekEnd->day += 7;
             return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
     }
 }
예제 #2
0
 public function this($pointer = 'future')
 {
     parent::this($pointer);
     switch ($pointer) {
         case 'future':
         case 'none':
             $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
             $saturdayRepeater->now = $this->now;
             $thisSaturdaySpan = $saturdayRepeater->this('future');
             return new Horde_Date_Span($thisSaturdaySpan->begin, $thisSaturdaySpan->begin->add(array('day' => 2)));
         case 'past':
             $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
             $saturdayRepeater->now = $this->now;
             $lastSaturdaySpan = $saturdayRepeater->this('past');
             return new Horde_Date_Span($lastSaturdaySpan->begin, $lastSaturdaySpan->begin->add(array('day' => 2)));
     }
 }