コード例 #1
0
 protected function PopulateTemplate()
 {
     $currentInstance = $this->reservationSeries->CurrentInstance();
     $this->Set('UserName', $this->reservationOwner->FullName());
     $this->Set('StartDate', $currentInstance->StartDate()->ToTimezone($this->timezone));
     $this->Set('EndDate', $currentInstance->EndDate()->ToTimezone($this->timezone));
     $this->Set('ResourceName', $this->reservationSeries->Resource()->GetName());
     $this->Set('Title', $this->reservationSeries->Title());
     $this->Set('Description', $this->reservationSeries->Description());
     $repeatDates = array();
     if ($this->reservationSeries->IsRecurring()) {
         foreach ($this->reservationSeries->Instances() as $repeated) {
             $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
         }
     }
     $this->Set('RepeatDates', $repeatDates);
     $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
     $this->Set('ReservationUrl', sprintf("%s?%s=%s", Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber()));
     $this->Set('ICalUrl', sprintf("export/%s?%s=%s", Pages::CALENDAR_EXPORT, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber()));
     $resourceNames = array();
     foreach ($this->reservationSeries->AllResources() as $resource) {
         $resourceNames[] = $resource->GetName();
     }
     $this->Set('ResourceNames', $resourceNames);
     $this->Set('Accessories', $this->reservationSeries->Accessories());
     $attributes = $this->attributeRepository->GetByCategory(CustomAttributeCategory::RESERVATION);
     $attributeValues = array();
     foreach ($attributes as $attribute) {
         $attributeValues[] = new Attribute($attribute, $this->reservationSeries->GetAttributeValue($attribute->Id()));
     }
     $this->Set('Attributes', $attributeValues);
 }