本文整理汇总了PHP中AphrontPagerView类的典型用法代码示例。如果您正苦于以下问题:PHP AphrontPagerView类的具体用法?PHP AphrontPagerView怎么用?PHP AphrontPagerView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AphrontPagerView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$blueprint = id(new DrydockBlueprintQuery())->setViewer($viewer)->withIDs(array($this->id))->executeOne();
if (!$blueprint) {
return new Aphront404Response();
}
$title = $blueprint->getBlueprintName();
$header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($blueprint);
$actions = $this->buildActionListView($blueprint);
$properties = $this->buildPropertyListView($blueprint, $actions);
$blueprint_uri = 'blueprint/' . $blueprint->getID() . '/';
$blueprint_uri = $this->getApplicationURI($blueprint_uri);
$resources = id(new DrydockResourceQuery())->withBlueprintPHIDs(array($blueprint->getPHID()))->setViewer($viewer)->execute();
$resource_list = id(new DrydockResourceListView())->setUser($viewer)->setResources($resources)->render();
$resource_list->setNoDataString(pht('This blueprint has no resources.'));
$pager = new AphrontPagerView();
$pager->setURI(new PhutilURI($blueprint_uri), 'offset');
$pager->setOffset($request->getInt('offset'));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blueprint %d', $blueprint->getID()));
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$field_list = PhabricatorCustomField::getObjectFields($blueprint, PhabricatorCustomField::ROLE_VIEW);
$field_list->setViewer($viewer)->readFieldsFromStorage($blueprint);
$field_list->appendFieldsToPropertyList($blueprint, $viewer, $properties);
$timeline = $this->buildTransactionTimeline($blueprint, new DrydockBlueprintTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(array($crumbs, $object_box, $resource_list, $timeline), array('title' => $title));
}
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'page');
$pager->setOffset($request->getInt('page'));
$query = id(new PhabricatorTokenReceiverQuery());
$objects = $query->setViewer($user)->executeWithOffsetPager($pager);
$counts = $query->getTokenCounts();
$handles = array();
$phids = array();
if ($counts) {
$phids = mpull($objects, 'getPHID');
$handles = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs($phids)->execute();
}
$list = new PHUIObjectItemListView();
foreach ($phids as $object) {
$count = idx($counts, $object, 0);
$item = id(new PHUIObjectItemView());
$handle = $handles[$object];
$item->setHeader($handle->getFullName());
$item->setHref($handle->getURI());
$item->addAttribute(pht('Tokens: %s', $count));
$list->addItem($item);
}
$title = pht('Token Leader Board');
$nav = $this->buildSideNav();
$nav->setCrumbs($this->buildApplicationCrumbs()->addTextCrumb($title));
$nav->selectFilter('leaders/');
$nav->appendChild($list);
$nav->appendChild($pager);
return $this->buildApplicationPage($nav, array('title' => $title));
}
示例4: 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'));
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$this->answerOffset = $request->getInt('aoff');
$pages = array('feed' => 'All Questions', 'questions' => 'Your Questions', 'answers' => 'Your Answers');
$side_nav = $this->buildSideNavView();
$this->page = $side_nav->selectFilter($this->page, 'feed');
$title = $pages[$this->page];
switch ($this->page) {
case 'feed':
case 'questions':
$pager = new AphrontPagerView();
$pager->setOffset($request->getStr('offset'));
$pager->setURI($request->getRequestURI(), 'offset');
$query = new PonderQuestionQuery();
if ($this->page == 'feed') {
$query->setOrder(PonderQuestionQuery::ORDER_HOTTEST);
} else {
$query->setOrder(PonderQuestionQuery::ORDER_CREATED)->withAuthorPHIDs(array($user->getPHID()));
}
$questions = $query->executeWithOffsetPager($pager);
$this->loadHandles(mpull($questions, 'getAuthorPHID'));
$view = $this->buildQuestionListView($questions);
$view->setPager($pager);
$side_nav->appendChild(id(new PhabricatorHeaderView())->setHeader($title));
$side_nav->appendChild($view);
break;
case 'answers':
$answers = PonderAnswerQuery::loadByAuthorWithQuestions($user, $user->getPHID(), $this->answerOffset, self::PROFILE_ANSWER_PAGE_SIZE + 1);
$side_nav->appendChild(id(new PonderUserProfileView())->setUser($user)->setAnswers($answers)->setAnswerOffset($this->answerOffset)->setPageSize(self::PROFILE_ANSWER_PAGE_SIZE)->setURI(new PhutilURI("/ponder/profile/"), "aoff"));
break;
}
return $this->buildApplicationPage($side_nav, array('device' => true, 'title' => $title));
}
示例6: 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);
}
示例7: processRequest
public function processRequest()
{
$request = $this->getRequest();
$edit_query = new HeraldEditLogQuery();
if ($this->id) {
$edit_query->withRuleIDs(array($this->id));
}
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getStr('offset'));
$edits = $edit_query->executeWithOffsetPager($pager);
$need_phids = mpull($edits, 'getEditorPHID');
$handles = $this->loadViewerHandles($need_phids);
$list_view = id(new HeraldRuleEditHistoryView())->setEdits($edits)->setHandles($handles)->setUser($this->getRequest()->getUser());
$panel = new AphrontPanelView();
$panel->setHeader(pht('Edit History'));
$panel->appendChild($list_view);
$panel->setNoBackground();
$crumbs = $this->buildApplicationCrumbs($can_create = false)->addTextCrumb(pht('Edit History'), $this->getApplicationURI('herald/history'));
$nav = $this->buildSideNavView();
$nav->selectFilter('history');
$nav->appendChild($panel);
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage($nav, array('title' => pht('Rule Edit History')));
}
示例8: executeWithOffsetPager
public final function executeWithOffsetPager(AphrontPagerView $pager)
{
$this->setLimit($pager->getPageSize() + 1);
$this->setOffset($pager->getOffset());
$results = $this->execute();
return $pager->sliceResults($results);
}
示例9: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$lease = id(new DrydockLeaseQuery())->setViewer($viewer)->withIDs(array($this->id))->executeOne();
if (!$lease) {
return new Aphront404Response();
}
$lease_uri = $this->getApplicationURI('lease/' . $lease->getID() . '/');
$title = pht('Lease %d', $lease->getID());
$header = id(new PHUIHeaderView())->setHeader($title);
$actions = $this->buildActionListView($lease);
$properties = $this->buildPropertyListView($lease, $actions);
$pager = new AphrontPagerView();
$pager->setURI(new PhutilURI($lease_uri), 'offset');
$pager->setOffset($request->getInt('offset'));
$logs = id(new DrydockLogQuery())->setViewer($viewer)->withLeaseIDs(array($lease->getID()))->executeWithOffsetPager($pager);
$log_table = id(new DrydockLogListView())->setUser($viewer)->setLogs($logs)->render();
$log_table->appendChild($pager);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setActionList($actions);
$crumbs->addTextCrumb($title, $lease_uri);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
return $this->buildApplicationPage(array($crumbs, $object_box, $log_table), array('title' => $title));
}
示例10: 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'));
}
示例11: 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'));
}
示例12: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$is_admin = $viewer->getIsAdmin();
$user = new PhabricatorUser();
$count = queryfx_one($user->establishConnection('r'), 'SELECT COUNT(*) N FROM %T', $user->getTableName());
$count = idx($count, 'N', 0);
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page', 0));
$pager->setCount($count);
$pager->setURI($request->getRequestURI(), 'page');
$users = id(new PhabricatorPeopleQuery())->needPrimaryEmail(true)->executeWithOffsetPager($pager);
$rows = array();
foreach ($users as $user) {
$primary_email = $user->loadPrimaryEmail();
if ($primary_email && $primary_email->getIsVerified()) {
$email = 'Verified';
} else {
$email = 'Unverified';
}
$status = array();
if ($user->getIsDisabled()) {
$status[] = 'Disabled';
}
if ($user->getIsAdmin()) {
$status[] = 'Admin';
}
if ($user->getIsSystemAgent()) {
$status[] = 'System Agent';
}
$status = implode(', ', $status);
$rows[] = array(phabricator_date($user->getDateCreated(), $viewer), phabricator_time($user->getDateCreated(), $viewer), phutil_render_tag('a', array('href' => '/p/' . $user->getUsername() . '/'), phutil_escape_html($user->getUserName())), phutil_escape_html($user->getRealName()), $status, $email, phutil_render_tag('a', array('class' => 'button grey small', 'href' => '/people/edit/' . $user->getID() . '/'), 'Administrate User'));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Join Date', 'Time', 'Username', 'Real Name', 'Roles', 'Email', ''));
$table->setColumnClasses(array(null, 'right', 'pri', 'wide', null, null, 'action'));
$table->setColumnVisibility(array(true, true, true, true, $is_admin, $is_admin, $is_admin));
$panel = new AphrontPanelView();
$panel->setHeader('People (' . number_format($count) . ')');
$panel->appendChild($table);
$panel->appendChild($pager);
if ($is_admin) {
$panel->addButton(phutil_render_tag('a', array('href' => '/people/edit/', 'class' => 'button green'), 'Create New Account'));
if (PhabricatorEnv::getEnvConfig('ldap.auth-enabled')) {
$panel->addButton(phutil_render_tag('a', array('href' => '/people/ldap/', 'class' => 'button green'), 'Import from LDAP'));
}
}
$nav = $this->buildSideNavView();
$nav->selectFilter('people');
$nav->appendChild($panel);
return $this->buildApplicationPage($nav, array('title' => 'People'));
}
示例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'));
}
示例14: 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;
}
示例15: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$upload_panel = $this->renderUploadPanel();
$author = null;
$author_username = $request->getStr('author');
if ($author_username) {
$author = id(new PhabricatorUser())->loadOneWhere('userName = %s', $author_username);
if (!$author) {
return id(new Aphront404Response());
}
$title = 'Files Uploaded by ' . phutil_escape_html($author->getUsername());
} else {
$title = 'Files';
}
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
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');
$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/view/' . $file->getPHID() . '/'), 'View');
} else {
$view_button = null;
}
if (isset($highlighted[$file->getID()])) {
$rowc[] = 'highlighted';
} else {
$rowc[] = '';
}
$rows[] = array(phutil_escape_html('F' . $file->getID()), $file->getAuthorPHID() ? $handles[$file->getAuthorPHID()]->renderLink() : null, phutil_render_tag('a', array('href' => $file->getViewURI()), phutil_escape_html($file->getName())), 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, phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/file/download/' . $file->getPHID() . '/'), 'Download'), phabricator_date($file->getDateCreated(), $user), phabricator_time($file->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array('File ID', 'Author', 'Name', 'Size', '', '', '', 'Created', ''));
$table->setColumnClasses(array(null, '', 'wide pri', 'right', 'action', 'action', 'action', '', 'right'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader($title);
$panel->appendChild($pager);
return $this->buildStandardPageResponse(array($upload_panel, $panel), array('title' => 'Files', 'tab' => 'files'));
}