Пример #1
0
 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();
     }
 }
Пример #2
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));
 }
Пример #3
0
 public function __construct(IRestServer $server, UserItemView $user, IEntityAttributeList $attributes)
 {
     $userId = $user->Id;
     $this->id = $userId;
     $this->dateCreated = $user->DateCreated->ToIso();
     $this->emailAddress = $user->Email;
     $this->firstName = $user->First;
     $this->lastName = $user->Last;
     $this->language = $user->Language;
     $this->lastLogin = $user->LastLogin->ToIso();
     $this->organization = $user->Organization;
     $this->phoneNumber = $user->Phone;
     $this->position = $user->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());
         }
     }
     $this->AddService($server, WebServices::GetUser, array(WebServiceParams::UserId => $userId));
 }