当前位置: 首页>>代码示例>>PHP>>正文


PHP Date::FromDatabase方法代码示例

本文整理汇总了PHP中Date::FromDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::FromDatabase方法的具体用法?PHP Date::FromDatabase怎么用?PHP Date::FromDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date的用法示例。


在下文中一共展示了Date::FromDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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();
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:32,代码来源:UserResponse.php

示例2: LoadByBlackoutId

 /**
  * @param int $blackoutId
  * @return BlackoutSeries
  */
 public function LoadByBlackoutId($blackoutId)
 {
     $db = ServiceLocator::GetDatabase();
     $result = $db->Query(new GetBlackoutSeriesByBlackoutIdCommand($blackoutId));
     if ($row = $result->GetRow()) {
         $series = BlackoutSeries::FromRow($row);
         $result = $db->Query(new GetBlackoutInstancesCommand($series->Id()));
         while ($row = $result->GetRow()) {
             $instance = new Blackout(new DateRange(Date::FromDatabase($row[ColumnNames::BLACKOUT_START]), Date::FromDatabase($row[ColumnNames::BLACKOUT_END])));
             $instance->WithId($row[ColumnNames::BLACKOUT_INSTANCE_ID]);
             $series->AddBlackout($instance);
         }
         $result = $db->Query(new GetBlackoutResourcesCommand($series->Id()));
         while ($row = $result->GetRow()) {
             $series->AddResource(new BlackoutResource($row[ColumnNames::RESOURCE_ID], $row[ColumnNames::RESOURCE_NAME], $row[ColumnNames::SCHEDULE_ID], $row[ColumnNames::RESOURCE_ADMIN_GROUP_ID], $row[ColumnNames::SCHEDULE_ADMIN_GROUP_ID_ALIAS], $row[ColumnNames::RESOURCE_STATUS_ID]));
         }
         return $series;
     } else {
         return null;
     }
 }
开发者ID:hugutux,项目名称:booked,代码行数:25,代码来源:BlackoutRepository.php

示例3: PopulateInstances

 private function PopulateInstances(ExistingReservationSeries $series)
 {
     // get all series instances
     $getInstancesCommand = new GetReservationSeriesInstances($series->SeriesId());
     $reader = ServiceLocator::GetDatabase()->Query($getInstancesCommand);
     while ($row = $reader->GetRow()) {
         $start = Date::FromDatabase($row[ColumnNames::RESERVATION_START]);
         $end = Date::FromDatabase($row[ColumnNames::RESERVATION_END]);
         $reservation = new Reservation($series, new DateRange($start, $end), $row[ColumnNames::RESERVATION_INSTANCE_ID], $row[ColumnNames::REFERENCE_NUMBER]);
         $series->WithInstance($reservation);
     }
     $reader->Free();
 }
开发者ID:ksdtech,项目名称:booked,代码行数:13,代码来源:ReservationRepository.php

示例4: Populate

 /**
  * @static
  * @param $row
  * @return BlackoutItemView
  */
 public static function Populate($row)
 {
     return new BlackoutItemView($row[ColumnNames::BLACKOUT_INSTANCE_ID], Date::FromDatabase($row[ColumnNames::BLACKOUT_START]), Date::FromDatabase($row[ColumnNames::BLACKOUT_END]), $row[ColumnNames::RESOURCE_ID], $row[ColumnNames::USER_ID], $row[ColumnNames::SCHEDULE_ID], $row[ColumnNames::BLACKOUT_TITLE], $row[ColumnNames::BLACKOUT_DESCRIPTION], $row[ColumnNames::FIRST_NAME], $row[ColumnNames::LAST_NAME], $row[ColumnNames::RESOURCE_NAME], $row[ColumnNames::BLACKOUT_SERIES_ID], $row[ColumnNames::REPEAT_OPTIONS], $row[ColumnNames::REPEAT_TYPE]);
 }
开发者ID:JoseTfg,项目名称:Booked,代码行数:9,代码来源:ReservationViewRepository.php

示例5: FromRow

 /**
  * @param string[] $row
  * @return BlackoutSeries
  */
 public static function FromRow($row)
 {
     $series = new BlackoutSeries($row[ColumnNames::OWNER_USER_ID], $row[ColumnNames::BLACKOUT_TITLE]);
     $series->WithId($row[ColumnNames::BLACKOUT_SERIES_ID]);
     $series->SetCurrentBlackout(new DateRange(Date::FromDatabase($row[ColumnNames::BLACKOUT_START]), Date::FromDatabase($row[ColumnNames::BLACKOUT_END])));
     $series->WithCurrentBlackoutId($row[ColumnNames::BLACKOUT_INSTANCE_ID]);
     $configuration = RepeatConfiguration::Create($row[ColumnNames::REPEAT_TYPE], $row[ColumnNames::REPEAT_OPTIONS]);
     $factory = new RepeatOptionsFactory();
     $options = $factory->Create($row[ColumnNames::REPEAT_TYPE], $configuration->Interval, $configuration->TerminationDate, $configuration->Weekdays, $configuration->MonthlyType);
     $series->WithRepeatOptions($options);
     return $series;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:16,代码来源:Blackout.php

示例6: Create

 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;
 }
开发者ID:ksdtech,项目名称:booked,代码行数:32,代码来源:UserRepository.php

示例7: FromRow

 /**
  * @param array $row
  * @return ReminderNotice
  */
 public static function FromRow($row)
 {
     $seriesId = $row[ColumnNames::SERIES_ID];
     $reservationId = $row[ColumnNames::RESERVATION_INSTANCE_ID];
     $referenceNumber = $row[ColumnNames::REFERENCE_NUMBER];
     $startDate = Date::FromDatabase($row[ColumnNames::RESERVATION_START]);
     $endDate = Date::FromDatabase($row[ColumnNames::RESERVATION_END]);
     $title = $row[ColumnNames::RESERVATION_TITLE];
     $description = $row[ColumnNames::RESERVATION_DESCRIPTION];
     $resourceName = $row[ColumnNames::RESOURCE_NAME_ALIAS];
     $emailAddress = $row[ColumnNames::EMAIL];
     $firstName = $row[ColumnNames::FIRST_NAME];
     $lastName = $row[ColumnNames::LAST_NAME];
     $timezone = $row[ColumnNames::TIMEZONE_NAME];
     $reminder_minutes = $row[ColumnNames::REMINDER_MINUTES_PRIOR];
     $language = $row[ColumnNames::LANGUAGE_CODE];
     return new ReminderNotice($seriesId, $reservationId, $referenceNumber, $startDate, $endDate, $title, $description, $resourceName, $emailAddress, $firstName, $lastName, $timezone, $reminder_minutes, $language);
 }
开发者ID:ksdtech,项目名称:booked,代码行数:22,代码来源:ReminderNotice.php

示例8: Populate

 /**
  * @param array $row
  * @return NextReservationView
  */
 public static function Populate($row)
 {
     $item = new NextReservationView($row[ColumnNames::REFERENCE_NUMBER], $row[ColumnNames::SERIES_ID], $row[ColumnNames::RESOURCE_ID], Date::FromDatabase($row[ColumnNames::RESERVATION_START]), Date::FromDatabase($row[ColumnNames::RESERVATION_END]), $row[ColumnNames::USER_ID]);
     $item->OwnerFirstName = $row[ColumnNames::FIRST_NAME];
     $item->OwnerLastName = $row[ColumnNames::LAST_NAME];
     $item->Title = $row[ColumnNames::RESERVATION_TITLE];
     $item->Description = $row[ColumnNames::RESERVATION_DESCRIPTION];
     return $item;
 }
开发者ID:eEksperimenti,项目名称:Booked,代码行数:13,代码来源:ReservationViewRepository.php

示例9: LoadSavedReportForUser

 /**
  * @param int $reportId
  * @param int $userId
  * @return SavedReport
  */
 public function LoadSavedReportForUser($reportId, $userId)
 {
     $reader = ServiceLocator::GetDatabase()->Query(new GetSavedReportForUserCommand($reportId, $userId));
     if ($row = $reader->GetRow()) {
         return SavedReport::FromDatabase($row[ColumnNames::REPORT_NAME], $row[ColumnNames::USER_ID], Date::FromDatabase($row[ColumnNames::DATE_CREATED]), $row[ColumnNames::REPORT_DETAILS], $row[ColumnNames::REPORT_ID]);
     } else {
         return null;
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:14,代码来源:ReportingRepository.php

示例10: GetChartData

 public function GetChartData($row, $key)
 {
     $format = Resources::GetInstance()->GetDateFormat(ResourceKeys::DATE_GENERAL);
     return Date::FromDatabase($row[$key])->ToTimezone($this->timezone)->GetDate()->Format($format);
 }
开发者ID:JoseTfg,项目名称:Booked,代码行数:5,代码来源:ReportColumn.php

示例11: SetTerminationDate

 private function SetTerminationDate($terminationDateString)
 {
     if (!empty($terminationDateString)) {
         $this->TerminationDate = Date::FromDatabase($terminationDateString);
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:6,代码来源:RepeatOptions.php

示例12: testLoadByIdFullyHydratesReservationSeriesObject

 public function testLoadByIdFullyHydratesReservationSeriesObject()
 {
     $seriesId = 10;
     $reservationId = 1;
     $referenceNumber = 'currentInstanceRefNum';
     $ownerId = 10;
     $resourceId = 100;
     $scheduleId = 1000;
     $title = 'title';
     $description = 'description';
     $resourceId1 = 99;
     $resourceId2 = 999;
     $begin = '2010-01-05 12:30:00';
     $end = '2010-01-05 18:30:00';
     $duration = DateRange::Create($begin, $end, 'UTC');
     $interval = 3;
     $repeatType = RepeatType::Daily;
     $terminationDateString = '2010-01-20 12:30:00';
     $terminationDate = Date::FromDatabase($terminationDateString);
     $repeatOptions = new RepeatDaily($interval, $terminationDate);
     $instance1Invitees = array(1, 2, 3);
     $instance1Participants = array(4, 5);
     $instance2Invitees = array(6);
     $instance2Participants = array(7, 8, 9);
     $resourceName = 'primary resource';
     $location = 'l';
     $contact = 'c';
     $notes = 'notes';
     $minLength = '3:00';
     $maxLength = null;
     $autoAssign = true;
     $requiresApproval = false;
     $allowMultiDay = true;
     $maxParticipants = 100;
     $minNotice = '2:10';
     $maxNotice = null;
     $statusId = ReservationStatus::Pending;
     $accessoryId1 = 8111;
     $accessoryId2 = 8222;
     $quantity1 = 11;
     $quantity2 = 22;
     $attributeId1 = 908;
     $attributeValue1 = 'custom1';
     $attributeId2 = 999;
     $attributeValue2 = 'custom2';
     $fileId = 100;
     $startReminderMinutes = 25;
     $endReminderMinutes = 120;
     $allowParticipation = true;
     $expected = new ExistingReservationSeries();
     $expected->WithId($seriesId);
     $expected->WithOwner($ownerId);
     $expected->WithPrimaryResource(new BookableResource($resourceId, $resourceName, $location, $contact, $notes, $minLength, $maxLength, $autoAssign, $requiresApproval, $allowMultiDay, $maxParticipants, $minNotice, $maxNotice, null, $scheduleId));
     $expected->WithTitle($title);
     $expected->WithDescription($description);
     $expected->WithResource(new BookableResource($resourceId1, $resourceName, $location, $contact, $notes, $minLength, $maxLength, $autoAssign, $requiresApproval, $allowMultiDay, $maxParticipants, $minNotice, $maxNotice, null, $scheduleId));
     $expected->WithResource(new BookableResource($resourceId2, $resourceName, $location, $contact, $notes, $minLength, $maxLength, $autoAssign, $requiresApproval, $allowMultiDay, $maxParticipants, $minNotice, $maxNotice, null, $scheduleId));
     $expected->WithRepeatOptions($repeatOptions);
     $expected->WithStatus($statusId);
     $expected->WithAccessory(new ReservationAccessory($accessoryId1, $quantity1));
     $expected->WithAccessory(new ReservationAccessory($accessoryId2, $quantity2));
     $expected->WithAttribute(new AttributeValue($attributeId1, $attributeValue1));
     $expected->WithAttribute(new AttributeValue($attributeId2, $attributeValue2));
     $expected->WithAttachment($fileId, 'doc');
     $expected->AllowParticipation($allowParticipation);
     $instance1 = new Reservation($expected, $duration->AddDays(10));
     $instance1->SetReferenceNumber('instance1');
     $instance1->SetReservationId(909);
     $instance1->WithInvitees($instance1Invitees);
     $instance1->WithParticipants($instance1Participants);
     $instance2 = new Reservation($expected, $duration->AddDays(20));
     $instance2->SetReferenceNumber('instance2');
     $instance2->SetReservationId(1909);
     $instance2->WithInvitees($instance2Invitees);
     $instance2->WithParticipants($instance2Participants);
     $expected->WithInstance($instance1);
     $expected->WithInstance($instance2);
     $expectedInstance = new Reservation($expected, $duration);
     $expectedInstance->SetReferenceNumber($referenceNumber);
     $expectedInstance->SetReservationId($reservationId);
     $expected->WithCurrentInstance($expectedInstance);
     $expected->WithStartReminder(new ReservationReminder($startReminderMinutes, ReservationReminderInterval::Minutes));
     $expected->WithEndReminder(new ReservationReminder($endReminderMinutes / 60, ReservationReminderInterval::Hours));
     $reservationRow = new ReservationRow($reservationId, $begin, $end, $title, $description, $repeatType, $repeatOptions->ConfigurationString(), $referenceNumber, $seriesId, $ownerId, $statusId, $allowParticipation);
     $reservationInstanceRow = new ReservationInstanceRow($seriesId);
     $reservationInstanceRow->WithInstance($instance1->ReservationId(), $instance1->ReferenceNumber(), $instance1->Duration())->WithInstance($instance2->ReservationId(), $instance2->ReferenceNumber(), $instance2->Duration())->WithInstance($reservationId, $expectedInstance->ReferenceNumber(), $expectedInstance->Duration());
     $reservationResourceRow = new ReservationResourceRow($reservationId, $resourceName, $location, $contact, $notes, $minLength, $maxLength, $autoAssign, $requiresApproval, $allowMultiDay, $maxParticipants, $minNotice, $maxNotice, $scheduleId);
     $reservationResourceRow->WithPrimary($resourceId)->WithAdditional($resourceId1)->WithAdditional($resourceId2);
     $reservationUserRow = new ReservationUserRow();
     $reservationUserRow->WithParticipants($instance1, $instance1Participants)->WithParticipants($instance2, $instance2Participants)->WithInvitees($instance1, $instance1Invitees)->WithInvitees($instance2, $instance2Invitees);
     $reservationAccessoryRow = new ReservationAccessoryRow();
     $reservationAccessoryRow->WithAccessory($accessoryId1, $quantity1)->WithAccessory($accessoryId2, $quantity2);
     $attributeValueRow = new CustomAttributeValueRow();
     $attributeValueRow->With($attributeId1, $attributeValue1)->With($attributeId2, $attributeValue2);
     $attachmentRow = new ReservationAttachmentItemRow();
     $attachmentRow->With($fileId, $seriesId, null, 'doc');
     $reminderRow = new ReservationReminderRow();
     $reminderRow->With(1, $seriesId, $startReminderMinutes, ReservationReminderType::Start)->With(2, $seriesId, $endReminderMinutes, ReservationReminderType::End);
     $this->db->SetRow(0, $reservationRow->Rows());
     $this->db->SetRow(1, $reservationInstanceRow->Rows());
//.........这里部分代码省略.........
开发者ID:utn-frm-si,项目名称:booked,代码行数:101,代码来源:ReservationRepositoryTests.php

示例13: testOrdersAndFormatsData

 public function testOrdersAndFormatsData()
 {
     $timezone = 'America/Chicago';
     $date = '2012-02-14 08:12:31';
     $oneHourThirtyMinutes = TimeInterval::Parse("1h30m");
     $userId = 100;
     $rows = array(array(ColumnNames::RESERVATION_START => $date, ColumnNames::OWNER_FULL_NAME_ALIAS => 'un', ColumnNames::OWNER_USER_ID => $userId, ColumnNames::ACCESSORY_NAME => 'an', 'unknown' => 'unknown', ColumnNames::TOTAL_TIME => $oneHourThirtyMinutes->TotalSeconds(), ColumnNames::ACCESSORY_ID => 1));
     $report = new CustomReport($rows, $this->attributeRepository);
     $definition = new ReportDefinition($report, $timezone);
     /** @var $row ReportCell[] */
     $row = $definition->GetRow($rows[0]);
     $this->assertEquals(4, count($row));
     $this->assertEquals('an', $row[0]->Value());
     $format = Resources::GetInstance()->GeneralDateTimeFormat();
     $systemFormat = Resources::GetInstance()->GeneralDateFormat();
     $this->assertEquals(Date::FromDatabase($date)->ToTimezone($timezone)->Format($format), $row[1]->Value());
     $this->assertEquals(Date::FromDatabase($date)->ToTimezone($timezone)->Format($systemFormat), $row[1]->ChartValue());
     $this->assertEquals(ChartColumnType::Date, $row[1]->GetChartColumnType());
     $this->assertNull($row[1]->GetChartGroup());
     $this->assertEquals('un', $row[2]->Value());
     $this->assertEquals($userId, $row[2]->ChartValue());
     $this->assertEquals(ChartColumnType::Label, $row[2]->GetChartColumnType());
     $this->assertEmpty($row[2]->GetChartGroup());
     $this->assertEquals($oneHourThirtyMinutes, $row[3]->Value());
     $this->assertEquals($oneHourThirtyMinutes->TotalSeconds(), $row[3]->ChartValue());
     $this->assertEquals(ChartColumnType::Total, $row[3]->GetChartColumnType());
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:27,代码来源:ReportDefinitionTests.php

示例14: FromRow

 public static function FromRow($row)
 {
     return new Announcement($row[ColumnNames::ANNOUNCEMENT_ID], $row[ColumnNames::ANNOUNCEMENT_TEXT], Date::FromDatabase($row[ColumnNames::ANNOUNCEMENT_START]), Date::FromDatabase($row[ColumnNames::ANNOUNCEMENT_END]), $row[ColumnNames::ANNOUNCEMENT_PRIORITY]);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:4,代码来源:Announcement.php

示例15: testLoadsAnnouncement

 public function testLoadsAnnouncement()
 {
     $text1 = 'text1';
     $start1 = null;
     $end1 = null;
     $priority1 = 3;
     $rows = array($this->GetAnnouncementRow(1, $text1, $start1, $end1, $priority1));
     $this->db->SetRows($rows);
     $id = 1232;
     $actual = $this->repository->LoadById($id);
     $expected = new Announcement(1, $text1, Date::FromDatabase($start1), Date::FromDatabase($end1), $priority1);
     $this->assertEquals(new GetAnnouncementByIdCommand($id), $this->db->_LastCommand);
     $this->assertEquals($actual, $expected);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:14,代码来源:AnnouncementRepositoryTests.php


注:本文中的Date::FromDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。