Esempio n. 1
0
 /**
  * @param IRestServer $server
  * @param BookableResource $resource
  * @param IEntityAttributeList $attributes
  */
 public function __construct(IRestServer $server, $resource, $attributes)
 {
     $resourceId = $resource->GetId();
     $this->resourceId = $resourceId;
     $this->name = $resource->GetName();
     $this->location = $resource->GetLocation();
     $this->contact = $resource->GetContact();
     $this->notes = $resource->GetNotes();
     $this->maxLength = $resource->GetMaxLength()->__toString();
     $this->minLength = $resource->GetMinLength()->__toString();
     $this->maxNotice = $resource->GetMaxNotice()->__toString();
     $this->minNotice = $resource->GetMinNotice()->__toString();
     $this->requiresApproval = $resource->GetRequiresApproval();
     $this->allowMultiday = $resource->GetAllowMultiday();
     $this->maxParticipants = $resource->GetMaxParticipants();
     $this->description = $resource->GetDescription();
     $this->scheduleId = $resource->GetScheduleId();
     $this->statusId = $resource->GetStatusId();
     $this->statusReasonId = $resource->GetStatusReasonId();
     $this->bufferTime = $resource->GetBufferTime()->__toString();
     $attributeValues = $attributes->GetAttributes($resourceId);
     $i = 0;
     foreach ($attributeValues as $av) {
         $this->customAttributes[] = new CustomAttributeResponse($server, $av->Id(), $av->Label(), $av->Value());
         $i++;
     }
     if ($resource->GetIsCalendarSubscriptionAllowed()) {
         $url = new CalendarSubscriptionUrl(null, null, $resource->GetPublicId());
         $this->icsUrl = $url->__toString();
     }
     $this->AddService($server, WebServices::GetResource, array(WebServiceParams::ResourceId => $resourceId));
 }
Esempio n. 2
0
 /**
  * @param IRestServer $server
  * @param BookableResource $resource
  */
 public function __construct(IRestServer $server, $resource)
 {
     $this->resourceId = $resource->GetId();
     $this->name = $resource->GetName();
     $this->scheduleId = $resource->GetScheduleId();
     $this->statusId = $resource->GetStatusId();
     $this->statusReasonId = $resource->GetStatusReasonId();
     $this->AddService($server, WebServices::GetResource, array(WebServiceParams::ResourceId => $this->resourceId));
     $this->AddService($server, WebServices::GetSchedule, array(WebServiceParams::ScheduleId => $this->scheduleId));
 }
Esempio n. 3
0
 public function BindResource(BookableResource $resource)
 {
     $this->Set('resourceName', $resource->GetName());
     $this->Set('description', $resource->GetDescription());
     $this->Set('notes', $resource->GetNotes());
     $this->Set('contactInformation', $resource->GetContact());
     $this->Set('locationInformation', $resource->GetLocation());
     $this->Set('allowMultiday', $resource->GetAllowMultiday());
     $this->Set('minimumDuration', $resource->GetMinLength());
     $this->Set('maximumDuration', $resource->GetMaxLength());
     $this->Set('maxParticipants', $resource->GetMaxParticipants());
     $this->Set('maximumNotice', $resource->GetMaxNotice());
     $this->Set('minimumNotice', $resource->GetMinNotice());
     $this->Set('requiresApproval', $resource->GetRequiresApproval());
     $this->Set('autoAssign', $resource->GetAutoAssign());
     if ($resource->HasImage()) {
         $this->Set('imageUrl', Configuration::Instance()->GetKey(ConfigKeys::IMAGE_UPLOAD_URL) . '/' . $resource->GetImage());
     }
 }
 public static function FromBookable(BookableResource $resource)
 {
     return new AdminResourceJson($resource->GetId(), $resource->GetName());
 }
Esempio n. 5
0
 public function Delete(BookableResource $resource)
 {
     Log::Debug("Deleting resource %s (%s)", $resource->GetResourceId(), $resource->GetName());
     $resourceId = $resource->GetResourceId();
     $db = ServiceLocator::GetDatabase();
     $db->Execute(new DeleteResourceReservationsCommand($resourceId));
     $db->Execute(new DeleteResourceCommand($resourceId));
 }