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


PHP AphrontTableView类代码示例

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


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

示例1: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pager->setURI($request->getRequestURI(), 'page');
     $timers = id(new PhabricatorTimer())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $timers = $pager->sliceResults($timers);
     $phids = mpull($timers, 'getAuthorPHID');
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $rows = array();
     foreach ($timers as $timer) {
         $edit_button = null;
         $delete_button = null;
         if ($user->getIsAdmin() || $user->getPHID() == $timer->getAuthorPHID()) {
             $edit_button = phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/countdown/edit/' . $timer->getID() . '/'), 'Edit');
             $delete_button = javelin_render_tag('a', array('class' => 'small button grey', 'href' => '/countdown/delete/' . $timer->getID() . '/', 'sigil' => 'workflow'), 'Delete');
         }
         $rows[] = array(phutil_escape_html($timer->getID()), $handles[$timer->getAuthorPHID()]->renderLink(), phutil_render_tag('a', array('href' => '/countdown/' . $timer->getID() . '/'), phutil_escape_html($timer->getTitle())), phabricator_datetime($timer->getDatepoint(), $user), $edit_button, $delete_button);
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('ID', 'Author', 'Title', 'End Date', '', ''));
     $table->setColumnClasses(array(null, null, 'wide pri', null, 'action', 'action'));
     $panel = id(new AphrontPanelView())->appendChild($table)->setHeader('Timers')->setCreateButton('Create Timer', '/countdown/edit/')->appendChild($pager);
     return $this->buildStandardPageResponse($panel, array('title' => 'Countdown'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:27,代码来源:PhabricatorCountdownListController.php

示例2: renderServerStatus

 private function renderServerStatus(array $status)
 {
     $rows = array();
     foreach ($status as $key => $value) {
         switch ($key) {
             case 'uptime':
                 $value /= 1000;
                 $value = phutil_format_relative_time_detailed($value);
                 break;
             case 'log':
                 break;
             default:
                 $value = number_format($value);
                 break;
         }
         $rows[] = array($key, $value);
     }
     $table = new AphrontTableView($rows);
     $table->setColumnClasses(array('header', 'wide'));
     $test_icon = id(new PHUIIconView())->setIconFont('fa-exclamation-triangle');
     $test_button = id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setText(pht('Send Test Notification'))->setHref($this->getApplicationURI('test/'))->setIcon($test_icon);
     $header = id(new PHUIHeaderView())->setHeader(pht('Notification Server Status'))->addActionLink($test_button);
     $box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
     return $box;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:PhabricatorNotificationStatusController.php

示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $nav = $this->buildSideNav('resource');
     $pager = new AphrontPagerView();
     $pager->setURI(new PhutilURI('/drydock/resource/'), 'page');
     $data = id(new DrydockResource())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $data = $pager->sliceResults($data);
     $phids = mpull($data, 'getOwnerPHID');
     $handles = $this->loadViewerHandles($phids);
     $rows = array();
     foreach ($data as $resource) {
         $rows[] = array($resource->getID(), $resource->getOwnerPHID() ? $handles[$resource->getOwnerPHID()]->renderLink() : null, phutil_escape_html($resource->getType()), DrydockResourceStatus::getNameForStatus($resource->getStatus()), phutil_escape_html(nonempty($resource->getName(), 'Unnamed')), phabricator_datetime($resource->getDateCreated(), $user));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('ID', 'Owner', 'Type', 'Status', 'Resource', 'Created'));
     $table->setColumnClasses(array('', '', '', '', 'pri wide', 'right'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Drydock Resources');
     $panel->addButton(phutil_render_tag('a', array('href' => '/drydock/resource/allocate/', 'class' => 'green button'), 'Allocate Resource'));
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $nav->appendChild($panel);
     return $this->buildStandardPageResponse($nav, array('title' => 'Resources'));
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:26,代码来源:DrydockResourceListController.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $macro_table = new PhabricatorFileImageMacro();
     $macros = $macro_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize());
     // Get an exact count since the size here is reasonably going to be a few
     // thousand at most in any reasonable case.
     $count = queryfx_one($macro_table->establishConnection('r'), 'SELECT COUNT(*) N FROM %T', $macro_table->getTableName());
     $count = $count['N'];
     $pager->setCount($count);
     $pager->setURI($request->getRequestURI(), 'page');
     $rows = array();
     foreach ($macros as $macro) {
         $src = PhabricatorFileURI::getViewURIForPHID($macro->getFilePHID());
         $rows[] = array(phutil_render_tag('a', array('href' => '/file/macro/edit/' . $macro->getID() . '/'), phutil_escape_html($macro->getName())), phutil_render_tag('a', array('href' => $src, 'target' => '_blank'), phutil_render_tag('img', array('src' => $src))), javelin_render_tag('a', array('href' => '/file/macro/delete/' . $macro->getID() . '/', 'sigil' => 'workflow', 'class' => 'grey small button'), 'Delete'));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Name', 'Image', ''));
     $table->setColumnClasses(array('pri', 'wide thumb', 'action'));
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     $panel->setHeader('Image Macros');
     $panel->setCreateButton('New Image Macro', '/file/macro/edit/');
     $panel->appendChild($pager);
     return $this->buildStandardPageResponse($panel, array('title' => 'Image Macros', 'tab' => 'macros'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:28,代码来源:PhabricatorFileMacroListController.php

示例5: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $nav = $this->buildSideNav('lease');
     $pager = new AphrontPagerView();
     $pager->setURI(new PhutilURI('/drydock/lease/'), 'page');
     $data = id(new DrydockLease())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $data = $pager->sliceResults($data);
     $phids = mpull($data, 'getOwnerPHID');
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $resource_ids = mpull($data, 'getResourceID');
     $resources = array();
     if ($resource_ids) {
         $resources = id(new DrydockResource())->loadAllWhere('id IN (%Ld)', $resource_ids);
     }
     $rows = array();
     foreach ($data as $lease) {
         $resource = idx($resources, $lease->getResourceID());
         $rows[] = array($lease->getID(), DrydockLeaseStatus::getNameForStatus($lease->getStatus()), $lease->getOwnerPHID() ? $handles[$lease->getOwnerPHID()]->renderLink() : null, $lease->getResourceID(), $resource ? phutil_escape_html($resource->getName()) : null, phabricator_datetime($lease->getDateCreated(), $user));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('ID', 'Status', 'Owner', 'Resource ID', 'Resource', 'Created'));
     $table->setColumnClasses(array('', '', '', '', 'wide pri', 'right'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Drydock Leases');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $nav->appendChild($panel);
     return $this->buildStandardPageResponse($nav, array('title' => 'Leases'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:31,代码来源:DrydockLeaseListController.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $nav = $this->buildSideNav('log');
     $query = new DrydockLogQuery();
     $resource_ids = $request->getStrList('resource');
     if ($resource_ids) {
         $query->withResourceIDs($resource_ids);
     }
     $lease_ids = $request->getStrList('lease');
     if ($lease_ids) {
         $query->withLeaseIDs($lease_ids);
     }
     $pager = new AphrontPagerView();
     $pager->setPageSize(500);
     $pager->setOffset($request->getInt('offset'));
     $pager->setURI($request->getRequestURI(), 'offset');
     $logs = $query->executeWithOffsetPager($pager);
     $rows = array();
     foreach ($logs as $log) {
         $rows[] = array($log->getResourceID(), $log->getLeaseID(), phutil_escape_html($log->getMessage()), phabricator_datetime($log->getEpoch(), $user));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Resource', 'Lease', 'Message', 'Date'));
     $table->setColumnClasses(array('', '', 'wide', ''));
     $panel = new AphrontPanelView();
     $panel->setHeader('Drydock Logs');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $nav->appendChild($panel);
     return $this->buildStandardPageResponse($nav, array('title' => 'Logs'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:33,代码来源:DrydockLogController.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pastes = id(new PhabricatorPaste())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $pastes = $pager->sliceResults($pastes);
     $pager->setURI($request->getRequestURI(), 'page');
     $phids = mpull($pastes, 'getAuthorPHID');
     $handles = array();
     if ($phids) {
         $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     }
     $rows = array();
     foreach ($pastes as $paste) {
         $handle = $handles[$paste->getAuthorPHID()];
         $rows[] = array(phutil_escape_html('P' . $paste->getID()), phutil_render_tag('a', array('href' => '/p/' . $handle->getName() . '/'), phutil_escape_html($handle->getName())), phutil_escape_html($paste->getLanguage()), phutil_render_tag('a', array('href' => '/P' . $paste->getID()), phutil_escape_html(nonempty($paste->getTitle(), 'Untitled Masterwork P' . $paste->getID()))), phutil_render_tag('a', array('href' => PhabricatorFileURI::getViewURIForPHID($paste->getFilePHID())), phutil_escape_html($paste->getFilePHID())));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Paste ID', 'Author', 'Language', 'Title', 'File'));
     $table->setColumnClasses(array(null, null, null, 'wide pri', null));
     $panel = new AphrontPanelView();
     $panel->setWidth(AphrontPanelView::WIDTH_FULL);
     $panel->setHeader("Paste");
     $panel->setCreateButton('Paste Something', '/paste/');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     return $this->buildStandardPageResponse($panel, array('title' => 'Paste List', 'tab' => 'list'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:29,代码来源:PhabricatorPasteListController.php

示例8: render

 public function render()
 {
     $drequest = $this->getDiffusionRequest();
     $handles = $this->handles;
     $rows = array();
     foreach ($this->history as $history) {
         $epoch = $history->getEpoch();
         if ($epoch) {
             $date = date('M j, Y', $epoch);
             $time = date('g:i A', $epoch);
         } else {
             $date = null;
             $time = null;
         }
         $data = $history->getCommitData();
         $author_phid = null;
         if ($data) {
             $author_phid = $data->getCommitDetail('authorPHID');
         }
         if ($author_phid && isset($handles[$author_phid])) {
             $author = $handles[$author_phid]->renderLink();
         } else {
             $author = phutil_escape_html($history->getAuthorName());
         }
         $rows[] = array($this->linkBrowse($drequest->getPath(), array('commit' => $history->getCommitIdentifier())), self::linkCommit($drequest->getRepository(), $history->getCommitIdentifier()), $this->linkChange($history->getChangeType(), $history->getFileType(), null, $history->getCommitIdentifier()), $date, $time, $author, phutil_escape_html($history->getSummary()));
     }
     $view = new AphrontTableView($rows);
     $view->setHeaders(array('Browse', 'Commit', 'Change', 'Date', 'Time', 'Author', 'Details'));
     $view->setColumnClasses(array('', 'n', '', '', 'right', '', 'wide wrap'));
     return $view->render();
 }
开发者ID:hunterbridges,项目名称:phabricator,代码行数:31,代码来源:DiffusionHistoryTableView.php

示例9: 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();
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:26,代码来源:PhabricatorDaemonLogListView.php

示例10: processRequest

 public function processRequest()
 {
     $method_groups = $this->getMethodFilters();
     $rows = array();
     foreach ($method_groups as $group => $methods) {
         foreach ($methods as $info) {
             switch ($info['status']) {
                 case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
                     $status = 'Deprecated';
                     break;
                 case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
                     $status = 'Unstable';
                     break;
                 default:
                     $status = null;
                     break;
             }
             $rows[] = array($group, phutil_render_tag('a', array('href' => '/conduit/method/' . $info['full_name']), phutil_escape_html($info['full_name'])), $info['description'], $status);
             $group = null;
         }
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Group', 'Name', 'Description', 'Status'));
     $table->setColumnClasses(array('pri', 'pri', 'wide', null));
     $panel = new AphrontPanelView();
     $panel->setHeader('Conduit Methods');
     $panel->appendChild($table);
     $panel->setWidth(AphrontPanelView::WIDTH_FULL);
     $utils = new AphrontPanelView();
     $utils->setHeader('Utilities');
     $utils->appendChild('<ul>' . '<li><a href="/conduit/log/">Log</a> - Conduit Method Calls</li>' . '<li><a href="/conduit/token/">Token</a> - Certificate Install</li>' . '</ul>');
     $utils->setWidth(AphrontPanelView::WIDTH_FULL);
     $this->setShowSideNav(false);
     return $this->buildStandardPageResponse(array($panel, $utils), array('title' => 'Conduit Console'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:35,代码来源:PhabricatorConduitListController.php

示例11: render

 public function render()
 {
     $user = $this->getUser();
     $blogs = $this->getBlogs();
     $panel = new AphrontPanelView();
     if (empty($blogs)) {
         $panel = id(new AphrontPanelView())->setHeader('No blogs... Yet!')->setCaption('Will you answer the call to phame?')->setCreateButton('New Blog', '/phame/blog/new');
         return $panel->render();
     }
     $table_data = array();
     foreach ($blogs as $blog) {
         $view_link = phutil_render_tag('a', array('href' => $blog->getViewURI()), phutil_escape_html($blog->getName()));
         $bloggers = $blog->getBloggers();
         if (isset($bloggers[$user->getPHID()])) {
             $edit = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $blog->getEditURI()), 'Edit');
         } else {
             $edit = null;
         }
         $view = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $blog->getViewURI()), 'View');
         $table_data[] = array($view_link, implode(', ', mpull($blog->getBloggers(), 'renderLink')), $view, $edit);
     }
     $table = new AphrontTableView($table_data);
     $table->setHeaders(array('Name', 'Bloggers', '', ''));
     $table->setColumnClasses(array(null, null, 'action', 'action'));
     $panel->setCreateButton('Create a Blog', '/phame/blog/new/');
     $panel->setHeader($this->getHeader());
     $panel->appendChild($table);
     return $panel->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:29,代码来源:PhameBlogListView.php

示例12: renderConfigurationFooter

 public function renderConfigurationFooter()
 {
     $hashers = PhabricatorPasswordHasher::getAllHashers();
     $hashers = msort($hashers, 'getStrength');
     $hashers = array_reverse($hashers);
     $yes = phutil_tag('strong', array('style' => 'color: #009900'), pht('Yes'));
     $no = phutil_tag('strong', array('style' => 'color: #990000'), pht('Not Installed'));
     $best_hasher_name = null;
     try {
         $best_hasher = PhabricatorPasswordHasher::getBestHasher();
         $best_hasher_name = $best_hasher->getHashName();
     } catch (PhabricatorPasswordHasherUnavailableException $ex) {
         // There are no suitable hashers. The user might be able to enable some,
         // so we don't want to fatal here. We'll fatal when users try to actually
         // use this stuff if it isn't fixed before then. Until then, we just
         // don't highlight a row. In practice, at least one hasher should always
         // be available.
     }
     $rows = array();
     $rowc = array();
     foreach ($hashers as $hasher) {
         $is_installed = $hasher->canHashPasswords();
         $rows[] = array($hasher->getHumanReadableName(), $hasher->getHashName(), $hasher->getHumanReadableStrength(), $is_installed ? $yes : $no, $is_installed ? null : $hasher->getInstallInstructions());
         $rowc[] = $best_hasher_name == $hasher->getHashName() ? 'highlighted' : null;
     }
     $table = new AphrontTableView($rows);
     $table->setRowClasses($rowc);
     $table->setHeaders(array(pht('Algorithm'), pht('Name'), pht('Strength'), pht('Installed'), pht('Install Instructions')));
     $table->setColumnClasses(array('', '', '', '', 'wide'));
     $header = id(new PHUIHeaderView())->setHeader(pht('Password Hash Algorithms'))->setSubheader(pht('Stronger algorithms are listed first. The highlighted algorithm ' . 'will be used when storing new hashes. Older hashes will be ' . 'upgraded to the best algorithm over time.'));
     return id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:32,代码来源:PhabricatorPasswordAuthProvider.php

示例13: render

 public function render()
 {
     $data = $this->getData();
     $lib_data = $data['libraries'];
     $lib_rows = array();
     foreach ($lib_data as $key => $value) {
         $lib_rows[] = array(phutil_escape_html($key), phutil_escape_html($value));
     }
     $lib_table = new AphrontTableView($lib_rows);
     $lib_table->setHeaders(array('Library', 'Loaded From'));
     $lib_table->setColumnClasses(array('header', 'wide wrap'));
     $config_data = $data['config'];
     ksort($config_data);
     $mask = PhabricatorEnv::getEnvConfig('darkconsole.config-mask');
     $mask = array_fill_keys($mask, true);
     foreach ($mask as $masked_key => $ignored) {
         if (!PhabricatorEnv::envConfigExists($masked_key)) {
             throw new Exception("Configuration 'darkconsole.config-mask' masks unknown " . "configuration key '" . $masked_key . "'. If this key has been " . "renamed, you might be accidentally exposing information which you " . "don't intend to.");
         }
     }
     $rows = array();
     foreach ($config_data as $key => $value) {
         if (empty($mask[$key])) {
             $display_value = is_array($value) ? json_encode($value) : $value;
             $display_value = phutil_escape_html($display_value);
         } else {
             $display_value = phutil_escape_html('<Masked>');
         }
         $rows[] = array(phutil_escape_html($key), $display_value);
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Key', 'Value'));
     $table->setColumnClasses(array('header', 'wide wrap'));
     return $lib_table->render() . $table->render();
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:35,代码来源:DarkConsoleConfigPlugin.php

示例14: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $uri = new PhutilURI('/fact/chart/');
         $uri->setQueryParam('y1', $request->getStr('y1'));
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $types = array('+N:*', '+N:DREV', 'updated');
     $engines = PhabricatorFactEngine::loadAllEngines();
     $specs = PhabricatorFactSpec::newSpecsForFactTypes($engines, $types);
     $facts = id(new PhabricatorFactAggregate())->loadAllWhere('factType IN (%Ls)', $types);
     $rows = array();
     foreach ($facts as $fact) {
         $spec = $specs[$fact->getFactType()];
         $name = $spec->getName();
         $value = $spec->formatValueForDisplay($user, $fact->getValueX());
         $rows[] = array(phutil_escape_html($name), phutil_escape_html($value));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Fact', 'Value'));
     $table->setColumnClasses(array('wide', 'n'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Facts!');
     $panel->appendChild($table);
     $chart_form = $this->buildChartForm();
     return $this->buildStandardPageResponse(array($chart_form, $panel), array('title' => 'Facts!'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:29,代码来源:PhabricatorFactHomeController.php

示例15: 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();
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:33,代码来源:DifferentialRevisionListView.php


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