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


PHP AphrontTableView::setNoDataString方法代码示例

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


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

示例1: render

 public function render()
 {
     $rows = array();
     $rowc = array();
     // TODO: Experiment with path stack rendering.
     // TODO: Copy Away and Move Away are rendered junkily still.
     foreach ($this->pathChanges as $id => $change) {
         $path = $change->getPath();
         $hash = substr(md5($path), 0, 8);
         if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $path .= '/';
         }
         if (isset($this->renderingReferences[$id])) {
             $path_column = javelin_render_tag('a', array('href' => '#' . $hash, 'meta' => array('id' => 'diff-' . $hash, 'ref' => $this->renderingReferences[$id]), 'sigil' => 'differential-load'), phutil_escape_html($path));
         } else {
             $path_column = phutil_escape_html($path);
         }
         $rows[] = array($this->linkHistory($change->getPath()), $this->linkBrowse($change->getPath()), $this->linkChange($change->getChangeType(), $change->getFileType(), $change->getPath()), $path_column);
         $row_class = null;
         foreach ($this->ownersPaths as $owners_path) {
             $owners_path = $owners_path->getPath();
             if (strncmp('/' . $path, $owners_path, strlen($owners_path)) == 0) {
                 $row_class = 'highlighted';
                 break;
             }
         }
         $rowc[] = $row_class;
     }
     $view = new AphrontTableView($rows);
     $view->setHeaders(array('History', 'Browse', 'Change', 'Path'));
     $view->setColumnClasses(array('', '', '', 'wide'));
     $view->setRowClasses($rowc);
     $view->setNoDataString('This change has not been fully parsed yet.');
     return $view->render();
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:35,代码来源:DiffusionCommitChangeTableView.php

示例2: render

 public function render()
 {
     $rows = array();
     foreach ($this->edits as $edit) {
         $name = nonempty($edit->getRuleName(), 'Unknown Rule');
         $rule_name = phutil_render_tag('strong', array(), phutil_escape_html($name));
         switch ($edit->getAction()) {
             case 'create':
                 $details = "Created rule '{$rule_name}'.";
                 break;
             case 'delete':
                 $details = "Deleted rule '{$rule_name}'.";
                 break;
             case 'edit':
             default:
                 $details = "Edited rule '{$rule_name}'.";
                 break;
         }
         $rows[] = array($edit->getRuleID(), $this->handles[$edit->getEditorPHID()]->renderLink(), $details, phabricator_datetime($edit->getDateCreated(), $this->user));
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString("No edits for rule.");
     $table->setHeaders(array('Rule ID', 'Editor', 'Details', 'Edit Date'));
     $table->setColumnClasses(array('', '', 'wide', ''));
     return $table->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:26,代码来源:HeraldRuleEditHistoryView.php

示例3: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     $tokens = id(new PhabricatorAuthTemporaryTokenQuery())->setViewer($viewer)->withObjectPHIDs(array($viewer->getPHID()))->execute();
     $rows = array();
     foreach ($tokens as $token) {
         if ($token->isRevocable()) {
             $button = javelin_tag('a', array('href' => '/auth/token/revoke/' . $token->getID() . '/', 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Revoke'));
         } else {
             $button = javelin_tag('a', array('class' => 'small grey button disabled'), pht('Revoke'));
         }
         if ($token->getTokenExpires() >= time()) {
             $expiry = phabricator_datetime($token->getTokenExpires(), $viewer);
         } else {
             $expiry = pht('Expired');
         }
         $rows[] = array($token->getTokenReadableTypeName(), $expiry, $button);
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString(pht("You don't have any active tokens."));
     $table->setHeaders(array(pht('Type'), pht('Expires'), pht('')));
     $table->setColumnClasses(array('wide', 'right', 'action'));
     $terminate_button = id(new PHUIButtonView())->setText(pht('Revoke All'))->setHref('/auth/token/revoke/all/')->setTag('a')->setWorkflow(true)->setIcon('fa-exclamation-triangle');
     $header = id(new PHUIHeaderView())->setHeader(pht('Temporary Tokens'))->addActionLink($terminate_button);
     $panel = id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
     return $panel;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:27,代码来源:PhabricatorTokensSettingsPanel.php

示例4: render

 public function render()
 {
     $data = $this->getData();
     $rows = array();
     $details = '';
     foreach ($data as $index => $row) {
         $file = $row['file'];
         $line = $row['line'];
         $tag = phutil_render_tag('a', array('onclick' => jsprintf('show_details(%d)', $index)), phutil_escape_html($row['str'] . ' at [' . basename($file) . ':' . $line . ']'));
         $rows[] = array($tag);
         $details .= '<div class="dark-console-panel-error-details" id="row-details-' . $index . '">' . phutil_escape_html($row['details']) . "\n" . 'Stack trace:' . "\n";
         foreach ($row['trace'] as $key => $entry) {
             $line = '';
             if (isset($entry['class'])) {
                 $line .= $entry['class'] . '::';
             }
             $line .= idx($entry, 'function', '');
             $onclick = '';
             if (isset($entry['file'])) {
                 $line .= ' called at [' . $entry['file'] . ':' . $entry['line'] . ']';
                 $onclick = jsprintf('open_file(%s, %d)', $entry['file'], $entry['line']);
             }
             $details .= phutil_render_tag('a', array('onclick' => $onclick), phutil_escape_html($line));
             $details .= "\n";
         }
         $details .= '</div>';
     }
     $table = new AphrontTableView($rows);
     $table->setClassName('error-log');
     $table->setHeaders(array('Error'));
     $table->setNoDataString('No errors.');
     return '<div>' . '<div>' . $table->render() . '</div>' . '<div class="dark-console-panel-error-separator"></div>' . '<pre class="PhabricatorMonospaced">' . $details . '</pre>' . '</div>';
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:33,代码来源:DarkConsoleErrorLogPlugin.php

示例5: processRequest

 public function processRequest()
 {
     $logs = id(new PhabricatorDaemonLog())->loadAllWhere('`status` != %s ORDER BY id DESC LIMIT 15', 'exit');
     $request = $this->getRequest();
     $user = $request->getUser();
     $daemon_table = new PhabricatorDaemonLogListView();
     $daemon_table->setUser($user);
     $daemon_table->setDaemonLogs($logs);
     $daemon_panel = new AphrontPanelView();
     $daemon_panel->setHeader('Recently Launched Daemons');
     $daemon_panel->appendChild($daemon_table);
     $tasks = id(new PhabricatorWorkerTask())->loadAllWhere('leaseOwner IS NOT NULL');
     $rows = array();
     foreach ($tasks as $task) {
         $rows[] = array($task->getID(), $task->getTaskClass(), $task->getLeaseOwner(), $task->getLeaseExpires() - time(), $task->getFailureCount(), phutil_render_tag('a', array('href' => '/daemon/task/' . $task->getID() . '/', 'class' => 'button small grey'), 'View Task'));
     }
     $leased_table = new AphrontTableView($rows);
     $leased_table->setHeaders(array('ID', 'Class', 'Owner', 'Expires', 'Failures', ''));
     $leased_table->setColumnClasses(array('n', 'wide', '', '', 'n', 'action'));
     $leased_table->setNoDataString('No tasks are leased by workers.');
     $leased_panel = new AphrontPanelView();
     $leased_panel->setHeader('Leased Tasks');
     $leased_panel->appendChild($leased_table);
     $task_table = new PhabricatorWorkerTask();
     $queued = queryfx_all($task_table->establishConnection('r'), 'SELECT taskClass, count(*) N FROM %T GROUP BY taskClass
     ORDER BY N DESC', $task_table->getTableName());
     $rows = array();
     foreach ($queued as $row) {
         $rows[] = array(phutil_escape_html($row['taskClass']), number_format($row['N']));
     }
     $queued_table = new AphrontTableView($rows);
     $queued_table->setHeaders(array('Class', 'Count'));
     $queued_table->setColumnClasses(array('wide', 'n'));
     $queued_table->setNoDataString('Task queue is empty.');
     $queued_panel = new AphrontPanelView();
     $queued_panel->setHeader('Queued Tasks');
     $queued_panel->appendChild($queued_table);
     $cursors = id(new PhabricatorTimelineCursor())->loadAll();
     $rows = array();
     foreach ($cursors as $cursor) {
         $rows[] = array(phutil_escape_html($cursor->getName()), number_format($cursor->getPosition()));
     }
     $cursor_table = new AphrontTableView($rows);
     $cursor_table->setHeaders(array('Name', 'Position'));
     $cursor_table->setColumnClasses(array('wide', 'n'));
     $cursor_table->setNoDataString('No timeline cursors exist.');
     $cursor_panel = new AphrontPanelView();
     $cursor_panel->setHeader('Timeline Cursors');
     $cursor_panel->appendChild($cursor_table);
     $nav = $this->buildSideNavView();
     $nav->selectFilter('');
     $nav->appendChild(array($daemon_panel, $cursor_panel, $queued_panel, $leased_panel));
     return $this->buildApplicationPage($nav, array('title' => 'Console'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:54,代码来源:PhabricatorDaemonConsoleController.php

示例6: processRequest

 public function processRequest(AphrontRequest $request)
 {
     if ($request->getExists('new')) {
         return $this->processNew($request);
     }
     if ($request->getExists('edit')) {
         return $this->processEdit($request);
     }
     if ($request->getExists('delete')) {
         return $this->processDelete($request);
     }
     $user = $this->getUser();
     $viewer = $request->getUser();
     $factors = id(new PhabricatorAuthFactorConfig())->loadAllWhere('userPHID = %s', $user->getPHID());
     $rows = array();
     $rowc = array();
     $highlight_id = $request->getInt('id');
     foreach ($factors as $factor) {
         $impl = $factor->getImplementation();
         if ($impl) {
             $type = $impl->getFactorName();
         } else {
             $type = $factor->getFactorKey();
         }
         if ($factor->getID() == $highlight_id) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = null;
         }
         $rows[] = array(javelin_tag('a', array('href' => $this->getPanelURI('?edit=' . $factor->getID()), 'sigil' => 'workflow'), $factor->getFactorName()), $type, phabricator_datetime($factor->getDateCreated(), $viewer), javelin_tag('a', array('href' => $this->getPanelURI('?delete=' . $factor->getID()), 'sigil' => 'workflow', 'class' => 'small grey button'), pht('Remove')));
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString(pht("You haven't added any authentication factors to your account yet."));
     $table->setHeaders(array(pht('Name'), pht('Type'), pht('Created'), ''));
     $table->setColumnClasses(array('wide pri', '', 'right', 'action'));
     $table->setRowClasses($rowc);
     $table->setDeviceVisibility(array(true, false, false, true));
     $panel = new PHUIObjectBoxView();
     $header = new PHUIHeaderView();
     $help_uri = PhabricatorEnv::getDoclink('User Guide: Multi-Factor Authentication');
     $help_icon = id(new PHUIIconView())->setIconFont('fa-info-circle');
     $help_button = id(new PHUIButtonView())->setText(pht('Help'))->setHref($help_uri)->setTag('a')->setIcon($help_icon);
     $create_icon = id(new PHUIIconView())->setIconFont('fa-plus');
     $create_button = id(new PHUIButtonView())->setText(pht('Add Authentication Factor'))->setHref($this->getPanelURI('?new=true'))->setTag('a')->setWorkflow(true)->setIcon($create_icon);
     $header->setHeader(pht('Authentication Factors'));
     $header->addActionLink($help_button);
     $header->addActionLink($create_button);
     $panel->setHeader($header);
     $panel->setTable($table);
     return $panel;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:51,代码来源:PhabricatorMultiFactorSettingsPanel.php

示例7: buildClientList

 private function buildClientList($rows, $rowc, $title)
 {
     $table = new AphrontTableView($rows);
     $table->setRowClasses($rowc);
     $table->setHeaders(array('Client', 'ID', 'Secret', 'Redirect URI', ''));
     $table->setColumnClasses(array('', '', '', '', 'action'));
     if (empty($rows)) {
         $table->setNoDataString('You have not created any clients for this OAuthServer.');
     }
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     $panel->setHeader($title);
     return $panel;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:14,代码来源:PhabricatorOAuthClientListController.php

示例8: buildClientAuthorizationList

 private function buildClientAuthorizationList($rows, $rowc, $title)
 {
     $table = new AphrontTableView($rows);
     $table->setRowClasses($rowc);
     $table->setHeaders(array('Client', 'Scope', 'Created', 'Updated', ''));
     $table->setColumnClasses(array('wide pri', '', '', '', 'action'));
     if (empty($rows)) {
         $table->setNoDataString('You have not authorized any clients for this OAuthServer.');
     }
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     $panel->setHeader($title);
     return $panel;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:14,代码来源:PhabricatorOAuthClientAuthorizationListController.php

示例9: render

 public function render()
 {
     $user = $this->user;
     require_celerity_resource('phabricator-flag-css');
     $rows = array();
     foreach ($this->flags as $flag) {
         $class = PhabricatorFlagColor::getCSSClass($flag->getColor());
         $rows[] = array(phutil_render_tag('div', array('class' => 'phabricator-flag-icon ' . $class), ''), $flag->getHandle()->renderLink(), phutil_escape_html($flag->getNote()), phabricator_datetime($flag->getDateCreated(), $user), phabricator_render_form($user, array('method' => 'POST', 'action' => '/flag/edit/' . $flag->getObjectPHID() . '/', 'sigil' => 'workflow'), phutil_render_tag('button', array('class' => 'small grey'), 'Edit Flag')), phabricator_render_form($user, array('method' => 'POST', 'action' => '/flag/delete/' . $flag->getID() . '/', 'sigil' => 'workflow'), phutil_render_tag('button', array('class' => 'small grey'), 'Remove Flag')));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('', 'Flagged Object', 'Note', 'Flagged On', '', ''));
     $table->setColumnClasses(array('', 'pri', 'wide', '', 'action', 'action'));
     $table->setNoDataString('No flags.');
     return $table->render();
 }
开发者ID:relrod,项目名称:phabricator,代码行数:15,代码来源:PhabricatorFlagListView.php

示例10: render

 public function render()
 {
     $tasks = $this->getTasks();
     $rows = array();
     foreach ($tasks as $task) {
         $rows[] = array($task->getID(), $task->getTaskClass(), $task->getLeaseOwner(), $task->getLeaseExpires() ? phutil_format_relative_time($task->getLeaseExpires() - time()) : '-', $task->getPriority(), $task->getFailureCount(), phutil_tag('a', array('href' => '/daemon/task/' . $task->getID() . '/', 'class' => 'button small grey'), pht('View Task')));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array(pht('ID'), pht('Class'), pht('Owner'), pht('Expires'), pht('Priority'), pht('Failures'), ''));
     $table->setColumnClasses(array('n', 'wide', '', '', 'n', 'n', 'action'));
     if (strlen($this->getNoDataString())) {
         $table->setNoDataString($this->getNoDataString());
     }
     return $table;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:15,代码来源:PhabricatorDaemonTasksTableView.php

示例11: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     // TODO: It would be nice to simply disable this panel, but we can't do
     // viewer-based checks for enabled panels right now.
     $app_class = 'PhabricatorOAuthServerApplication';
     $installed = PhabricatorApplication::isClassInstalledForViewer($app_class, $viewer);
     if (!$installed) {
         $dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('OAuth Not Available'))->appendParagraph(pht('You do not have access to OAuth authorizations.'))->addCancelButton('/settings/');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     $authorizations = id(new PhabricatorOAuthClientAuthorizationQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->execute();
     $authorizations = mpull($authorizations, null, 'getID');
     $panel_uri = $this->getPanelURI();
     $revoke = $request->getInt('revoke');
     if ($revoke) {
         if (empty($authorizations[$revoke])) {
             return new Aphront404Response();
         }
         if ($request->isFormPost()) {
             $authorizations[$revoke]->delete();
             return id(new AphrontRedirectResponse())->setURI($panel_uri);
         }
         $dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('Revoke Authorization?'))->appendParagraph(pht('This application will no longer be able to access Phabricator ' . 'on your behalf.'))->addSubmitButton(pht('Revoke Authorization'))->addCancelButton($panel_uri);
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     $highlight = $request->getInt('id');
     $rows = array();
     $rowc = array();
     foreach ($authorizations as $authorization) {
         if ($highlight == $authorization->getID()) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = null;
         }
         $button = javelin_tag('a', array('href' => $this->getPanelURI('?revoke=' . $authorization->getID()), 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Revoke'));
         $rows[] = array(phutil_tag('a', array('href' => $authorization->getClient()->getViewURI()), $authorization->getClient()->getName()), $authorization->getScopeString(), phabricator_datetime($authorization->getDateCreated(), $viewer), phabricator_datetime($authorization->getDateModified(), $viewer), $button);
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString(pht("You haven't authorized any OAuth applications."));
     $table->setRowClasses($rowc);
     $table->setHeaders(array(pht('Application'), pht('Scope'), pht('Created'), pht('Updated'), null));
     $table->setColumnClasses(array('pri', 'wide', 'right', 'right', 'action'));
     $header = id(new PHUIHeaderView())->setHeader(pht('OAuth Application Authorizations'));
     $panel = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
     return $panel;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:47,代码来源:PhabricatorOAuthServerAuthorizationsSettingsPanel.php

示例12: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $user = $this->getUser();
     $tokens = id(new PhabricatorConduitTokenQuery())->setViewer($viewer)->withObjectPHIDs(array($user->getPHID()))->withExpired(false)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
     $rows = array();
     foreach ($tokens as $token) {
         $rows[] = array(javelin_tag('a', array('href' => '/conduit/token/edit/' . $token->getID() . '/', 'sigil' => 'workflow'), $token->getPublicTokenName()), PhabricatorConduitToken::getTokenTypeName($token->getTokenType()), phabricator_datetime($token->getDateCreated(), $viewer), $token->getExpires() ? phabricator_datetime($token->getExpires(), $viewer) : pht('Never'), javelin_tag('a', array('class' => 'button small grey', 'href' => '/conduit/token/terminate/' . $token->getID() . '/', 'sigil' => 'workflow'), pht('Terminate')));
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString(pht("You don't have any active API tokens."));
     $table->setHeaders(array(pht('Token'), pht('Type'), pht('Created'), pht('Expires'), null));
     $table->setColumnClasses(array('wide pri', '', 'right', 'right', 'action'));
     $generate_button = id(new PHUIButtonView())->setText(pht('Generate API Token'))->setHref('/conduit/token/edit/?objectPHID=' . $user->getPHID())->setTag('a')->setWorkflow(true)->setIcon('fa-plus');
     $terminate_button = id(new PHUIButtonView())->setText(pht('Terminate All Tokens'))->setHref('/conduit/token/terminate/?objectPHID=' . $user->getPHID())->setTag('a')->setWorkflow(true)->setIcon('fa-exclamation-triangle');
     $header = id(new PHUIHeaderView())->setHeader(pht('Active API Tokens'))->addActionLink($generate_button)->addActionLink($terminate_button);
     $panel = id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
     return $panel;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:19,代码来源:PhabricatorConduitTokensSettingsPanel.php

示例13: render

 public function render()
 {
     $rows = array();
     foreach ($this->commits as $commit) {
         $commit_name = $this->getHandle($commit->getPHID())->renderLink();
         $author_name = null;
         if ($commit->getAuthorPHID()) {
             $author_name = $this->getHandle($commit->getAuthorPHID())->renderLink();
         }
         $rows[] = array($commit_name, $author_name, phutil_escape_html($commit->getCommitData()->getSummary()), PhabricatorAuditCommitStatusConstants::getStatusName($commit->getAuditStatus()), phabricator_datetime($commit->getEpoch(), $this->user));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Commit', 'Author', 'Summary', 'Audit Status', 'Date'));
     $table->setColumnClasses(array('n', '', 'wide', '', ''));
     if ($this->noDataString) {
         $table->setNoDataString($this->noDataString);
     }
     return $table->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:19,代码来源:PhabricatorAuditCommitListView.php

示例14: render

 public function render()
 {
     $rows = array();
     // TODO: Experiment with path stack rendering.
     // TODO: Copy Away and Move Away are rendered junkily still.
     foreach ($this->pathChanges as $change) {
         $path = $change->getPath();
         $hash = substr(md5($path), 0, 8);
         if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $path .= '/';
         }
         $path_column = phutil_render_tag('a', array('href' => '#' . $hash), phutil_escape_html($path));
         $rows[] = array($this->linkHistory($change->getPath()), $this->linkBrowse($change->getPath()), $this->linkChange($change->getChangeType(), $change->getFileType(), $change->getPath()), $path_column);
     }
     $view = new AphrontTableView($rows);
     $view->setHeaders(array('History', 'Browse', 'Change', 'Path'));
     $view->setColumnClasses(array('', '', '', 'wide'));
     $view->setNoDataString('This change has not been fully parsed yet.');
     return $view->render();
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:20,代码来源:DiffusionCommitChangeTableView.php

示例15: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     $accounts = id(new PhabricatorExternalAccountQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
     $identity_phids = mpull($accounts, 'getPHID');
     $identity_phids[] = $viewer->getPHID();
     $sessions = id(new PhabricatorAuthSessionQuery())->setViewer($viewer)->withIdentityPHIDs($identity_phids)->execute();
     $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($identity_phids)->execute();
     $current_key = PhabricatorHash::digest($request->getCookie(PhabricatorCookies::COOKIE_SESSION));
     $rows = array();
     $rowc = array();
     foreach ($sessions as $session) {
         $is_current = phutil_hashes_are_identical($session->getSessionKey(), $current_key);
         if ($is_current) {
             $rowc[] = 'highlighted';
             $button = phutil_tag('a', array('class' => 'small grey button disabled'), pht('Current'));
         } else {
             $rowc[] = null;
             $button = javelin_tag('a', array('href' => '/auth/session/terminate/' . $session->getID() . '/', 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Terminate'));
         }
         $hisec = $session->getHighSecurityUntil() - time();
         $rows[] = array($handles[$session->getUserPHID()]->renderLink(), substr($session->getSessionKey(), 0, 6), $session->getType(), $hisec > 0 ? phutil_format_relative_time($hisec) : null, phabricator_datetime($session->getSessionStart(), $viewer), phabricator_date($session->getSessionExpires(), $viewer), $button);
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString(pht("You don't have any active sessions."));
     $table->setRowClasses($rowc);
     $table->setHeaders(array(pht('Identity'), pht('Session'), pht('Type'), pht('HiSec'), pht('Created'), pht('Expires'), pht('')));
     $table->setColumnClasses(array('wide', 'n', '', 'right', 'right', 'right', 'action'));
     $terminate_icon = id(new PHUIIconView())->setIconFont('fa-exclamation-triangle');
     $terminate_button = id(new PHUIButtonView())->setText(pht('Terminate All Sessions'))->setHref('/auth/session/terminate/all/')->setTag('a')->setWorkflow(true)->setIcon($terminate_icon);
     $header = id(new PHUIHeaderView())->setHeader(pht('Active Login Sessions'))->addActionLink($terminate_button);
     $hisec = $viewer->getSession()->getHighSecurityUntil() - time();
     if ($hisec > 0) {
         $hisec_icon = id(new PHUIIconView())->setIconFont('fa-lock');
         $hisec_button = id(new PHUIButtonView())->setText(pht('Leave High Security'))->setHref('/auth/session/downgrade/')->setTag('a')->setWorkflow(true)->setIcon($hisec_icon);
         $header->addActionLink($hisec_button);
     }
     $panel = id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
     return $panel;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:40,代码来源:PhabricatorSessionsSettingsPanel.php


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