public function testCreatesSerializableLayout()
 {
     $baseDate = Date::Now();
     $b1 = $baseDate->AddDays(1);
     $e1 = $baseDate->AddDays(2);
     $b2 = $baseDate->AddDays(3);
     $e2 = $baseDate->AddDays(4);
     $b3 = $baseDate->AddDays(5);
     $e3 = $baseDate->AddDays(6);
     $b4 = $baseDate->AddDays(7);
     $e4 = $baseDate->AddDays(8);
     $l1 = 'label 1';
     $l2 = 'label 2';
     $p1 = new SchedulePeriod($b1, $e1);
     $p2 = new NonSchedulePeriod($b2, $e2);
     $p3 = new SchedulePeriod($b3, $e3, $l1);
     $p4 = new NonSchedulePeriod($b4, $e4, $l2);
     $periods = array($p1, $p2, $p3, $p4);
     $actual = new ScheduleLayoutSerializable($periods);
     $actualPeriods = $actual->periods;
     $this->assertEquals(count($periods), count($actualPeriods));
     $this->assertEquals($p1->Begin()->__toString(), $actualPeriods[0]->begin);
     $this->assertEquals($p1->End()->__toString(), $actualPeriods[0]->end);
     $this->assertEquals($p1->BeginDate()->__toString(), $actualPeriods[0]->beginDate);
     $this->assertEquals($p1->EndDate()->__toString(), $actualPeriods[0]->endDate);
     $this->assertEquals($p1->Label(), $actualPeriods[0]->label);
     $this->assertEquals($p1->LabelEnd(), $actualPeriods[0]->labelEnd);
     $this->assertEquals($p1->IsReservable(), $actualPeriods[0]->isReservable);
     $this->assertEquals($p2->Begin()->__toString(), $actualPeriods[1]->begin);
     $this->assertEquals($p2->End()->__toString(), $actualPeriods[1]->end);
     $this->assertEquals($p2->Label(), $actualPeriods[1]->label);
     $this->assertEquals($p2->LabelEnd(), $actualPeriods[1]->labelEnd);
     $this->assertEquals($p2->IsReservable(), $actualPeriods[1]->isReservable);
 }
예제 #2
0
 public function __construct(SchedulePeriod $period)
 {
     $this->begin = $period->Begin()->__toString();
     $this->end = $period->End()->__toString();
     $this->beginDate = $period->BeginDate()->__toString();
     $this->endDate = $period->EndDate()->__toString();
     $this->isReservable = $period->IsReservable();
     $this->label = $period->Label();
     $this->labelEnd = $period->LabelEnd();
 }
예제 #3
0
 public function __construct(SchedulePeriod $begin, SchedulePeriod $end, Date $displayDate, $isReservable)
 {
     $this->_begin = $begin->BeginDate();
     $this->_end = $end->EndDate();
     $this->_date = $displayDate;
     $this->_isReservable = $isReservable;
     $this->_beginDisplayTime = $this->_begin->GetTime();
     if (!$this->_begin->DateEquals($displayDate)) {
         $this->_beginDisplayTime = $displayDate->GetDate()->GetTime();
     }
     $this->_endDisplayTime = $this->_end->GetTime();
     if (!$this->_end->DateEquals($displayDate)) {
         $this->_endDisplayTime = $displayDate->GetDate()->GetTime();
     }
     $this->_beginSlotId = $begin->Id();
     $this->_endSlotId = $end->Id();
     $this->_beginPeriod = $begin;
     $this->_endPeriod = $end;
 }
예제 #4
0
 public function __construct(SchedulePeriod $schedulePeriod)
 {
     $this->start = $schedulePeriod->BeginDate()->ToIso();
     $this->end = $schedulePeriod->EndDate()->ToIso();
     $this->label = $schedulePeriod->Label();
     $this->startTime = $schedulePeriod->Begin()->ToString();
     $this->endTime = $schedulePeriod->End()->ToString();
     $this->isReservable = $schedulePeriod->IsReservable();
 }
예제 #5
0
 public function ToTimezone($timezone)
 {
     return new BlackoutSlot($this->_beginPeriod->ToTimezone($timezone), $this->_endPeriod->ToTimezone($timezone), $this->Date(), $this->PeriodSpan(), $this->blackout);
 }
예제 #6
0
 public function Add(SchedulePeriod $period)
 {
     if ($this->AlreadyAdded($period->BeginDate(), $period->EndDate())) {
         return;
     }
     $this->items[] = $period;
 }
예제 #7
0
 public function ToTimezone($timezone)
 {
     return new ReservationSlot($this->_beginPeriod->ToTimezone($timezone), $this->_endPeriod->ToTimezone($timezone), $this->Date(), $this->PeriodSpan(), $this->_reservation);
 }
예제 #8
0
 public function __construct(SchedulePeriod $period, $span = 1)
 {
     $this->span = $span;
     $this->period = $period;
     parent::__construct($period->BeginDate(), $period->EndDate(), $period->_label);
 }