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


PHP phabricator_format_local_time函数代码示例

本文整理汇总了PHP中phabricator_format_local_time函数的典型用法代码示例。如果您正苦于以下问题:PHP phabricator_format_local_time函数的具体用法?PHP phabricator_format_local_time怎么用?PHP phabricator_format_local_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: render

 public function render()
 {
     $viewer = $this->getUser();
     if (!$viewer) {
         throw new PhutilInvalidStateException('setUser');
     }
     require_celerity_resource('conpherence-transaction-css');
     $transaction = $this->getConpherenceTransaction();
     switch ($transaction->getTransactionType()) {
         case ConpherenceTransaction::TYPE_DATE_MARKER:
             return javelin_tag('div', array('class' => 'conpherence-transaction-view date-marker', 'sigil' => 'conpherence-transaction-view', 'meta' => array('id' => $transaction->getID() + 0.5)), array(phutil_tag('span', array('class' => 'date'), phabricator_format_local_time($transaction->getDateCreated(), $viewer, 'M jS, Y'))));
             break;
     }
     $info = $this->renderTransactionInfo();
     $actions = $this->renderTransactionActions();
     $image = $this->renderTransactionImage();
     $content = $this->renderTransactionContent();
     $classes = implode(' ', $this->classes);
     $transaction_dom_id = null;
     if ($this->getFullDisplay()) {
         $transaction_dom_id = 'anchor-' . $transaction->getID();
     }
     $header = phutil_tag_div('conpherence-transaction-header grouped', array($actions, $info));
     return javelin_tag('div', array('class' => 'conpherence-transaction-view ' . $classes, 'id' => $transaction_dom_id, 'sigil' => 'conpherence-transaction-view', 'meta' => array('id' => $transaction->getID())), array($image, phutil_tag_div('conpherence-transaction-detail grouped', array($header, $content))));
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:25,代码来源:ConpherenceTransactionView.php

示例2: processRequest

 public function processRequest()
 {
     $now = time();
     $request = $this->getRequest();
     $user = $request->getUser();
     $year_d = phabricator_format_local_time($now, $user, 'Y');
     $year = $request->getInt('year', $year_d);
     $month_d = phabricator_format_local_time($now, $user, 'm');
     $month = $request->getInt('month', $month_d);
     $day = phabricator_format_local_time($now, $user, 'j');
     $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere('day BETWEEN %s AND %s', "{$year}-{$month}-01", "{$year}-{$month}-31");
     $statuses = id(new PhabricatorCalendarEventQuery())->setViewer($user)->withDateRange(strtotime("{$year}-{$month}-01"), strtotime("{$year}-{$month}-01 next month"))->execute();
     if ($month == $month_d && $year == $year_d) {
         $month_view = new PHUICalendarMonthView($month, $year, $day);
     } else {
         $month_view = new PHUICalendarMonthView($month, $year);
     }
     $month_view->setBrowseURI($request->getRequestURI());
     $month_view->setUser($user);
     $month_view->setHolidays($holidays);
     $phids = mpull($statuses, 'getUserPHID');
     $handles = $this->loadViewerHandles($phids);
     /* Assign Colors */
     $unique = array_unique($phids);
     $allblue = false;
     $calcolors = CalendarColors::getColors();
     if (count($unique) > count($calcolors)) {
         $allblue = true;
     }
     $i = 0;
     $eventcolor = array();
     foreach ($unique as $phid) {
         if ($allblue) {
             $eventcolor[$phid] = CalendarColors::COLOR_SKY;
         } else {
             $eventcolor[$phid] = $calcolors[$i];
         }
         $i++;
     }
     foreach ($statuses as $status) {
         $event = new AphrontCalendarEventView();
         $event->setEpochRange($status->getDateFrom(), $status->getDateTo());
         $name_text = $handles[$status->getUserPHID()]->getName();
         $status_text = $status->getHumanStatus();
         $event->setUserPHID($status->getUserPHID());
         $event->setDescription(pht('%s (%s)', $name_text, $status_text));
         $event->setName($status_text);
         $event->setEventID($status->getID());
         $event->setColor($eventcolor[$status->getUserPHID()]);
         $month_view->addEvent($event);
     }
     $date = new DateTime("{$year}-{$month}-01");
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('All Events'));
     $crumbs->addTextCrumb($date->format('F Y'));
     $nav = $this->buildSideNavView();
     $nav->selectFilter('all/');
     $nav->appendChild(array($crumbs, $month_view));
     return $this->buildApplicationPage($nav, array('title' => pht('Calendar')));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:60,代码来源:PhabricatorCalendarBrowseController.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $username = $request->getURIData('username');
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($username))->needProfileImage(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $this->setUser($user);
     $picture = $user->getProfileImageURI();
     $now = time();
     $request = $this->getRequest();
     $year_d = phabricator_format_local_time($now, $user, 'Y');
     $year = $request->getInt('year', $year_d);
     $month_d = phabricator_format_local_time($now, $user, 'm');
     $month = $request->getInt('month', $month_d);
     $day = phabricator_format_local_time($now, $user, 'j');
     $start_epoch = strtotime("{$year}-{$month}-01");
     $end_epoch = strtotime("{$year}-{$month}-01 next month");
     $statuses = id(new PhabricatorCalendarEventQuery())->setViewer($user)->withInvitedPHIDs(array($user->getPHID()))->withDateRange($start_epoch, $end_epoch)->execute();
     $start_range_value = AphrontFormDateControlValue::newFromEpoch($user, $start_epoch);
     $end_range_value = AphrontFormDateControlValue::newFromEpoch($user, $end_epoch);
     if ($month == $month_d && $year == $year_d) {
         $month_view = new PHUICalendarMonthView($start_range_value, $end_range_value, $month, $year, $day);
     } else {
         $month_view = new PHUICalendarMonthView($start_range_value, $end_range_value, $month, $year);
     }
     $month_view->setBrowseURI($request->getRequestURI());
     $month_view->setUser($user);
     $month_view->setImage($picture);
     $phids = mpull($statuses, 'getUserPHID');
     $handles = $this->loadViewerHandles($phids);
     foreach ($statuses as $status) {
         $event = new AphrontCalendarEventView();
         $event->setEpochRange($status->getDateFrom(), $status->getDateTo());
         $event->setUserPHID($status->getUserPHID());
         $event->setName($status->getName());
         $event->setDescription($status->getDescription());
         $event->setEventID($status->getID());
         $month_view->addEvent($event);
     }
     $nav = $this->getProfileMenu();
     $nav->selectFilter('calendar');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Calendar'));
     return $this->newPage()->setTitle(pht('Calendar'))->setNavigation($nav)->setCrumbs($crumbs)->appendChild($month_view);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:47,代码来源:PhabricatorPeopleCalendarController.php

示例4: renderConpherenceTransactions

 protected function renderConpherenceTransactions(ConpherenceThread $conpherence)
 {
     $user = $this->getRequest()->getUser();
     $transactions = $conpherence->getTransactions();
     $oldest_transaction_id = 0;
     $too_many = ConpherenceThreadQuery::TRANSACTION_LIMIT + 1;
     if (count($transactions) == $too_many) {
         $last_transaction = end($transactions);
         unset($transactions[$last_transaction->getID()]);
         $oldest_transaction = end($transactions);
         $oldest_transaction_id = $oldest_transaction->getID();
     }
     $transactions = array_reverse($transactions);
     $handles = $conpherence->getHandles();
     $rendered_transactions = array();
     $engine = id(new PhabricatorMarkupEngine())->setViewer($user);
     foreach ($transactions as $key => $transaction) {
         if ($transaction->shouldHide()) {
             unset($transactions[$key]);
             continue;
         }
         if ($transaction->getComment()) {
             $engine->addObject($transaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
         }
     }
     $engine->process();
     // we're going to insert a dummy date marker transaction for breaks
     // between days. some setup required!
     $previous_transaction = null;
     $date_marker_transaction = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransactionType::TYPE_DATE_MARKER)->makeEphemeral();
     $date_marker_transaction_view = id(new ConpherenceTransactionView())->setUser($user)->setConpherenceTransaction($date_marker_transaction)->setHandles($handles)->setMarkupEngine($engine);
     foreach ($transactions as $transaction) {
         if ($previous_transaction) {
             $previous_day = phabricator_format_local_time($previous_transaction->getDateCreated(), $user, 'Ymd');
             $current_day = phabricator_format_local_time($transaction->getDateCreated(), $user, 'Ymd');
             // date marker transaction time!
             if ($previous_day != $current_day) {
                 $date_marker_transaction->setDateCreated($transaction->getDateCreated());
                 $rendered_transactions[] = $date_marker_transaction_view->render();
             }
         }
         $rendered_transactions[] = id(new ConpherenceTransactionView())->setUser($user)->setConpherenceTransaction($transaction)->setHandles($handles)->setMarkupEngine($engine)->render();
         $previous_transaction = $transaction;
     }
     $latest_transaction_id = $transaction->getID();
     return array('transactions' => $rendered_transactions, 'latest_transaction_id' => $latest_transaction_id, 'oldest_transaction_id' => $oldest_transaction_id);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:47,代码来源:ConpherenceController.php

示例5: processRequest

 public function processRequest()
 {
     $viewer = $this->getRequest()->getUser();
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needProfileImage(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $picture = $user->loadProfileImageURI();
     $now = time();
     $request = $this->getRequest();
     $year_d = phabricator_format_local_time($now, $user, 'Y');
     $year = $request->getInt('year', $year_d);
     $month_d = phabricator_format_local_time($now, $user, 'm');
     $month = $request->getInt('month', $month_d);
     $day = phabricator_format_local_time($now, $user, 'j');
     $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere('day BETWEEN %s AND %s', "{$year}-{$month}-01", "{$year}-{$month}-31");
     $statuses = id(new PhabricatorCalendarEventQuery())->setViewer($user)->withInvitedPHIDs(array($user->getPHID()))->withDateRange(strtotime("{$year}-{$month}-01"), strtotime("{$year}-{$month}-01 next month"))->execute();
     if ($month == $month_d && $year == $year_d) {
         $month_view = new PHUICalendarMonthView($month, $year, $day);
     } else {
         $month_view = new PHUICalendarMonthView($month, $year);
     }
     $month_view->setBrowseURI($request->getRequestURI());
     $month_view->setUser($user);
     $month_view->setHolidays($holidays);
     $month_view->setImage($picture);
     $phids = mpull($statuses, 'getUserPHID');
     $handles = $this->loadViewerHandles($phids);
     foreach ($statuses as $status) {
         $event = new AphrontCalendarEventView();
         $event->setEpochRange($status->getDateFrom(), $status->getDateTo());
         $event->setUserPHID($status->getUserPHID());
         $event->setName($status->getHumanStatus());
         $event->setDescription($status->getDescription());
         $event->setEventID($status->getID());
         $month_view->addEvent($event);
     }
     $date = new DateTime("{$year}-{$month}-01");
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($user->getUsername(), '/p/' . $user->getUsername() . '/');
     $crumbs->addTextCrumb($date->format('F Y'));
     return $this->buildApplicationPage(array($crumbs, $month_view), array('title' => pht('Calendar')));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:43,代码来源:PhabricatorPeopleCalendarController.php

示例6: parseEvents

 public function parseEvents($dates)
 {
     $sprintpoints = id(new SprintPoints())->setTaskPoints($this->taskpoints);
     foreach ($this->events as $event) {
         $modify_date = $event['modified'];
         $task_phid = $event['objectPHID'];
         $points = $sprintpoints->getTaskPoints($task_phid);
         $date = phabricator_format_local_time($modify_date, $this->viewer, 'D M j');
         switch ($event['type']) {
             case 'close':
                 $this->closeTasksToday($date, $dates);
                 $this->closePointsToday($date, $points, $dates);
                 break;
             case 'reopen':
                 $this->reopenedTasksToday($date, $dates);
                 $this->reopenedPointsToday($date, $points, $dates);
                 break;
         }
     }
     return $dates;
 }
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:21,代码来源:SprintColumnTransaction.php

示例7: render

 public function render()
 {
     $user = $this->getUser();
     $transaction = $this->getConpherenceTransaction();
     switch ($transaction->getTransactionType()) {
         case ConpherenceTransactionType::TYPE_DATE_MARKER:
             return phutil_tag('div', array('class' => 'date-marker'), array(phutil_tag('span', array('class' => 'date'), phabricator_format_local_time($transaction->getDateCreated(), $user, 'M jS, Y'))));
             break;
     }
     $handles = $this->getHandles();
     $transaction->setHandles($handles);
     $author = $handles[$transaction->getAuthorPHID()];
     $transaction_view = id(new PhabricatorTransactionView())->setUser($user)->setEpoch($transaction->getDateCreated())->setContentSource($transaction->getContentSource());
     $content = null;
     $content_class = null;
     $content = null;
     switch ($transaction->getTransactionType()) {
         case ConpherenceTransactionType::TYPE_TITLE:
             $content = $transaction->getTitle();
             $transaction_view->addClass('conpherence-edited');
             break;
         case ConpherenceTransactionType::TYPE_FILES:
             $content = $transaction->getTitle();
             break;
         case ConpherenceTransactionType::TYPE_PARTICIPANTS:
             $content = $transaction->getTitle();
             $transaction_view->addClass('conpherence-edited');
             break;
         case PhabricatorTransactions::TYPE_COMMENT:
             $comment = $transaction->getComment();
             $content = $this->markupEngine->getOutput($comment, PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
             $content_class = 'conpherence-message phabricator-remarkup';
             $transaction_view->setImageURI($author->getImageURI())->setActions(array($author->renderLink()));
             break;
     }
     $transaction_view->appendChild(phutil_tag('div', array('class' => $content_class), $content));
     return $transaction_view->render();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:38,代码来源:ConpherenceTransactionView.php

示例8: phabricator_datetime

function phabricator_datetime($epoch, $user)
{
    return phabricator_format_local_time($epoch, $user, pht('%s, g:i A', _phabricator_date_format($epoch)));
}
开发者ID:neoxen,项目名称:phabricator,代码行数:4,代码来源:viewutils.php

示例9: getDisplayYearAndMonthAndDay

 private function getDisplayYearAndMonthAndDay($range_start, $range_end, $display)
 {
     $viewer = $this->requireViewer();
     $epoch = null;
     if ($this->calendarYear && $this->calendarMonth) {
         $start_year = $this->calendarYear;
         $start_month = $this->calendarMonth;
         $start_day = $this->calendarDay ? $this->calendarDay : 1;
     } else {
         if ($range_start) {
             $epoch = $range_start;
         } else {
             if ($range_end) {
                 $epoch = $range_end;
             } else {
                 $epoch = time();
             }
         }
         if ($display == 'month') {
             $day = 1;
         } else {
             $day = phabricator_format_local_time($epoch, $viewer, 'd');
         }
         $start_year = phabricator_format_local_time($epoch, $viewer, 'Y');
         $start_month = phabricator_format_local_time($epoch, $viewer, 'm');
         $start_day = $day;
     }
     return array($start_year, $start_month, $start_day);
 }
开发者ID:kristain,项目名称:phabricator,代码行数:29,代码来源:PhabricatorCalendarEventSearchEngine.php

示例10: formatBucketRows

 private function formatBucketRows($stats, $day_buckets)
 {
     $template = array('open' => 0, 'close' => 0);
     $rows = array();
     $rowc = array();
     $last_month = null;
     $last_month_epoch = null;
     $last_week = null;
     $last_week_epoch = null;
     $week = null;
     $month = null;
     $period = $template;
     foreach ($stats as $bucket => $info) {
         $epoch = $day_buckets[$bucket];
         $week_bucket = $this->buildBucket($epoch, 'YW');
         if ($week_bucket != $last_week) {
             if ($week) {
                 $rows[] = $this->formatBurnRow('Week of ' . phabricator_date($last_week_epoch, $this->user), $week);
                 $rowc[] = 'week';
             }
             $week = $template;
             $last_week = $week_bucket;
             $last_week_epoch = $epoch;
         }
         $month_bucket = $this->buildBucket($epoch, 'Ym');
         if ($month_bucket != $last_month) {
             if ($month) {
                 $rows[] = $this->formatBurnRow(phabricator_format_local_time($last_month_epoch, $this->user, 'F, Y'), $month);
                 $rowc[] = 'month';
             }
             $month = $template;
             $last_month = $month_bucket;
             $last_month_epoch = $epoch;
         }
         $rows[] = $this->formatBurnRow(phabricator_date($epoch, $this->user), $info);
         $rowc[] = null;
         $week['open'] += $info['open'];
         $week['close'] += $info['close'];
         $month['open'] += $info['open'];
         $month['close'] += $info['close'];
         $period['open'] += $info['open'];
         $period['close'] += $info['close'];
     }
     return array($rows, $rowc, $week, $month, $period);
 }
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:45,代码来源:SprintReportBurnUpView.php

示例11: renderBurn

 public function renderBurn()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $handle = null;
     $project_phid = $request->getStr('project');
     if ($project_phid) {
         $phids = array($project_phid);
         $handles = $this->loadViewerHandles($phids);
         $handle = $handles[$project_phid];
     }
     $table = new ManiphestTransaction();
     $conn = $table->establishConnection('r');
     $joins = '';
     if ($project_phid) {
         $joins = qsprintf($conn, 'JOIN %T t ON x.objectPHID = t.phid
       JOIN %T p ON p.src = t.phid AND p.type = %d AND p.dst = %s', id(new ManiphestTask())->getTableName(), PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $project_phid);
     }
     $data = queryfx_all($conn, 'SELECT x.oldValue, x.newValue, x.dateCreated FROM %T x %Q
     WHERE transactionType = %s
     ORDER BY x.dateCreated ASC', $table->getTableName(), $joins, ManiphestTransaction::TYPE_STATUS);
     $stats = array();
     $day_buckets = array();
     $open_tasks = array();
     foreach ($data as $key => $row) {
         // NOTE: Hack to avoid json_decode().
         $oldv = trim($row['oldValue'], '"');
         $newv = trim($row['newValue'], '"');
         if ($oldv == 'null') {
             $old_is_open = false;
         } else {
             $old_is_open = ManiphestTaskStatus::isOpenStatus($oldv);
         }
         $new_is_open = ManiphestTaskStatus::isOpenStatus($newv);
         $is_open = $new_is_open && !$old_is_open;
         $is_close = $old_is_open && !$new_is_open;
         $data[$key]['_is_open'] = $is_open;
         $data[$key]['_is_close'] = $is_close;
         if (!$is_open && !$is_close) {
             // This is either some kind of bogus event, or a resolution change
             // (e.g., resolved -> invalid). Just skip it.
             continue;
         }
         $day_bucket = phabricator_format_local_time($row['dateCreated'], $viewer, 'Yz');
         $day_buckets[$day_bucket] = $row['dateCreated'];
         if (empty($stats[$day_bucket])) {
             $stats[$day_bucket] = array('open' => 0, 'close' => 0);
         }
         $stats[$day_bucket][$is_close ? 'close' : 'open']++;
     }
     $template = array('open' => 0, 'close' => 0);
     $rows = array();
     $rowc = array();
     $last_month = null;
     $last_month_epoch = null;
     $last_week = null;
     $last_week_epoch = null;
     $week = null;
     $month = null;
     $last = last_key($stats) - 1;
     $period = $template;
     foreach ($stats as $bucket => $info) {
         $epoch = $day_buckets[$bucket];
         $week_bucket = phabricator_format_local_time($epoch, $viewer, 'YW');
         if ($week_bucket != $last_week) {
             if ($week) {
                 $rows[] = $this->formatBurnRow(pht('Week of %s', phabricator_date($last_week_epoch, $viewer)), $week);
                 $rowc[] = 'week';
             }
             $week = $template;
             $last_week = $week_bucket;
             $last_week_epoch = $epoch;
         }
         $month_bucket = phabricator_format_local_time($epoch, $viewer, 'Ym');
         if ($month_bucket != $last_month) {
             if ($month) {
                 $rows[] = $this->formatBurnRow(phabricator_format_local_time($last_month_epoch, $viewer, 'F, Y'), $month);
                 $rowc[] = 'month';
             }
             $month = $template;
             $last_month = $month_bucket;
             $last_month_epoch = $epoch;
         }
         $rows[] = $this->formatBurnRow(phabricator_date($epoch, $viewer), $info);
         $rowc[] = null;
         $week['open'] += $info['open'];
         $week['close'] += $info['close'];
         $month['open'] += $info['open'];
         $month['close'] += $info['close'];
         $period['open'] += $info['open'];
         $period['close'] += $info['close'];
     }
     if ($week) {
         $rows[] = $this->formatBurnRow(pht('Week To Date'), $week);
         $rowc[] = 'week';
     }
     if ($month) {
         $rows[] = $this->formatBurnRow(pht('Month To Date'), $month);
         $rowc[] = 'month';
     }
//.........这里部分代码省略.........
开发者ID:truSense,项目名称:phabricator,代码行数:101,代码来源:ManiphestReportController.php

示例12: renderBurn

 public function renderBurn()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $handle = null;
     $project_phid = $request->getStr('project');
     if ($project_phid) {
         $phids = array($project_phid);
         $handles = $this->loadViewerHandles($phids);
         $handle = $handles[$project_phid];
     }
     $table = new ManiphestTransaction();
     $conn = $table->establishConnection('r');
     $joins = '';
     if ($project_phid) {
         $joins = qsprintf($conn, 'JOIN %T t ON x.taskID = t.id
       JOIN %T p ON p.taskPHID = t.phid AND p.projectPHID = %s', id(new ManiphestTask())->getTableName(), id(new ManiphestTaskProject())->getTableName(), $project_phid);
     }
     $data = queryfx_all($conn, 'SELECT x.oldValue, x.newValue, x.dateCreated FROM %T x %Q
     WHERE transactionType = %s
     ORDER BY x.dateCreated ASC', $table->getTableName(), $joins, ManiphestTransactionType::TYPE_STATUS);
     $stats = array();
     $day_buckets = array();
     $open_tasks = array();
     foreach ($data as $key => $row) {
         // NOTE: Hack to avoid json_decode().
         $oldv = trim($row['oldValue'], '"');
         $newv = trim($row['newValue'], '"');
         $old_is_open = $oldv === (string) ManiphestTaskStatus::STATUS_OPEN;
         $new_is_open = $newv === (string) ManiphestTaskStatus::STATUS_OPEN;
         $is_open = $new_is_open && !$old_is_open;
         $is_close = $old_is_open && !$new_is_open;
         $data[$key]['_is_open'] = $is_open;
         $data[$key]['_is_close'] = $is_close;
         if (!$is_open && !$is_close) {
             // This is either some kind of bogus event, or a resolution change
             // (e.g., resolved -> invalid). Just skip it.
             continue;
         }
         $day_bucket = phabricator_format_local_time($row['dateCreated'], $user, 'Yz');
         $day_buckets[$day_bucket] = $row['dateCreated'];
         if (empty($stats[$day_bucket])) {
             $stats[$day_bucket] = array('open' => 0, 'close' => 0);
         }
         $stats[$day_bucket][$is_close ? 'close' : 'open']++;
     }
     $template = array('open' => 0, 'close' => 0);
     $rows = array();
     $rowc = array();
     $last_month = null;
     $last_month_epoch = null;
     $last_week = null;
     $last_week_epoch = null;
     $week = null;
     $month = null;
     $last = last_key($stats) - 1;
     $period = $template;
     foreach ($stats as $bucket => $info) {
         $epoch = $day_buckets[$bucket];
         $week_bucket = phabricator_format_local_time($epoch, $user, 'YW');
         if ($week_bucket != $last_week) {
             if ($week) {
                 $rows[] = $this->formatBurnRow('Week of ' . phabricator_date($last_week_epoch, $user), $week);
                 $rowc[] = 'week';
             }
             $week = $template;
             $last_week = $week_bucket;
             $last_week_epoch = $epoch;
         }
         $month_bucket = phabricator_format_local_time($epoch, $user, 'Ym');
         if ($month_bucket != $last_month) {
             if ($month) {
                 $rows[] = $this->formatBurnRow(phabricator_format_local_time($last_month_epoch, $user, 'F, Y'), $month);
                 $rowc[] = 'month';
             }
             $month = $template;
             $last_month = $month_bucket;
             $last_month_epoch = $epoch;
         }
         $rows[] = $this->formatBurnRow(phabricator_date($epoch, $user), $info);
         $rowc[] = null;
         $week['open'] += $info['open'];
         $week['close'] += $info['close'];
         $month['open'] += $info['open'];
         $month['close'] += $info['close'];
         $period['open'] += $info['open'];
         $period['close'] += $info['close'];
     }
     if ($week) {
         $rows[] = $this->formatBurnRow('Week To Date', $week);
         $rowc[] = 'week';
     }
     if ($month) {
         $rows[] = $this->formatBurnRow('Month To Date', $month);
         $rowc[] = 'month';
     }
     $rows[] = $this->formatBurnRow('All Time', $period);
     $rowc[] = 'aggregate';
     $rows = array_reverse($rows);
     $rowc = array_reverse($rowc);
//.........这里部分代码省略.........
开发者ID:rudimk,项目名称:phabricator,代码行数:101,代码来源:ManiphestReportController.php

示例13: renderUserCalendar

 private function renderUserCalendar(PhabricatorUser $user)
 {
     $viewer = $this->getRequest()->getUser();
     $epochs = CalendarTimeUtil::getCalendarEventEpochs($viewer, 'today', 7);
     $start_epoch = $epochs['start_epoch'];
     $end_epoch = $epochs['end_epoch'];
     $statuses = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withInvitedPHIDs(array($user->getPHID()))->withDateRange($start_epoch, $end_epoch)->execute();
     $timestamps = CalendarTimeUtil::getCalendarWeekTimestamps($viewer);
     $today = $timestamps['today'];
     $epoch_stamps = $timestamps['epoch_stamps'];
     $events = array();
     foreach ($epoch_stamps as $day) {
         $epoch_start = $day->format('U');
         $next_day = clone $day;
         $next_day->modify('+1 day');
         $epoch_end = $next_day->format('U');
         foreach ($statuses as $status) {
             if ($status->getDateTo() < $epoch_start) {
                 continue;
             }
             if ($status->getDateFrom() >= $epoch_end) {
                 continue;
             }
             $event = new AphrontCalendarEventView();
             $event->setEpochRange($status->getDateFrom(), $status->getDateTo());
             $status_text = $status->getHumanStatus();
             $event->setUserPHID($status->getUserPHID());
             $event->setName($status_text);
             $event->setDescription($status->getDescription());
             $event->setEventID($status->getID());
             $events[$epoch_start][] = $event;
         }
     }
     $week = array();
     foreach ($epoch_stamps as $day) {
         $epoch = $day->format('U');
         $headertext = phabricator_format_local_time($epoch, $user, 'l, M d');
         $list = new PHUICalendarListView();
         $list->setUser($viewer);
         $list->showBlankState(true);
         if (isset($events[$epoch])) {
             foreach ($events[$epoch] as $event) {
                 $list->addEvent($event);
             }
         }
         $header = phutil_tag('a', array('href' => $this->getRequest()->getRequestURI() . 'calendar/'), $headertext);
         $calendar = new PHUICalendarWidgetView();
         $calendar->setHeader($header);
         $calendar->setCalendarList($list);
         $week[] = $calendar;
     }
     return phutil_tag_div('profile-calendar', $week);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:53,代码来源:PhabricatorPeopleProfileController.php

示例14: renderResultList

 protected function renderResultList(array $events, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($events, 'PhabricatorCalendarEvent');
     $viewer = $this->requireViewer();
     $list = new PHUIObjectItemListView();
     foreach ($events as $event) {
         if ($event->getUserPHID() == $viewer->getPHID()) {
             $href = $this->getApplicationURI('/event/edit/' . $event->getID() . '/');
         } else {
             $from = $event->getDateFrom();
             $month = phabricator_format_local_time($from, $viewer, 'm');
             $year = phabricator_format_local_time($from, $viewer, 'Y');
             $uri = new PhutilURI($this->getApplicationURI());
             $uri->setQueryParams(array('month' => $month, 'year' => $year));
             $href = (string) $uri;
         }
         $from = phabricator_datetime($event->getDateFrom(), $viewer);
         $to = phabricator_datetime($event->getDateTo(), $viewer);
         $creator_handle = $handles[$event->getUserPHID()];
         $color = $event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY ? 'red' : 'yellow';
         $item = id(new PHUIObjectItemView())->setHeader($event->getTerseSummary($viewer))->setHref($href)->setBarColor($color)->addByline(pht('Creator: %s', $creator_handle->renderLink()))->addAttribute(pht('From %s to %s', $from, $to))->addAttribute(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(64)->truncateString($event->getDescription()));
         $list->addItem($item);
     }
     return $list;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:PhabricatorCalendarEventSearchEngine.php

示例15: phabricator_datetime

function phabricator_datetime($epoch, $user)
{
    $time_key = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT;
    return phabricator_format_local_time($epoch, $user, pht('%s, %s', phutil_date_format($epoch), $user->getPreference($time_key)));
}
开发者ID:pugong,项目名称:phabricator,代码行数:5,代码来源:viewutils.php


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