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


PHP AphrontPagerView::setHasMorePages方法代码示例

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


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

示例3: 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);
     }
     $show_graph = !strlen($drequest->getPath());
     if ($show_graph) {
         $history_query->needParents(true);
     }
     $history = $history_query->loadHistory();
     $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';
         $copies_new = null;
     } else {
         $button_title = 'Show Copies/Branches';
         $copies_new = true;
     }
     $button = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $request->getRequestURI()->alter('copies', $copies_new)), phutil_escape_html($button_title));
     $history_table = new DiffusionHistoryTableView();
     $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_query->getParents());
         $history_table->setIsHead($offset == 0);
     }
     $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:rudimk,项目名称:phabricator,代码行数:61,代码来源:DiffusionHistoryController.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     // Get one page of data together with the pager.
     // Pull these objects manually since the serialized fields are gigantic.
     $transcript = new HeraldTranscript();
     $conn_r = $transcript->establishConnection('r');
     $phid = $request->getStr('phid');
     $where_clause = '';
     if ($phid) {
         $where_clause = qsprintf($conn_r, 'WHERE objectPHID = %s', $phid);
     }
     $offset = $request->getInt('offset', 0);
     $page_size = 100;
     $limit_clause = qsprintf($conn_r, 'LIMIT %d, %d', $offset, $page_size + 1);
     $data = queryfx_all($conn_r, 'SELECT id, objectPHID, time, duration, dryRun FROM %T
     %Q
     ORDER BY id DESC
     %Q', $transcript->getTableName(), $where_clause, $limit_clause);
     $pager = new AphrontPagerView();
     $pager->getPageSize($page_size);
     $pager->setHasMorePages(count($data) == $page_size + 1);
     $pager->setOffset($offset);
     $pager->setURI($request->getRequestURI(), 'offset');
     /*
     
         $conn_r = smc_get_db('cdb.herald', 'r');
     
         $page_size = 100;
     
         $pager = new SimplePager();
         $pager->setPageSize($page_size);
         $pager->setOffset((((int)$request->getInt('page')) - 1) * $page_size);
         $pager->order('id', array('id'));
     
     
         $fbid = $request->getInt('fbid');
         if ($fbid) {
           $filter = qsprintf(
             $conn_r,
             'WHERE objectID = %d',
             $fbid);
         } else {
           $filter = '';
         }
     
         $data = $pager->select(
           $conn_r,
           'id, objectID, time, duration, dryRun FROM transcript %Q',
           $filter);
     */
     // Render the table.
     $handles = array();
     if ($data) {
         $phids = ipull($data, 'objectPHID', 'objectPHID');
         $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     }
     $rows = array();
     foreach ($data as $xscript) {
         $rows[] = array(phabricator_date($xscript['time'], $user), phabricator_time($xscript['time'], $user), $handles[$xscript['objectPHID']]->renderLink(), $xscript['dryRun'] ? 'Yes' : '', number_format((int) (1000 * $xscript['duration'])) . ' ms', phutil_render_tag('a', array('href' => '/herald/transcript/' . $xscript['id'] . '/', 'class' => 'button small grey'), 'View Transcript'));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Date', 'Time', 'Object', 'Dry Run', 'Duration', 'View'));
     $table->setColumnClasses(array('', 'right', 'wide wrap', '', '', 'action'));
     // Render the whole page.
     $panel = new AphrontPanelView();
     $panel->setHeader('Herald Transcripts');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     return $this->buildStandardPageResponse($panel, array('title' => 'Herald Transcripts', 'tab' => 'transcripts'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:72,代码来源:HeraldTranscriptListController.php


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