public static function Create($row) { $user = new UserItemView(); $user->Id = $row[ColumnNames::USER_ID]; $user->Username = $row[ColumnNames::USERNAME]; $user->First = $row[ColumnNames::FIRST_NAME]; $user->Last = $row[ColumnNames::LAST_NAME]; $user->Email = $row[ColumnNames::EMAIL]; $user->Phone = $row[ColumnNames::PHONE_NUMBER]; $user->DateCreated = Date::FromDatabase($row[ColumnNames::USER_CREATED]); $user->LastLogin = Date::FromDatabase($row[ColumnNames::LAST_LOGIN]); $user->StatusId = $row[ColumnNames::USER_STATUS_ID]; $user->Timezone = $row[ColumnNames::TIMEZONE_NAME]; $user->Organization = $row[ColumnNames::ORGANIZATION]; $user->Position = $row[ColumnNames::POSITION]; $user->Language = $row[ColumnNames::LANGUAGE_CODE]; if (isset($row[ColumnNames::ATTRIBUTE_LIST])) { $user->Attributes = CustomAttributes::Parse($row[ColumnNames::ATTRIBUTE_LIST]); } else { $user->Attributes = new CustomAttributes(); } if (isset($row[ColumnNames::USER_PREFERENCES])) { $preferences = UserPreferences::Parse($row[ColumnNames::USER_PREFERENCES]); if (!empty($preferences)) { $user->ReservationColor = $preferences->Get(UserPreferences::RESERVATION_COLOR); } $user->Preferences = $preferences; } else { $user->Preferences = new UserPreferences(); } return $user; }
/** * @param $referenceNumber string * @param $startDate Date * @param $endDate Date * @param $resourceName string * @param $resourceId int * @param $reservationId int * @param $userLevelId int|ReservationUserLevel * @param $title string * @param $description string * @param $scheduleId int * @param $userFirstName string * @param $userLastName string * @param $userId int * @param $userPhone string * @param $userPosition string * @param $userOrganization string * @param $participant_list string * @param $invitee_list string * @param $attribute_list string * @param $preferences string */ public function __construct($referenceNumber = null, $startDate = null, $endDate = null, $resourceName = null, $resourceId = null, $reservationId = null, $userLevelId = null, $title = null, $description = null, $scheduleId = null, $userFirstName = null, $userLastName = null, $userId = null, $userPhone = null, $userOrganization = null, $userPosition = null, $participant_list = null, $invitee_list = null, $attribute_list = null, $preferences = null, $statusId = null) { $this->ReferenceNumber = $referenceNumber; $this->StartDate = $startDate; $this->EndDate = $endDate; $this->ResourceName = $resourceName; $this->ResourceId = $resourceId; $this->ReservationId = $reservationId; $this->Title = $title; $this->Description = $description; $this->ScheduleId = $scheduleId; $this->FirstName = $userFirstName; $this->OwnerFirstName = $userFirstName; $this->LastName = $userLastName; $this->OwnerLastName = $userLastName; $this->OwnerPhone = $userPhone; $this->OwnerOrganization = $userOrganization; $this->OwnerPosition = $userPosition; $this->UserId = $userId; $this->UserLevelId = $userLevelId; $this->StatusId = $statusId; if (!empty($startDate) && !empty($endDate)) { $this->Date = new DateRange($startDate, $endDate); } if (!empty($participant_list)) { $participants = explode('!sep!', $participant_list); foreach ($participants as $participant) { $pair = explode('=', $participant); $id = $pair[0]; $name = $pair[1]; $name_parts = explode(' ', $name); $this->ParticipantIds[] = $id; $this->ParticipantNames[$id] = new FullName($name_parts[0], $name_parts[1]); } } if (!empty($invitee_list)) { $invitees = explode('!sep!', $invitee_list); foreach ($invitees as $invitee) { $pair = explode('=', $invitee); $id = $pair[0]; $name = $pair[1]; $name_parts = explode(' ', $name); $this->InviteeIds[] = $id; $this->InviteeNames[$id] = new FullName($name_parts[0], $name_parts[1]); } } $this->Attributes = CustomAttributes::Parse($attribute_list); $this->UserPreferences = UserPreferences::Parse($preferences); }
/** * @param $referenceNumber string * @param $startDate Date * @param $endDate Date * @param $resourceName string * @param $resourceId int * @param $reservationId int * @param $userLevelId int|ReservationUserLevel * @param $title string * @param $description string * @param $scheduleId int * @param $userFirstName string * @param $userLastName string * @param $userId int * @param $userPhone string * @param $userPosition string * @param $userOrganization string * @param $participant_list string * @param $invitee_list string * @param $attribute_list string * @param $preferences string */ public function __construct($referenceNumber = null, $startDate = null, $endDate = null, $resourceName = null, $resourceId = null, $reservationId = null, $userLevelId = null, $title = null, $description = null, $scheduleId = null, $userFirstName = null, $userLastName = null, $userId = null, $userPhone = null, $userOrganization = null, $userPosition = null, $participant_list = null, $invitee_list = null, $attribute_list = null, $preferences = null) { $this->ReferenceNumber = $referenceNumber; $this->StartDate = $startDate; $this->EndDate = $endDate; $this->ResourceName = $resourceName; $this->ResourceId = $resourceId; $this->ReservationId = $reservationId; $this->Title = $title; $this->Description = $description; $this->ScheduleId = $scheduleId; $this->FirstName = $userFirstName; $this->OwnerFirstName = $userFirstName; $this->LastName = $userLastName; $this->OwnerLastName = $userLastName; $this->OwnerPhone = $userPhone; $this->OwnerOrganization = $userOrganization; $this->OwnerPosition = $userPosition; $this->UserId = $userId; $this->UserLevelId = $userLevelId; if (!empty($startDate) && !empty($endDate)) { $this->Date = new DateRange($startDate, $endDate); } if (!empty($participant_list)) { $this->ParticipantIds = explode(',', $participant_list); } if (!empty($invitee_list)) { $this->InviteeIds = explode(',', $invitee_list); } $this->Attributes = CustomAttributes::Parse($attribute_list); $this->UserPreferences = UserPreferences::Parse($preferences); }