/** * @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)); }
public function __construct(IRestServer $server, User $user, IEntityAttributeList $attributes) { $userId = $user->Id(); $this->id = $userId; $this->emailAddress = $user->EmailAddress(); $this->firstName = $user->FirstName(); $this->lastName = $user->LastName(); $this->language = $user->Language(); $this->lastLogin = Date::FromDatabase($user->LastLogin())->ToIso(); $this->organization = $user->GetAttribute(UserAttribute::Organization); $this->phoneNumber = $user->GetAttribute(UserAttribute::Phone); $this->position = $user->GetAttribute(UserAttribute::Position); $this->statusId = $user->StatusId(); $this->timezone = $user->Timezone(); $this->username = $user->Username(); $attributeValues = $attributes->GetAttributes($userId); if (!empty($attributeValues)) { foreach ($attributeValues as $av) { $this->customAttributes[] = new CustomAttributeResponse($server, $av->Id(), $av->Label(), $av->Value()); } } foreach ($user->AllowedResourceIds() as $allowedResourceId) { $this->permissions[] = new ResourceItemResponse($server, $allowedResourceId, ''); } foreach ($user->Groups() as $group) { $this->groups[] = new GroupItemResponse($server, $group->GroupId, $group->GroupName); } if ($user->GetIsCalendarSubscriptionAllowed()) { $url = new CalendarSubscriptionUrl($user->GetPublicId(), null, null); $this->icsUrl = $url->__toString(); } }
/** * @return string */ public function Url() { if (is_null($this->url)) { return null; } return $this->url->__toString(); }
public function __construct(IRestServer $server, Schedule $schedule, IScheduleLayout $layout) { $this->daysVisible = $schedule->GetDaysVisible(); $this->id = $schedule->GetId(); $this->isDefault = $schedule->GetIsDefault(); $this->name = $schedule->GetName(); $this->timezone = $schedule->GetTimezone(); $this->weekdayStart = $schedule->GetWeekdayStart(); if ($schedule->GetIsCalendarSubscriptionAllowed()) { $url = new CalendarSubscriptionUrl(null, $schedule->GetPublicId(), null); $this->icsUrl = $url->__toString(); } $layoutDate = Date::Now()->ToTimezone($server->GetSession()->Timezone); for ($day = 0; $day < 7; $day++) { $periods = $layout->GetLayout($layoutDate); foreach ($periods as $period) { $this->periods[$layoutDate->Weekday()][] = new SchedulePeriodResponse($period); } $layoutDate = $layoutDate->AddDays(1); } }