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


PHP AphrontPagerView::sliceResults方法代码示例

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


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

示例1: executeWithOffsetPager

 public final function executeWithOffsetPager(AphrontPagerView $pager)
 {
     $this->setLimit($pager->getPageSize() + 1);
     $this->setOffset($pager->getOffset());
     $results = $this->execute();
     return $pager->sliceResults($results);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:7,代码来源:PhabricatorOffsetPagedQuery.php

示例2: processRequest

 public function processRequest()
 {
     $drequest = $this->getDiffusionRequest();
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $repository = $drequest->getRepository();
     $pager = new AphrontPagerView();
     $pager->setURI($request->getRequestURI(), 'offset');
     $pager->setOffset($request->getInt('offset'));
     // TODO: Add support for branches that contain commit
     $branches = $this->callConduitWithDiffusionRequest('diffusion.branchquery', array('offset' => $pager->getOffset(), 'limit' => $pager->getPageSize() + 1));
     $branches = $pager->sliceResults($branches);
     $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
     $content = null;
     if (!$branches) {
         $content = $this->renderStatusMessage(pht('No Branches'), pht('This repository has no branches.'));
     } else {
         $commits = id(new DiffusionCommitQuery())->setViewer($viewer)->withIdentifiers(mpull($branches, 'getCommitIdentifier'))->withRepository($repository)->execute();
         $view = id(new DiffusionBranchTableView())->setUser($viewer)->setBranches($branches)->setCommits($commits)->setDiffusionRequest($drequest);
         $panel = id(new AphrontPanelView())->setNoBackground(true)->appendChild($view)->appendChild($pager);
         $content = $panel;
     }
     $crumbs = $this->buildCrumbs(array('branches' => true));
     return $this->buildApplicationPage(array($crumbs, $content), array('title' => array(pht('Branches'), 'r' . $repository->getCallsign()), 'device' => false));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:DiffusionBranchTableController.php

示例3: processRequest

 public function processRequest()
 {
     $drequest = $this->getDiffusionRequest();
     $request = $this->getRequest();
     $user = $request->getUser();
     $repository = $drequest->getRepository();
     $pager = new AphrontPagerView();
     $pager->setURI($request->getRequestURI(), 'offset');
     $pager->setOffset($request->getInt('offset'));
     // TODO: Add support for branches that contain commit
     $query = DiffusionBranchQuery::newFromDiffusionRequest($drequest);
     $query->setOffset($pager->getOffset());
     $query->setLimit($pager->getPageSize() + 1);
     $branches = $query->loadBranches();
     $branches = $pager->sliceResults($branches);
     $content = null;
     if (!$branches) {
         $content = new AphrontErrorView();
         $content->setTitle('No Branches');
         $content->appendChild('This repository has no branches.');
         $content->setSeverity(AphrontErrorView::SEVERITY_NODATA);
     } else {
         $commits = id(new PhabricatorAuditCommitQuery())->withIdentifiers($drequest->getRepository()->getID(), mpull($branches, 'getHeadCommitIdentifier'))->needCommitData(true)->execute();
         $view = id(new DiffusionBranchTableView())->setBranches($branches)->setUser($user)->setCommits($commits)->setDiffusionRequest($drequest);
         $panel = id(new AphrontPanelView())->setHeader('Branches')->appendChild($view)->appendChild($pager);
         $content = $panel;
     }
     return $this->buildStandardPageResponse(array($this->buildCrumbs(array('branches' => true)), $content), array('title' => array('Branches', $repository->getCallsign() . ' Repository')));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:29,代码来源:DiffusionBranchTableController.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $conn_table = new PhabricatorConduitConnectionLog();
     $call_table = new PhabricatorConduitMethodCallLog();
     $conn_r = $call_table->establishConnection('r');
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $calls = $call_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $calls = $pager->sliceResults($calls);
     $pager->setURI(new PhutilURI('/conduit/log/'), 'page');
     $pager->setEnableKeyboardShortcuts(true);
     $min = $pager->getOffset() + 1;
     $max = $min + count($calls) - 1;
     $conn_ids = array_filter(mpull($calls, 'getConnectionID'));
     $conns = array();
     if ($conn_ids) {
         $conns = $conn_table->loadAllWhere('id IN (%Ld)', $conn_ids);
     }
     $table = $this->renderCallTable($calls, $conns);
     $panel = new AphrontPanelView();
     $panel->setHeader('Conduit Method Calls (' . $min . '-' . $max . ')');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $this->setShowSideNav(false);
     return $this->buildStandardPageResponse($panel, array('title' => 'Conduit Logs'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:27,代码来源:PhabricatorConduitLogController.php

示例5: 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

示例6: renderListPanel

 private function renderListPanel()
 {
     if (!$this->packagePHID) {
         return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle('No package seleted. Please select one from above.');
     }
     $package = id(new PhabricatorOwnersPackage())->loadOneWhere("phid = %s", $this->packagePHID);
     if ($this->view === 'audit' && !$package->getAuditingEnabled()) {
         return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle("Package doesn't have auditing enabled. " . "Please choose another one.");
     }
     $conn_r = id(new PhabricatorOwnersPackageCommitRelationship())->establishConnection('r');
     $status_arr = $this->getStatusArr();
     $offset = $this->request->getInt('offset', 0);
     $pager = new AphrontPagerView();
     $pager->setPageSize(50);
     $pager->setOffset($offset);
     $pager->setURI($this->request->getRequestURI(), 'offset');
     $data = queryfx_all($conn_r, 'SELECT commitPHID, auditStatus, auditReasons FROM %T
     WHERE packagePHID = %s AND auditStatus in (%Ls)
     ORDER BY id DESC
     LIMIT %d, %d', id(new PhabricatorOwnersPackageCommitRelationship())->getTableName(), $package->getPHID(), $status_arr, $pager->getOffset(), $pager->getPageSize() + 1);
     $data = $pager->sliceResults($data);
     $data = ipull($data, null, 'commitPHID');
     $list_panel = $this->renderCommitTable($data, $package);
     $list_panel->appendChild($pager);
     return $list_panel;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:26,代码来源:PhabricatorOwnerRelatedListController.php

示例7: loadDocuments

 private function loadDocuments(AphrontPagerView $pager)
 {
     // TODO: Do we want/need a query object for this?
     $document_dao = new PhrictionDocument();
     $content_dao = new PhrictionContent();
     $conn = $document_dao->establishConnection('r');
     switch ($this->view) {
         case 'all':
             $data = queryfx_all($conn, 'SELECT * FROM %T ORDER BY id DESC LIMIT %d, %d', $document_dao->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
             break;
         case 'updates':
             // TODO: This query is a little suspicious, verify we don't need to key
             // or change it once we get more data.
             $data = queryfx_all($conn, 'SELECT d.* FROM %T d JOIN %T c ON c.documentID = d.id
         GROUP BY c.documentID
         ORDER BY MAX(c.id) DESC LIMIT %d, %d', $document_dao->getTableName(), $content_dao->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
             break;
         default:
             throw new Exception("Unknown view '{$this->view}'!");
     }
     $data = $pager->sliceResults($data);
     $documents = $document_dao->loadAllFromArray($data);
     if ($documents) {
         $content = $content_dao->loadAllWhere('documentID IN (%Ld)', mpull($documents, 'getID'));
         $content = mpull($content, null, 'getDocumentID');
         foreach ($documents as $document) {
             $document->attachContent($content[$document->getID()]);
         }
     }
     return $documents;
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:31,代码来源:PhrictionListController.php

示例8: 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'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:28,代码来源:PhabricatorMetaMTAReceivedListController.php

示例9: loadPolls

 private function loadPolls(AphrontPagerView $pager, $view)
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $poll = new PhabricatorSlowvotePoll();
     $conn = $poll->establishConnection('r');
     $offset = $pager->getOffset();
     $limit = $pager->getPageSize() + 1;
     switch ($view) {
         case self::VIEW_ALL:
             $data = queryfx_all($conn, 'SELECT * FROM %T ORDER BY id DESC LIMIT %d, %d', $poll->getTableName(), $offset, $limit);
             break;
         case self::VIEW_CREATED:
             $data = queryfx_all($conn, 'SELECT * FROM %T WHERE authorPHID = %s ORDER BY id DESC
         LIMIT %d, %d', $poll->getTableName(), $user->getPHID(), $offset, $limit);
             break;
         case self::VIEW_VOTED:
             $choice = new PhabricatorSlowvoteChoice();
             $data = queryfx_all($conn, 'SELECT p.* FROM %T p JOIN %T o
         ON o.pollID = p.id
         WHERE o.authorPHID = %s
         GROUP BY p.id
         ORDER BY p.id DESC
         LIMIT %d, %d', $poll->getTableName(), $choice->getTableName(), $user->getPHID(), $offset, $limit);
             break;
     }
     $data = $pager->sliceResults($data);
     return $poll->loadAllFromArray($data);
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:29,代码来源:PhabricatorSlowvoteListController.php

示例10: 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

示例11: 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

示例12: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $nav = new AphrontSideNavView();
     $links = array('calls' => 'All Calls');
     if (empty($links[$this->view])) {
         $this->view = key($links);
     }
     foreach ($links as $slug => $name) {
         $nav->addNavItem(phutil_render_tag('a', array('href' => '/conduit/log/view/' . $slug . '/', 'class' => $slug == $this->view ? 'aphront-side-nav-selected' : null), phutil_escape_html($name)));
     }
     $conn_table = new PhabricatorConduitConnectionLog();
     $call_table = new PhabricatorConduitMethodCallLog();
     $conn_r = $call_table->establishConnection('r');
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $calls = $call_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $calls = $pager->sliceResults($calls);
     $pager->setURI(new PhutilURI('/conduit/log/view/' . $this->view . '/'), 'page');
     $pager->setEnableKeyboardShortcuts(true);
     $min = $pager->getOffset() + 1;
     $max = $min + count($calls) - 1;
     $conn_ids = array_filter(mpull($calls, 'getConnectionID'));
     $conns = array();
     if ($conn_ids) {
         $conns = $conn_table->loadAllWhere('id IN (%Ld)', $conn_ids);
     }
     $table = $this->renderCallTable($calls, $conns);
     $panel = new AphrontPanelView();
     $panel->setHeader('Conduit Method Calls (' . $min . '-' . $max . ')');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $nav->appendChild($panel);
     return $this->buildStandardPageResponse($nav, array('title' => 'Conduit Logs', 'tab' => 'logs'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:35,代码来源:PhabricatorConduitLogController.php

示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $offset = $request->getInt('offset', 0);
     $pager = new AphrontPagerView();
     $pager->setPageSize(250);
     $pager->setOffset($offset);
     $pager->setURI($request->getRequestURI(), 'offset');
     $list = new PhabricatorMetaMTAMailingList();
     $conn_r = $list->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT * FROM %T
     ORDER BY name ASC
     LIMIT %d, %d', $list->getTableName(), $pager->getOffset(), $pager->getPageSize() + 1);
     $data = $pager->sliceResults($data);
     $lists = $list->loadAllFromArray($data);
     $rows = array();
     foreach ($lists as $list) {
         $rows[] = array(phutil_escape_html($list->getName()), phutil_escape_html($list->getEmail()), phutil_render_tag('a', array('class' => 'button grey small', 'href' => $this->getApplicationURI('/edit/' . $list->getID() . '/')), 'Edit'));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Name', 'Email', ''));
     $table->setColumnClasses(array(null, 'wide', 'action'));
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     $panel->setHeader('Mailing Lists');
     $panel->setCreateButton('Add New List', $this->getApplicationURI('/edit/'));
     $panel->appendChild($pager);
     return $this->buildApplicationPage($panel, array('title' => 'Mailing Lists'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:30,代码来源:PhabricatorMailingListsListController.php

示例14: 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

示例15: processRequest

 public function processRequest()
 {
     // Get a page of mails together with pager.
     $request = $this->getRequest();
     $user = $request->getUser();
     $offset = $request->getInt('offset', 0);
     $related_phid = $request->getStr('phid');
     $status = $request->getStr('status');
     $pager = new AphrontPagerView();
     $pager->setOffset($offset);
     $pager->setURI($request->getRequestURI(), 'offset');
     $mail = new PhabricatorMetaMTAMail();
     $conn_r = $mail->establishConnection('r');
     $wheres = array();
     if ($status) {
         $wheres[] = qsprintf($conn_r, 'status = %s', $status);
     }
     if ($related_phid) {
         $wheres[] = qsprintf($conn_r, 'relatedPHID = %s', $related_phid);
     }
     if (count($wheres)) {
         $where_clause = 'WHERE ' . implode($wheres, ' AND ');
     } else {
         $where_clause = 'WHERE 1 = 1';
     }
     $data = queryfx_all($conn_r, 'SELECT * FROM %T
     %Q
     ORDER BY id DESC
     LIMIT %d, %d', $mail->getTableName(), $where_clause, $pager->getOffset(), $pager->getPageSize() + 1);
     $data = $pager->sliceResults($data);
     $mails = $mail->loadAllFromArray($data);
     // Render the details table.
     $rows = array();
     foreach ($mails as $mail) {
         $next_retry = $mail->getNextRetry() - time();
         if ($next_retry <= 0) {
             $next_retry = "None";
         } else {
             $next_retry = phabricator_format_relative_time_detailed($next_retry);
         }
         $rows[] = array(PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()), $mail->getRetryCount(), $next_retry, phabricator_datetime($mail->getDateCreated(), $user), phabricator_format_relative_time_detailed(time() - $mail->getDateModified()), phutil_escape_html($mail->getSubject()), phutil_render_tag('a', array('class' => 'button small grey', 'href' => $this->getApplicationURI('/view/' . $mail->getID() . '/')), 'View'));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Status', 'Retry', 'Next', 'Created', 'Updated', 'Subject', ''));
     $table->setColumnClasses(array(null, null, null, null, null, 'wide', 'action'));
     // Render the whole page.
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     $panel->setHeader('MetaMTA Messages');
     $panel->appendChild($pager);
     $nav = $this->buildSideNavView();
     $nav->selectFilter('sent');
     $nav->appendChild($panel);
     return $this->buildApplicationPage($nav, array('title' => 'Sent Mail'));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:55,代码来源:PhabricatorMetaMTAListController.php


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