Inheritance: extends Horde_Date_Repeater
Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 public function testNextPast()
 {
     $mondays = new Horde_Date_Repeater_DayName('monday');
     $mondays->now = $this->now;
     $span = $mondays->next('past');
     $this->assertEquals('2006-08-14', $span->begin->format('Y-m-d'));
     $this->assertEquals('2006-08-15', $span->end->format('Y-m-d'));
     $span = $mondays->next('past');
     $this->assertEquals('2006-08-07', $span->begin->format('Y-m-d'));
     $this->assertEquals('2006-08-08', $span->end->format('Y-m-d'));
 }
Exemplo n.º 3
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)));
     }
 }