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


PHP AphrontPagerView::setPageSize方法代码示例

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


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

示例1: processRequest

 public function processRequest()
 {
     $drequest = $this->diffusionRequest;
     $request = $this->getRequest();
     $page_size = $request->getInt('pagesize', 100);
     $offset = $request->getInt('page', 0);
     $history_query = DiffusionHistoryQuery::newFromDiffusionRequest($drequest);
     $history_query->setOffset($offset);
     $history_query->setLimit($page_size + 1);
     if (!$request->getBool('copies')) {
         $history_query->needDirectChanges(true);
         $history_query->needChildChanges(true);
     }
     $history = $history_query->loadHistory();
     $phids = array();
     foreach ($history as $item) {
         $data = $item->getCommitData();
         if ($data) {
             if ($data->getCommitDetail('authorPHID')) {
                 $phids[$data->getCommitDetail('authorPHID')] = true;
             }
         }
     }
     $phids = array_keys($phids);
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $pager = new AphrontPagerView();
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     if (count($history) == $page_size + 1) {
         array_pop($history);
         $pager->setHasMorePages(true);
     } else {
         $pager->setHasMorePages(false);
     }
     $pager->setURI($request->getRequestURI(), 'page');
     $content = array();
     $content[] = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
     if ($request->getBool('copies')) {
         $button_title = 'Hide Copies/Branches';
     } else {
         $button_title = 'Show Copies/Branches';
     }
     $button_uri = $request->getRequestURI()->alter('copies', !$request->getBool('copies'));
     $button = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $button_uri), phutil_escape_html($button_title));
     $history_table = new DiffusionHistoryTableView();
     $history_table->setDiffusionRequest($drequest);
     $history_table->setHandles($handles);
     $history_table->setHistory($history);
     $history_panel = new AphrontPanelView();
     $history_panel->setHeader('History');
     $history_panel->addButton($button);
     $history_panel->appendChild($history_table);
     $history_panel->appendChild($pager);
     $content[] = $history_panel;
     // TODO: Sometimes we do have a change view, we need to look at the most
     // recent history entry to figure it out.
     $nav = $this->buildSideNav('history', false);
     $nav->appendChild($content);
     return $this->buildStandardPageResponse($nav, array('title' => 'history'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:60,代码来源:DiffusionHistoryController.php

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

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

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

示例5: processRequest

 public function processRequest()
 {
     $title = 'OAuth Clients';
     $request = $this->getRequest();
     $current_user = $request->getUser();
     $offset = $request->getInt('offset', 0);
     $page_size = 100;
     $pager = new AphrontPagerView();
     $request_uri = $request->getRequestURI();
     $pager->setURI($request_uri, 'offset');
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     $query = new PhabricatorOAuthServerClientQuery();
     $query->withCreatorPHIDs(array($current_user->getPHID()));
     $clients = $query->executeWithPager($pager);
     $rows = array();
     $rowc = array();
     $highlight = $this->getHighlightPHIDs();
     foreach ($clients as $client) {
         $row = array(phutil_render_tag('a', array('href' => $client->getViewURI()), phutil_escape_html($client->getName())), $client->getPHID(), $client->getSecret(), phutil_render_tag('a', array('href' => $client->getRedirectURI()), phutil_escape_html($client->getRedirectURI())), phutil_render_tag('a', array('class' => 'small button grey', 'href' => $client->getEditURI()), 'Edit'));
         $rows[] = $row;
         if (isset($highlight[$client->getPHID()])) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = '';
         }
     }
     $panel = $this->buildClientList($rows, $rowc, $title);
     return $this->buildStandardPageResponse(array($this->getNoticeView(), $panel->appendChild($pager)), array('title' => $title));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:30,代码来源:PhabricatorOAuthClientListController.php

示例6: processRequest

 public function processRequest()
 {
     $drequest = $this->diffusionRequest;
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $repository = $drequest->getRepository();
     $page_size = $request->getInt('pagesize', 100);
     $offset = $request->getInt('offset', 0);
     $params = array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => $offset, 'limit' => $page_size + 1);
     if (!$request->getBool('copies')) {
         $params['needDirectChanges'] = true;
         $params['needChildChanges'] = true;
     }
     $history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', $params);
     $history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
     $pager = new AphrontPagerView();
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     $history = $pager->sliceResults($history);
     $pager->setURI($request->getRequestURI(), 'offset');
     $show_graph = !strlen($drequest->getPath());
     $content = array();
     $history_table = new DiffusionHistoryTableView();
     $history_table->setUser($request->getUser());
     $history_table->setDiffusionRequest($drequest);
     $history_table->setHistory($history);
     $history_table->loadRevisions();
     $phids = $history_table->getRequiredHandlePHIDs();
     $handles = $this->loadViewerHandles($phids);
     $history_table->setHandles($handles);
     if ($show_graph) {
         $history_table->setParents($history_results['parents']);
         $history_table->setIsHead($offset == 0);
     }
     $history_panel = new AphrontPanelView();
     $history_panel->appendChild($history_table);
     $history_panel->appendChild($pager);
     $history_panel->setNoBackground();
     $content[] = $history_panel;
     $header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($repository)->setHeader($this->renderPathLinks($drequest, $mode = 'history'));
     $actions = $this->buildActionView($drequest);
     $properties = $this->buildPropertyView($drequest, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
     return $this->buildApplicationPage(array($crumbs, $object_box, $content), array('title' => array(pht('History'), pht('%s Repository', $drequest->getRepository()->getCallsign()))));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:46,代码来源:DiffusionHistoryController.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $this->viewPHID = nonempty($request->getStr('phid'), null);
     if ($request->isFormPost()) {
         $phid_arr = $request->getArr('view_user');
         $view_target = head($phid_arr);
         return id(new AphrontRedirectResponse())->setURI($request->getRequestURI()->alter('phid', $view_target));
     }
     $map = HeraldContentTypeConfig::getContentTypeMap();
     if (empty($map[$this->view])) {
         reset($map);
         $this->view = key($map);
     }
     $offset = $request->getInt('offset', 0);
     $pager = new AphrontPagerView();
     $pager->setPageSize(50);
     $pager->setOffset($offset);
     $pager->setURI($request->getRequestURI(), 'offset');
     list($rules, $handles) = $this->queryRules($pager);
     if (!$this->viewPHID) {
         $view_users = array();
     } else {
         $view_users = array($this->viewPHID => $handles[$this->viewPHID]->getFullName());
     }
     $filter_form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/users/')->setLabel('View User')->setName('view_user')->setValue($view_users)->setLimit(1));
     $filter_view = new AphrontListFilterView();
     $filter_view->appendChild($filter_form);
     $list_view = id(new HeraldRuleListView())->setRules($rules)->setHandles($handles)->setMap($map)->setAllowCreation(false)->setView($this->view);
     $panel = $list_view->render();
     $panel->appendChild($pager);
     $sidenav = new AphrontSideNavView();
     $sidenav->appendChild($filter_view);
     $sidenav->appendChild($panel);
     $query = '';
     if ($this->viewPHID) {
         $query = '?phid=' . $this->viewPHID;
     }
     foreach ($map as $key => $value) {
         $sidenav->addNavItem(phutil_render_tag('a', array('href' => '/herald/all/view/' . $key . '/' . $query, 'class' => $key == $this->view ? 'aphront-side-nav-selected' : null), phutil_escape_html($value)));
     }
     return $this->buildStandardPageResponse(array($filter_view, $panel), array('title' => 'Herald', 'tab' => 'all'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:44,代码来源:HeraldAllRulesController.php

示例8: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pager->setPageSize(1000);
     $events = id(new PhabricatorDaemonLogEvent())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     $events = $pager->sliceResults($events);
     $pager->setURI($request->getRequestURI(), 'page');
     $event_view = new PhabricatorDaemonLogEventsView();
     $event_view->setEvents($events);
     $event_view->setUser($request->getUser());
     $event_view->setCombinedLog(true);
     $log_panel = new AphrontPanelView();
     $log_panel->setHeader('Combined Daemon Logs');
     $log_panel->appendChild($event_view);
     $log_panel->appendChild($pager);
     return $this->buildStandardPageResponse($log_panel, array('title' => 'Combined Daemon Log'));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:19,代码来源:PhabricatorDaemonCombinedLogController.php

示例9: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $offset = $request->getInt('offset', 0);
     $page_size = 1000;
     $pager = new AphrontPagerView();
     $request_uri = $request->getRequestURI();
     $pager->setURI($request_uri, 'offset');
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     $query = new PhabricatorChatLogQuery();
     $query->withChannels(array($this->channel));
     $logs = $query->executeWithPager($pager);
     require_celerity_resource('phabricator-chatlog-css');
     $last_author = null;
     $last_epoch = null;
     $row_idx = 0;
     $row_colors = array('normal', 'alternate');
     $out = array();
     $out[] = '<table class="phabricator-chat-log">';
     foreach ($logs as $log) {
         $this_author = $log->getAuthor();
         $this_epoch = $log->getEpoch();
         if ($this_author !== $last_author || $this_epoch - 60 * 5 > $last_epoch) {
             ++$row_idx;
             $out[] = '<tr class="initial ' . $row_colors[$row_idx % 2] . '">';
             $out[] = '<td class="timestamp">' . phabricator_datetime($log->getEpoch(), $user) . '</td>';
             $author = $log->getAuthor();
             $author = phutil_utf8_shorten($author, 18);
             $out[] = '<td class="author">' . phutil_escape_html($author) . '</td>';
         } else {
             $out[] = '<tr class="' . $row_colors[$row_idx % 2] . '">';
             $out[] = '<td class="similar" colspan="2"></td>';
         }
         $out[] = '<td class="message">' . phutil_escape_html($log->getMessage()) . '</td>';
         $out[] = '</tr>';
         $last_author = $this_author;
         $last_epoch = $this_epoch;
     }
     $out[] = '</table>';
     return $this->buildStandardPageResponse(array(implode("\n", $out), $pager), array('title' => 'Channel Log'));
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:43,代码来源:PhabricatorChatLogChannelLogController.php

示例10: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $pager = new AphrontPagerView();
     $page_size = 50;
     $pager->setURI($request->getRequestURI(), 'offset');
     $pager->setPageSize($page_size);
     $pager->setOffset($request->getInt('offset'));
     if ($this->getBloggerName()) {
         $blogger = id(new PhabricatorUser())->loadOneWhere('username = %s', $this->getBloggerName());
         if (!$blogger) {
             return new Aphront404Response();
         }
         $page_title = 'Posts by ' . $this->getBloggerName();
         if ($blogger->getPHID() == $user->getPHID()) {
             $actions = array('view', 'edit');
         } else {
             $actions = array('view');
         }
         $this->setShowSideNav(false);
     } else {
         $blogger = $user;
         $page_title = 'Posts by ' . $user->getUserName();
         $actions = array('view', 'edit');
         $this->setShowSideNav(true);
     }
     $phid = $blogger->getPHID();
     // user gets to see their own unpublished stuff
     if ($phid == $user->getPHID() && $this->isDraft()) {
         $post_visibility = PhamePost::VISIBILITY_DRAFT;
     } else {
         $post_visibility = PhamePost::VISIBILITY_PUBLISHED;
     }
     $query = new PhamePostQuery();
     $query->withBloggerPHID($phid);
     $query->withVisibility($post_visibility);
     $posts = $query->executeWithPager($pager);
     $bloggers = array($blogger->getPHID() => $blogger);
     $panel = id(new PhamePostListView())->setUser($user)->setBloggers($bloggers)->setPosts($posts)->setActions($actions)->setDraftList($this->isDraft());
     return $this->buildStandardPageResponse(array($panel, $pager), array('title' => $page_title));
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:42,代码来源:PhamePostListBaseController.php

示例11: processRequest

 public function processRequest()
 {
     $title = 'OAuth Client Authorizations';
     $request = $this->getRequest();
     $current_user = $request->getUser();
     $offset = $request->getInt('offset', 0);
     $page_size = 100;
     $pager = new AphrontPagerView();
     $request_uri = $request->getRequestURI();
     $pager->setURI($request_uri, 'offset');
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     $query = new PhabricatorOAuthClientAuthorizationQuery();
     $query->withUserPHIDs(array($current_user->getPHID()));
     $authorizations = $query->executeWithOffsetPager($pager);
     $client_authorizations = mpull($authorizations, null, 'getClientPHID');
     $client_phids = array_keys($client_authorizations);
     if ($client_phids) {
         $clients = id(new PhabricatorOAuthServerClient())->loadAllWhere('phid in (%Ls)', $client_phids);
     } else {
         $clients = array();
     }
     $client_dict = mpull($clients, null, 'getPHID');
     $rows = array();
     $rowc = array();
     $highlight = $this->getHighlightPHIDs();
     foreach ($client_authorizations as $client_phid => $authorization) {
         $client = $client_dict[$client_phid];
         $created = phabricator_datetime($authorization->getDateCreated(), $current_user);
         $updated = phabricator_datetime($authorization->getDateModified(), $current_user);
         $scope_doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html#scopes');
         $row = array(phutil_render_tag('a', array('href' => $client->getViewURI()), phutil_escape_html($client->getName())), phutil_render_tag('a', array('href' => $scope_doc_href), $authorization->getScopeString()), phabricator_datetime($authorization->getDateCreated(), $current_user), phabricator_datetime($authorization->getDateModified(), $current_user), phutil_render_tag('a', array('class' => 'small button grey', 'href' => $authorization->getEditURI()), 'Edit'));
         $rows[] = $row;
         if (isset($highlight[$authorization->getPHID()])) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = '';
         }
     }
     $panel = $this->buildClientAuthorizationList($rows, $rowc, $title);
     return $this->buildStandardPageResponse(array($this->getNoticeView(), $panel->appendChild($pager)), array('title' => $title));
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:42,代码来源:PhabricatorOAuthClientAuthorizationListController.php

示例12: renderSearchResults

 private function renderSearchResults()
 {
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $results = array();
     $limit = 100;
     $page = $this->getRequest()->getInt('page', 0);
     $pager = new AphrontPagerView();
     $pager->setPageSize($limit);
     $pager->setOffset($page);
     $pager->setURI($this->getRequest()->getRequestURI(), 'page');
     $search_mode = null;
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $results = array();
             break;
         default:
             if (strlen($this->getRequest()->getStr('grep'))) {
                 $search_mode = 'grep';
                 $query_string = $this->getRequest()->getStr('grep');
                 $results = $this->callConduitWithDiffusionRequest('diffusion.searchquery', array('grep' => $query_string, 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page));
             } else {
                 // Filename search.
                 $search_mode = 'find';
                 $query_string = $this->getRequest()->getStr('find');
                 $results = $this->callConduitWithDiffusionRequest('diffusion.querypaths', array('pattern' => $query_string, 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page));
             }
             break;
     }
     $results = $pager->sliceResults($results);
     if ($search_mode == 'grep') {
         $table = $this->renderGrepResults($results, $query_string);
         $header = pht('File content matching "%s" under "%s"', $query_string, nonempty($drequest->getPath(), '/'));
     } else {
         $table = $this->renderFindResults($results);
         $header = pht('Paths matching "%s" under "%s"', $query_string, nonempty($drequest->getPath(), '/'));
     }
     $box = id(new PHUIObjectBoxView())->setHeaderText($header)->appendChild($table);
     $pager_box = id(new PHUIBoxView())->addMargin(PHUI::MARGIN_LARGE)->appendChild($pager);
     return array($box, $pager_box);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:41,代码来源:DiffusionBrowseSearchController.php

示例13: renderSearchResults

 private function renderSearchResults()
 {
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $results = array();
     $limit = 100;
     $page = $this->getRequest()->getInt('page', 0);
     $pager = new AphrontPagerView();
     $pager->setPageSize($limit);
     $pager->setOffset($page);
     $pager->setURI($this->getRequest()->getRequestURI(), 'page');
     $search_mode = null;
     try {
         if (strlen($this->getRequest()->getStr('grep'))) {
             $search_mode = 'grep';
             $query_string = $this->getRequest()->getStr('grep');
             $results = $this->callConduitWithDiffusionRequest('diffusion.searchquery', array('grep' => $query_string, 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page));
         } else {
             // Filename search.
             $search_mode = 'find';
             $query_string = $this->getRequest()->getStr('find');
             $results = $this->callConduitWithDiffusionRequest('diffusion.querypaths', array('pattern' => $query_string, 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page));
         }
     } catch (ConduitException $ex) {
         $err = $ex->getErrorDescription();
         if ($err != '') {
             return id(new AphrontErrorView())->setTitle(pht('Search Error'))->appendChild($err);
         }
     }
     $results = $pager->sliceResults($results);
     if ($search_mode == 'grep') {
         $table = $this->renderGrepResults($results);
         $header = pht('File content matching "%s" under "%s"', $query_string, nonempty($drequest->getPath(), '/'));
     } else {
         $table = $this->renderFindResults($results);
         $header = pht('Paths matching "%s" under "%s"', $query_string, nonempty($drequest->getPath(), '/'));
     }
     $box = id(new PHUIObjectBoxView())->setHeaderText($header)->appendChild($table);
     $pager_box = id(new PHUIBoxView())->addMargin(PHUI::MARGIN_LARGE)->appendChild($pager);
     return array($box, $pager_box);
 }
开发者ID:sethkontny,项目名称:phabricator,代码行数:41,代码来源:DiffusionBrowseSearchController.php

示例14: renderExample

 public function renderExample()
 {
     $request = $this->getRequest();
     $offset = (int) $request->getInt('offset');
     $page_size = 20;
     $item_count = 173;
     $rows = array();
     for ($ii = $offset; $ii < min($item_count, $offset + $page_size); $ii++) {
         $rows[] = array(pht('Item #%d', $ii + 1));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Item'));
     $panel = new PHUIObjectBoxView();
     $panel->setHeaderText(pht('Example'));
     $panel->appendChild($table);
     $panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('Use %s to render a pager element.', phutil_tag('tt', array(), 'AphrontPagerView'))));
     $pager = new AphrontPagerView();
     $pager->setPageSize($page_size);
     $pager->setOffset($offset);
     $pager->setCount($item_count);
     $pager->setURI($request->getRequestURI(), 'offset');
     $panel->appendChild($pager);
     $panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('You can show more or fewer pages of surrounding context.')));
     $many_pages_pager = new AphrontPagerView();
     $many_pages_pager->setPageSize($page_size);
     $many_pages_pager->setOffset($offset);
     $many_pages_pager->setCount($item_count);
     $many_pages_pager->setURI($request->getRequestURI(), 'offset');
     $many_pages_pager->setSurroundingPages(7);
     $panel->appendChild($many_pages_pager);
     $panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('When it is prohibitively expensive or complex to attain a complete ' . 'count of the items, you can select one extra item and set ' . '%s if it exists, creating an inexact pager.', phutil_tag('tt', array(), 'hasMorePages(true)'))));
     $inexact_pager = new AphrontPagerView();
     $inexact_pager->setPageSize($page_size);
     $inexact_pager->setOffset($offset);
     $inexact_pager->setHasMorePages($offset < $item_count - $page_size);
     $inexact_pager->setURI($request->getRequestURI(), 'offset');
     $panel->appendChild($inexact_pager);
     return $panel;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:39,代码来源:PhabricatorPagerUIExample.php

示例15: loadListData

 private function loadListData()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $pager = new AphrontPagerView();
     $pager->setOffset($this->getPagerOffset());
     if ($this->getPagerPageSize()) {
         $pager->setPageSize($this->getPagerPageSize());
     }
     $author = $this->getListAuthor();
     if ($author) {
         $files = id(new PhabricatorFile())->loadAllWhere('authorPHID = %s ORDER BY id DESC LIMIT %d, %d', $author->getPHID(), $pager->getOffset(), $pager->getPageSize() + 1);
     } else {
         $files = id(new PhabricatorFile())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
     }
     $files = $pager->sliceResults($files);
     $pager->setURI($request->getRequestURI(), 'page');
     $this->setListPager($pager);
     $phids = mpull($files, 'getAuthorPHID');
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $highlighted = $request->getStr('h');
     $highlighted = explode('-', $highlighted);
     $highlighted = array_fill_keys($highlighted, true);
     $rows = array();
     $rowc = array();
     foreach ($files as $file) {
         if ($file->isViewableInBrowser()) {
             $view_button = phutil_render_tag('a', array('class' => 'small button grey', 'href' => $file->getViewURI()), 'View');
         } else {
             $view_button = null;
         }
         if (isset($highlighted[$file->getID()])) {
             $rowc[] = 'highlighted';
         } else {
             $rowc[] = '';
         }
         $name = $file->getName();
         $rows[] = array(phutil_escape_html('F' . $file->getID()), $file->getAuthorPHID() ? $handles[$file->getAuthorPHID()]->renderLink() : null, phutil_render_tag('a', array('href' => '/F' . $file->getID()), $name != '' ? phutil_escape_html($name) : '<em>no name</em>'), phutil_escape_html(number_format($file->getByteSize()) . ' bytes'), phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/file/info/' . $file->getPHID() . '/'), 'Info'), $view_button, phabricator_date($file->getDateCreated(), $user), phabricator_time($file->getDateCreated(), $user));
     }
     $this->setListRows($rows);
     $this->setListRowClasses($rowc);
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:42,代码来源:PhabricatorFileListController.php


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