當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorTime::getTodayMidnightDateTime方法代碼示例

本文整理匯總了PHP中PhabricatorTime::getTodayMidnightDateTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorTime::getTodayMidnightDateTime方法的具體用法?PHP PhabricatorTime::getTodayMidnightDateTime怎麽用?PHP PhabricatorTime::getTodayMidnightDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorTime的用法示例。


在下文中一共展示了PhabricatorTime::getTodayMidnightDateTime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildCalendarDayView

 private function buildCalendarDayView(PhabricatorUser $user)
 {
     $viewer = $this->getViewer();
     $class = 'PhabricatorCalendarApplication';
     if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         return null;
     }
     $midnight = PhabricatorTime::getTodayMidnightDateTime($viewer);
     $week_end = clone $midnight;
     $week_end = $week_end->modify('+3 days');
     $range_start = $midnight->format('U');
     $range_end = $week_end->format('U');
     $events = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withDateRange($range_start, $range_end)->withInvitedPHIDs(array($user->getPHID()))->withIsCancelled(false)->needRSVPs(array($viewer->getPHID()))->execute();
     $event_views = array();
     foreach ($events as $event) {
         $viewer_is_invited = $event->isRSVPInvited($viewer->getPHID());
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $event, PhabricatorPolicyCapability::CAN_EDIT);
         $epoch_min = $event->getStartDateTimeEpoch();
         $epoch_max = $event->getEndDateTimeEpoch();
         $event_view = id(new AphrontCalendarEventView())->setCanEdit($can_edit)->setEventID($event->getID())->setEpochRange($epoch_min, $epoch_max)->setIsAllDay($event->getIsAllDay())->setIcon($event->getIcon())->setViewerIsInvited($viewer_is_invited)->setName($event->getName())->setDatetimeSummary($event->renderEventDate($viewer, true))->setURI($event->getURI());
         $event_views[] = $event_view;
     }
     $event_views = msort($event_views, 'getEpochStart');
     $day_view = id(new PHUICalendarWeekView())->setViewer($viewer)->setView('week')->setEvents($event_views)->setWeekLength(3)->render();
     $header = id(new PHUIHeaderView())->setHeader(pht('Calendar'))->setHref(urisprintf('/calendar/?invited=%s#R', $user->getUsername()));
     $box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($day_view)->addClass('calendar-profile-box')->setBackground(PHUIObjectBoxView::GREY);
     return $box;
 }
開發者ID:NeoArmageddon,項目名稱:phabricator,代碼行數:28,代碼來源:PhabricatorPeopleProfileViewController.php

示例2: buildCalendarDayView

 private function buildCalendarDayView(PhabricatorUser $user)
 {
     $viewer = $this->getViewer();
     $class = 'PhabricatorCalendarApplication';
     if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         return null;
     }
     $midnight = PhabricatorTime::getTodayMidnightDateTime($viewer);
     $week_end = clone $midnight;
     $week_end = $week_end->modify('+3 days');
     $range_start = $midnight->format('U');
     $range_end = $week_end->format('U');
     $query = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withDateRange($range_start, $range_end)->withInvitedPHIDs(array($user->getPHID()))->withIsCancelled(false);
     $statuses = $query->execute();
     $phids = mpull($statuses, 'getUserPHID');
     $events = array();
     foreach ($statuses as $status) {
         $viewer_is_invited = $status->getIsUserInvited($user->getPHID());
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $status, PhabricatorPolicyCapability::CAN_EDIT);
         $event = id(new AphrontCalendarEventView())->setCanEdit($can_edit)->setEventID($status->getID())->setEpochRange($status->getDateFrom(), $status->getDateTo())->setIsAllDay($status->getIsAllDay())->setIcon($status->getIcon())->setViewerIsInvited($viewer_is_invited)->setName($status->getName())->setURI($status->getURI());
         $events[] = $event;
     }
     $events = msort($events, 'getEpochStart');
     $day_view = id(new PHUICalendarWeekView())->setViewer($viewer)->setView('week')->setEvents($events)->setWeekLength(3)->render();
     $header = id(new PHUIHeaderView())->setHeader(pht('Calendar'))->setHref(urisprintf('/calendar/?invitedPHIDs=%s#R', $user->getPHID()));
     $box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($day_view)->setBackground(PHUIObjectBoxView::GREY);
     return $box;
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:28,代碼來源:PhabricatorPeopleProfileViewController.php

示例3: getSafeDate

 private function getSafeDate($value)
 {
     $viewer = $this->requireViewer();
     if ($value) {
         // ideally this would be consistent and always pass in the same type
         if ($value instanceof AphrontFormDateControlValue) {
             return $value;
         } else {
             $value = AphrontFormDateControlValue::newFromWild($viewer, $value);
         }
     } else {
         $value = AphrontFormDateControlValue::newFromEpoch($viewer, PhabricatorTime::getTodayMidnightDateTime($viewer)->format('U'));
         $value->setEnabled(false);
     }
     $value->setOptional(true);
     return $value;
 }
開發者ID:kristain,項目名稱:phabricator,代碼行數:17,代碼來源:PhabricatorCalendarEventSearchEngine.php

示例4: getDefaultDateTime

 private function getDefaultDateTime()
 {
     return PhabricatorTime::getTodayMidnightDateTime($this->getViewer());
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:4,代碼來源:PHUICalendarWeekView.php

示例5: getWeekOfBoxes

 private function getWeekOfBoxes()
 {
     $sidebar_day_boxes = array();
     $display_start_day = $this->getDateTime();
     $display_end_day = id(clone $display_start_day)->modify('+6 day');
     $box_start_time = clone $display_start_day;
     $today_time = PhabricatorTime::getTodayMidnightDateTime($this->user);
     $tomorrow_time = clone $today_time;
     $tomorrow_time->modify('+1 day');
     while ($box_start_time <= $display_end_day) {
         if ($box_start_time == $today_time) {
             $title = pht('Today');
         } else {
             if ($box_start_time == $tomorrow_time) {
                 $title = pht('Tomorrow');
             } else {
                 $title = $box_start_time->format('l');
             }
         }
         $sidebar_day_boxes[] = array('title' => $title, 'start' => clone $box_start_time);
         $box_start_time->modify('+1 day');
     }
     return $sidebar_day_boxes;
 }
開發者ID:patelhardik,項目名稱:phabricator,代碼行數:24,代碼來源:PHUICalendarDayView.php


注:本文中的PhabricatorTime::getTodayMidnightDateTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。