Ejemplo n.º 1
0
 public function GetRow($row)
 {
     $attributes = null;
     if (array_key_exists(ColumnNames::ATTRIBUTE_LIST, $row)) {
         $attributes = CustomAttributes::Parse($row[ColumnNames::ATTRIBUTE_LIST]);
     }
     $formattedRow = array();
     foreach ($this->columns as $key => $column) {
         if ($key == ColumnNames::TOTAL || $key == ColumnNames::TOTAL_TIME) {
             $this->sum += $row[$key];
             $this->sumColumn = $column;
         }
         if ($attributes != null && BookedStringHelper::StartsWith($key, 'attribute')) {
             $id = intval(str_replace('attribute', '', $key));
             $attribute = $attributes->Get($id);
             $formattedRow[] = new ReportAttributeCell($column->GetData($attribute));
         } else {
             $formattedRow[] = new ReportCell($column->GetData($row[$key]), $column->GetChartData($row, $key), $column->GetChartColumnType(), $column->GetChartGroup());
         }
     }
     return $formattedRow;
 }
Ejemplo n.º 2
0
 /**
  * @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);
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /**
  * @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);
 }
Ejemplo n.º 5
0
 public function GetRow($row)
 {
     $reservationAttributes = null;
     $userAttributes = null;
     $resourceAttributes = null;
     $resourceTypeAttributes = null;
     if (array_key_exists(ColumnNames::ATTRIBUTE_LIST, $row)) {
         $reservationAttributes = CustomAttributes::Parse($row[ColumnNames::ATTRIBUTE_LIST]);
     }
     if (array_key_exists(ColumnNames::USER_ATTRIBUTE_LIST, $row)) {
         $userAttributes = CustomAttributes::Parse($row[ColumnNames::USER_ATTRIBUTE_LIST]);
     }
     if (array_key_exists(ColumnNames::RESOURCE_ATTRIBUTE_LIST, $row)) {
         $resourceAttributes = CustomAttributes::Parse($row[ColumnNames::RESOURCE_ATTRIBUTE_LIST]);
     }
     if (array_key_exists(ColumnNames::RESOURCE_TYPE_ATTRIBUTE_LIST, $row)) {
         $resourceTypeAttributes = CustomAttributes::Parse($row[ColumnNames::RESOURCE_TYPE_ATTRIBUTE_LIST]);
     }
     $formattedRow = array();
     foreach ($this->columns as $key => $column) {
         if ($key == ColumnNames::TOTAL || $key == ColumnNames::TOTAL_TIME) {
             $this->sum += $row[$key];
             $this->sumColumn = $column;
         }
         if (BookedStringHelper::Contains($key, 'attribute')) {
             $this->AddCustomAttributes(CustomAttributeCategory::RESERVATION, $reservationAttributes, $formattedRow, $key, $column);
             $this->AddCustomAttributes(CustomAttributeCategory::USER, $userAttributes, $formattedRow, $key, $column);
             $this->AddCustomAttributes(CustomAttributeCategory::RESOURCE, $resourceAttributes, $formattedRow, $key, $column);
             $this->AddCustomAttributes(CustomAttributeCategory::RESOURCE_TYPE, $resourceTypeAttributes, $formattedRow, $key, $column);
         } else {
             $formattedRow[] = new ReportCell($column->GetData($row[$key]), $column->GetChartData($row, $key), $column->GetChartColumnType(), $column->GetChartGroup());
         }
     }
     return $formattedRow;
 }