本文整理汇总了PHP中phabricator_date函数的典型用法代码示例。如果您正苦于以下问题:PHP phabricator_date函数的具体用法?PHP phabricator_date怎么用?PHP phabricator_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phabricator_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTagContent
protected function getTagContent()
{
$user = $this->profile;
$profile = $user->loadUserProfile();
$picture = $user->getProfileImageURI();
$viewer = $this->viewer;
require_celerity_resource('project-card-view-css');
$profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
$profile_title = $profile->getDisplayTitle();
$tag = id(new PHUITagView())->setIcon($profile_icon)->setName($profile_title)->addClass('project-view-header-tag')->setType(PHUITagView::TYPE_SHADE);
$header = id(new PHUIHeaderView())->setHeader(array($user->getFullName(), $tag))->setUser($viewer)->setImage($picture);
$body = array();
$body[] = $this->addItem(pht('User Since'), phabricator_date($profile->getDateCreated(), $viewer));
if (PhabricatorApplication::isClassInstalledForViewer('PhabricatorCalendarApplication', $viewer)) {
$body[] = $this->addItem(pht('Availability'), id(new PHUIUserAvailabilityView())->setViewer($viewer)->setAvailableUser($user));
}
$badges = $this->buildBadges($user, $viewer);
if ($badges) {
$badges = id(new PHUIBadgeBoxView())->addItems($badges)->setCollapsed(true);
$body[] = phutil_tag('div', array('class' => 'phui-hovercard-body-item hovercard-badges'), $badges);
}
$body = phutil_tag('div', array('class' => 'project-card-body'), $body);
$card = phutil_tag('div', array('class' => 'project-card-inner'), array($header, $body));
return $card;
}
示例2: handleHovercardEvent
private function handleHovercardEvent($event)
{
$viewer = $event->getUser();
$hovercard = $event->getValue('hovercard');
$object_handle = $event->getValue('handle');
$commit = $event->getValue('object');
if (!$commit instanceof PhabricatorRepositoryCommit) {
return;
}
$commit_data = $commit->loadCommitData();
$revision = PhabricatorEdgeQuery::loadDestinationPHIDs($commit->getPHID(), PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV);
$revision = reset($revision);
$author = $commit->getAuthorPHID();
$phids = array_filter(array($revision, $author));
$handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
if ($author) {
$author = $handles[$author]->renderLink();
} else {
$author = phutil_tag('em', array(), $commit_data->getAuthorName());
}
$hovercard->setTitle($object_handle->getName());
$hovercard->setDetail($commit->getSummary());
$hovercard->addField(pht('Author'), $author);
$hovercard->addField(pht('Date'), phabricator_date($commit->getEpoch(), $viewer));
if ($commit->getAuditStatus() != PhabricatorAuditCommitStatusConstants::NONE) {
$hovercard->addField(pht('Audit Status'), PhabricatorAuditCommitStatusConstants::getStatusName($commit->getAuditStatus()));
}
if ($revision) {
$rev_handle = $handles[$revision];
$hovercard->addField(pht('Revision'), $rev_handle->renderLink());
}
$event->setValue('hovercard', $hovercard);
}
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pager->setURI($request->getRequestURI(), 'page');
$mails = id(new PhabricatorMetaMTAReceivedMail())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$mails = $pager->sliceResults($mails);
$phids = array_merge(mpull($mails, 'getAuthorPHID'), mpull($mails, 'getRelatedPHID'));
$phids = array_unique(array_filter($phids));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($mails as $mail) {
$rows[] = array($mail->getID(), phabricator_date($mail->getDateCreated(), $user), phabricator_time($mail->getDateCreated(), $user), $mail->getAuthorPHID() ? $handles[$mail->getAuthorPHID()]->renderLink() : '-', $mail->getRelatedPHID() ? $handles[$mail->getRelatedPHID()]->renderLink() : '-', phutil_escape_html($mail->getMessage()));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Date', 'Time', 'Author', 'Object', 'Message'));
$table->setColumnClasses(array(null, null, 'right', null, null, 'wide'));
$panel = new AphrontPanelView();
$panel->setHeader('Received Mail');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav = $this->buildSideNavView();
$nav->selectFilter('received');
$nav->appendChild($panel);
return $this->buildApplicationPage($nav, array('title' => 'Received Mail'));
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$views = array(self::VIEW_ALL => 'All Slowvotes', self::VIEW_CREATED => 'Created', self::VIEW_VOTED => 'Voted In');
$view = isset($views[$this->view]) ? $this->view : self::VIEW_ALL;
$side_nav = $this->renderSideNav($views, $view);
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pager->setURI($request->getRequestURI(), 'page');
$polls = $this->loadPolls($pager, $view);
$phids = mpull($polls, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($polls as $poll) {
$rows[] = array('V' . $poll->getID(), phutil_render_tag('a', array('href' => '/V' . $poll->getID()), phutil_escape_html($poll->getQuestion())), $handles[$poll->getAuthorPHID()]->renderLink(), phabricator_date($poll->getDateCreated(), $user), phabricator_time($poll->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setColumnClasses(array('', 'pri wide', '', '', 'right'));
$table->setHeaders(array('ID', 'Poll', 'Author', 'Date', 'Time'));
$panel = new AphrontPanelView();
$panel->setHeader($this->getTableHeader($view));
$panel->setCreateButton('Create Slowvote', '/vote/create/');
$panel->appendChild($table);
$panel->appendChild($pager);
$side_nav->appendChild($panel);
return $this->buildStandardPageResponse($side_nav, array('title' => 'Slowvotes'));
}
示例5: renderHovercard
public function renderHovercard(PHUIHovercardView $hovercard, PhabricatorObjectHandle $handle, $object, $data)
{
$viewer = $this->getViewer();
$user = idx($data['users'], $object->getPHID());
if (!$user) {
return;
}
$hovercard->setTitle($user->getUsername());
$profile = $user->getUserProfile();
$detail = $user->getRealName();
if ($profile->getTitle()) {
$detail .= ' - ' . $profile->getTitle();
}
$hovercard->setDetail($detail);
if ($user->getIsDisabled()) {
$hovercard->addField(pht('Account'), pht('Disabled'));
} else {
if (!$user->isUserActivated()) {
$hovercard->addField(pht('Account'), pht('Not Activated'));
} else {
if (PhabricatorApplication::isClassInstalledForViewer('PhabricatorCalendarApplication', $viewer)) {
$hovercard->addField(pht('Status'), $user->getAvailabilityDescription($viewer));
}
}
}
$hovercard->addField(pht('User Since'), phabricator_date($user->getDateCreated(), $viewer));
if ($profile->getBlurb()) {
$hovercard->addField(pht('Blurb'), id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(120)->truncateString($profile->getBlurb()));
}
$badges = $this->buildBadges($user, $viewer);
foreach ($badges as $badge) {
$hovercard->addBadge($badge);
}
}
示例6: render
public function render()
{
$rows = array();
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
foreach ($this->daemonLogs as $log) {
$epoch = $log->getDateCreated();
if ($log->getHost() == php_uname('n')) {
$pid = $log->getPID();
$is_running = PhabricatorDaemonReference::isProcessRunning($pid);
if ($is_running) {
$running = phutil_render_tag('span', array('style' => 'color: #00cc00', 'title' => 'Running'), '•');
} else {
$running = phutil_render_tag('span', array('style' => 'color: #cc0000', 'title' => 'Not running'), '•');
}
} else {
$running = phutil_render_tag('span', array('style' => 'color: #888888', 'title' => 'Not on this host'), '?');
}
$rows[] = array($running, phutil_escape_html($log->getDaemon()), phutil_escape_html($log->getHost()), $log->getPID(), phabricator_date($epoch, $this->user), phabricator_time($epoch, $this->user), phutil_render_tag('a', array('href' => '/daemon/log/' . $log->getID() . '/', 'class' => 'button small grey'), 'View Log'));
}
$daemon_table = new AphrontTableView($rows);
$daemon_table->setHeaders(array('', 'Daemon', 'Host', 'PID', 'Date', 'Time', 'View'));
$daemon_table->setColumnClasses(array('', 'wide wrap', '', '', '', 'right', 'action'));
return $daemon_table->render();
}
示例7: render
public function render()
{
$user = $this->user;
if (!$user) {
throw new Exception("Call setUser() before render()!");
}
$rows = array();
foreach ($this->revisions as $revision) {
$status = $revision->getStatus();
$status = DifferentialRevisionStatus::getNameForRevisionStatus($status);
$reviewer_phids = $revision->getReviewers();
if ($reviewer_phids) {
$first = reset($reviewer_phids);
if (count($reviewer_phids) > 1) {
$suffix = ' (+' . (count($reviewer_phids) - 1) . ')';
} else {
$suffix = null;
}
$reviewers = $this->handles[$first]->renderLink() . $suffix;
} else {
$reviewers = '<em>None</em>';
}
$link = phutil_render_tag('a', array('href' => '/D' . $revision->getID()), phutil_escape_html($revision->getTitle()));
$rows[] = array('D' . $revision->getID(), $link, phutil_escape_html($status), number_format($revision->getLineCount()), $this->handles[$revision->getAuthorPHID()]->renderLink(), $reviewers, phabricator_datetime($revision->getDateModified(), $user), phabricator_date($revision->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Revision', 'Status', 'Lines', 'Author', 'Reviewers', 'Updated', 'Created'));
$table->setColumnClasses(array(null, 'wide pri', null, 'n', null, null, 'right', 'right'));
if ($this->noDataString) {
$table->setNoDataString($this->noDataString);
}
return $table->render();
}
示例8: renderResultList
protected function renderResultList(array $pastes, PhabricatorSavedQuery $query, array $handles)
{
assert_instances_of($pastes, 'PhabricatorPaste');
$viewer = $this->requireViewer();
$lang_map = PhabricatorEnv::getEnvConfig('pygments.dropdown-choices');
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
foreach ($pastes as $paste) {
$created = phabricator_date($paste->getDateCreated(), $viewer);
$author = $handles[$paste->getAuthorPHID()]->renderLink();
$snippet_type = $paste->getSnippet()->getType();
$lines = phutil_split_lines($paste->getSnippet()->getContent());
$preview = id(new PhabricatorSourceCodeView())->setLines($lines)->setTruncatedFirstBytes($snippet_type == PhabricatorPasteSnippet::FIRST_BYTES)->setTruncatedFirstLines($snippet_type == PhabricatorPasteSnippet::FIRST_LINES)->setURI(new PhutilURI($paste->getURI()));
$source_code = phutil_tag('div', array('class' => 'phabricator-source-code-summary'), $preview);
$created = phabricator_datetime($paste->getDateCreated(), $viewer);
$line_count = count($lines);
$line_count = pht('%s Line(s)', new PhutilNumber($line_count));
$title = nonempty($paste->getTitle(), pht('(An Untitled Masterwork)'));
$item = id(new PHUIObjectItemView())->setObjectName('P' . $paste->getID())->setHeader($title)->setHref('/P' . $paste->getID())->setObject($paste)->addByline(pht('Author: %s', $author))->addIcon('none', $created)->addIcon('none', $line_count)->appendChild($source_code);
if ($paste->isArchived()) {
$item->setDisabled(true);
}
$lang_name = $paste->getLanguage();
if ($lang_name) {
$lang_name = idx($lang_map, $lang_name, $lang_name);
$item->addIcon('none', $lang_name);
}
$list->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No pastes found.'));
return $result;
}
示例9: render
public function render()
{
require_celerity_resource('ponder-core-view-css');
require_celerity_resource('ponder-feed-view-css');
$user = $this->user;
$aoffset = $this->answeroffset;
$answers = $this->answers;
$uri = $this->uri;
$aparam = $this->aparam;
$pagesize = $this->pagesize;
$apagebuttons = id(new AphrontPagerView())->setPageSize($pagesize)->setOffset($aoffset)->setURI($uri->setFragment('answers'), $aparam);
$answers = $apagebuttons->sliceResults($answers);
$view = new PhabricatorObjectItemListView();
$view->setNoDataString(pht('No matching answers.'));
foreach ($answers as $answer) {
$question = $answer->getQuestion();
$author_phid = $question->getAuthorPHID();
$item = new PhabricatorObjectItemView();
$href = id(new PhutilURI('/Q' . $question->getID()))->setFragment('A' . $answer->getID());
$item->setHeader('A' . $answer->getID() . ' ' . self::abbreviate($answer->getContent()));
$item->setHref($href);
$item->addDetail(pht('Votes'), $answer->getVoteCount());
$item->addDetail(pht('Question'), self::abbreviate($question->getTitle()));
$item->addAttribute(pht('Created %s', phabricator_date($answer->getDateCreated(), $user)));
$view->addItem($item);
}
$view->appendChild($apagebuttons);
return $view->render();
}
示例10: loadVersions
private function loadVersions(PhabricatorUser $viewer)
{
$specs = array('phabricator', 'arcanist', 'phutil');
$all_libraries = PhutilBootloader::getInstance()->getAllLibraries();
// This puts the core libraries at the top:
$other_libraries = array_diff($all_libraries, $specs);
$specs = array_merge($specs, $other_libraries);
$futures = array();
foreach ($specs as $lib) {
$root = dirname(phutil_get_library_root($lib));
$futures[$lib] = id(new ExecFuture('git log --format=%s -n 1 --', '%H %ct'))->setCWD($root);
}
$results = array();
foreach ($futures as $key => $future) {
list($err, $stdout) = $future->resolve();
if (!$err) {
list($hash, $epoch) = explode(' ', $stdout);
$version = pht('%s (%s)', $hash, phabricator_date($epoch, $viewer));
} else {
$version = pht('Unknown');
}
$results[$key] = $version;
}
return $results;
}
示例11: render
public function render()
{
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
$task = $this->task;
$handles = $this->handles;
require_celerity_resource('maniphest-task-summary-css');
$pri_class = self::getPriorityClass($task->getPriority());
$status_map = ManiphestTaskStatus::getTaskStatusMap();
$batch = null;
if ($this->showBatchControls) {
$batch = '<td class="maniphest-task-batch">' . javelin_render_tag('input', array('type' => 'checkbox', 'name' => 'batch[]', 'value' => $task->getID(), 'sigil' => 'maniphest-batch'), null) . '</td>';
}
$projects_view = new ManiphestTaskProjectsView();
$projects_view->setHandles(array_select_keys($this->handles, $task->getProjectPHIDs()));
$control_class = null;
$control_sigil = null;
if ($this->showSubpriorityControls) {
$control_class = 'maniphest-active-handle';
$control_sigil = 'maniphest-task-handle';
}
$handle = javelin_render_tag('td', array('class' => 'maniphest-task-handle ' . $pri_class . ' ' . $control_class, 'sigil' => $control_sigil), '');
return javelin_render_tag('table', array('class' => 'maniphest-task-summary', 'sigil' => 'maniphest-task', 'meta' => array('taskID' => $task->getID())), '<tr>' . $handle . $batch . '<td class="maniphest-task-number">' . 'T' . $task->getID() . '</td>' . '<td class="maniphest-task-status">' . idx($status_map, $task->getStatus(), 'Unknown') . '</td>' . '<td class="maniphest-task-owner">' . ($task->getOwnerPHID() ? $handles[$task->getOwnerPHID()]->renderLink() : '<em>None</em>') . '</td>' . '<td class="maniphest-task-name">' . phutil_render_tag('a', array('href' => '/T' . $task->getID()), phutil_escape_html($task->getTitle())) . '</td>' . '<td class="maniphest-task-projects">' . $projects_view->render() . '</td>' . '<td class="maniphest-task-updated">' . phabricator_date($task->getDateModified(), $this->user) . '</td>' . '</tr>');
}
示例12: render
public function render()
{
$viewer = $this->getViewer();
$rows = array();
foreach ($this->events as $event) {
// Limit display log size. If a daemon gets stuck in an output loop this
// page can be like >100MB if we don't truncate stuff. Try to do cheap
// line-based truncation first, and fall back to expensive UTF-8 character
// truncation if that doesn't get things short enough.
$message = $event->getMessage();
$more = null;
if (!$this->showFullMessage) {
$more_lines = null;
$more_chars = null;
$line_limit = 12;
if (substr_count($message, "\n") > $line_limit) {
$message = explode("\n", $message);
$more_lines = count($message) - $line_limit;
$message = array_slice($message, 0, $line_limit);
$message = implode("\n", $message);
}
$char_limit = 8192;
if (strlen($message) > $char_limit) {
$message = phutil_utf8v($message);
$more_chars = count($message) - $char_limit;
$message = array_slice($message, 0, $char_limit);
$message = implode('', $message);
}
if ($more_chars) {
$more = new PhutilNumber($more_chars);
$more = pht('Show %d more character(s)...', $more);
} else {
if ($more_lines) {
$more = new PhutilNumber($more_lines);
$more = pht('Show %d more line(s)...', $more);
}
}
if ($more) {
$id = $event->getID();
$more = array("\n...\n", phutil_tag('a', array('href' => "/daemon/event/{$id}/"), $more));
}
}
$row = array($event->getLogType(), phabricator_date($event->getEpoch(), $viewer), phabricator_time($event->getEpoch(), $viewer), array($message, $more));
if ($this->combinedLog) {
array_unshift($row, phutil_tag('a', array('href' => '/daemon/log/' . $event->getLogID() . '/'), pht('Daemon %s', $event->getLogID())));
}
$rows[] = $row;
}
$classes = array('', '', 'right', 'wide prewrap');
$headers = array('Type', 'Date', 'Time', 'Message');
if ($this->combinedLog) {
array_unshift($classes, 'pri');
array_unshift($headers, 'Daemon');
}
$log_table = new AphrontTableView($rows);
$log_table->setHeaders($headers);
$log_table->setColumnClasses($classes);
return $log_table->render();
}
示例13: getStatusDescription
public function getStatusDescription(PhabricatorUser $viewer)
{
$until = phabricator_date($this->dateTo, $viewer);
if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) {
return 'Sporadic until ' . $until;
} else {
return 'Away until ' . $until;
}
}
示例14: getTerseSummary
public function getTerseSummary(PhabricatorUser $viewer)
{
$until = phabricator_date($this->dateTo, $viewer);
if ($this->status == PhabricatorCalendarEvent::STATUS_SPORADIC) {
return pht('Sporadic until %s', $until);
} else {
return pht('Away until %s', $until);
}
}
示例15: render
public function render()
{
$rows = array();
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
foreach ($this->events as $event) {
// Limit display log size. If a daemon gets stuck in an output loop this
// page can be like >100MB if we don't truncate stuff. Try to do cheap
// line-based truncation first, and fall back to expensive UTF-8 character
// truncation if that doesn't get things short enough.
$message = $event->getMessage();
$more_lines = null;
$more_chars = null;
$line_limit = 12;
if (substr_count($message, "\n") > $line_limit) {
$message = explode("\n", $message);
$more_lines = count($message) - $line_limit;
$message = array_slice($message, 0, $line_limit);
$message = implode("\n", $message);
}
$char_limit = 8192;
if (strlen($message) > $char_limit) {
$message = phutil_utf8v($message);
$more_chars = count($message) - $char_limit;
$message = array_slice($message, 0, $char_limit);
$message = implode('', $message);
}
$more = null;
if ($more_chars) {
$more = number_format($more_chars);
$more = "\n<... {$more} more characters ...>";
} else {
if ($more_lines) {
$more = number_format($more_lines);
$more = "\n<... {$more} more lines ...>";
}
}
$row = array(phutil_escape_html($event->getLogType()), phabricator_date($event->getEpoch(), $this->user), phabricator_time($event->getEpoch(), $this->user), str_replace("\n", '<br />', phutil_escape_html($message . $more)));
if ($this->combinedLog) {
array_unshift($row, phutil_render_tag('a', array('href' => '/daemon/log/' . $event->getLogID() . '/'), phutil_escape_html('Daemon ' . $event->getLogID())));
}
$rows[] = $row;
}
$classes = array('', '', 'right', 'wide wrap');
$headers = array('Type', 'Date', 'Time', 'Message');
if ($this->combinedLog) {
array_unshift($classes, 'pri');
array_unshift($headers, 'Daemon');
}
$log_table = new AphrontTableView($rows);
$log_table->setHeaders($headers);
$log_table->setColumnClasses($classes);
return $log_table->render();
}