本文整理汇总了PHP中AphrontRequest::getViewer方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getViewer方法的具体用法?PHP AphrontRequest::getViewer怎么用?PHP AphrontRequest::getViewer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontRequest
的用法示例。
在下文中一共展示了AphrontRequest::getViewer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$name = $request->getURIData('name');
$device = id(new AlmanacDeviceQuery())->setViewer($viewer)->withNames(array($name))->needProperties(true)->executeOne();
if (!$device) {
return new Aphront404Response();
}
$title = pht('Device %s', $device->getName());
$properties = $this->buildPropertyList($device);
$actions = $this->buildActionList($device);
$header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($device->getName())->setPolicyObject($device)->setHeaderIcon('fa-server');
$issue = null;
if ($device->isClusterDevice()) {
$issue = $this->addClusterMessage(pht('This device is bound to a cluster service.'), pht('This device is bound to a cluster service. You do not have ' . 'permission to manage cluster services, so the device can not ' . 'be edited.'));
}
$interfaces = $this->buildInterfaceList($device);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($device->getName());
$crumbs->setBorder(true);
$timeline = $this->buildTransactionTimeline($device, new AlmanacDeviceTransactionQuery());
$timeline->setShouldTerminate(true);
$view = id(new PHUITwoColumnView())->setHeader($header)->setMainColumn(array($issue, $interfaces, $this->buildAlmanacPropertiesTable($device), $this->buildSSHKeysTable($device), $this->buildServicesTable($device), $timeline))->setPropertyList($properties)->setActionList($actions);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($view));
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
if (!$request->isFormPost()) {
return new Aphront400Response();
}
$question = id(new PonderQuestionQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$question) {
return new Aphront404Response();
}
$is_preview = $request->isPreviewRequest();
// $draft = PhabricatorDraft::buildFromRequest($request);
$qid = $question->getID();
$view_uri = "/Q{$qid}";
$xactions = array();
$xactions[] = id(new PonderQuestionTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new PonderQuestionTransactionComment())->setContent($request->getStr('comment')));
$editor = id(new PonderQuestionEditor())->setActor($viewer)->setContinueOnNoEffect($request->isContinueRequest())->setContentSourceFromRequest($request)->setIsPreview($is_preview);
try {
$xactions = $editor->applyTransactions($question, $xactions);
} catch (PhabricatorApplicationTransactionNoEffectException $ex) {
return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($view_uri)->setException($ex);
}
// if ($draft) {
// $draft->replaceOrDelete();
// }
if ($request->isAjax() && $is_preview) {
return id(new PhabricatorApplicationTransactionResponse())->setViewer($viewer)->setTransactions($xactions)->setIsPreview($is_preview);
} else {
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
}
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$crumbs->addTextCrumb(pht('Books'));
$query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon('fa-search');
$header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
$document = new PHUIDocumentViewPro();
$document->setHeader($header);
$document->addClass('diviner-view');
if ($books) {
$books = msort($books, 'getTitle');
$list = array();
foreach ($books as $book) {
$item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
$list[] = $item;
}
$list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM_TOP)->appendChild($list);
$document->appendChild($list);
} else {
$text = pht("(NOTE) **Looking for Phabricator documentation?** " . "If you're looking for help and information about Phabricator, " . "you can [[https://secure.phabricator.com/diviner/ | " . "browse the public Phabricator documentation]] on the live site.\n\n" . "Diviner is the documentation generator used to build the " . "Phabricator documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . " %s\n\n", 'phabricator/ $ ./bin/diviner generate');
$text = new PHUIRemarkupView($viewer, $text);
$document->appendChild($text);
}
return $this->newPage()->setTitle(pht('Documentation Books'))->setCrumbs($crumbs)->appendChild(array($document));
}
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$book_name = $request->getURIData('book');
$book = id(new DivinerBookQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->needProjectPHIDs(true)->withNames(array($book_name))->executeOne();
if (!$book) {
return new Aphront404Response();
}
$view_uri = '/book/' . $book->getName() . '/';
if ($request->isFormPost()) {
$v_projects = $request->getArr('projectPHIDs');
$v_view = $request->getStr('viewPolicy');
$v_edit = $request->getStr('editPolicy');
$xactions = array();
$xactions[] = id(new DivinerLiveBookTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', PhabricatorProjectObjectHasProjectEdgeType::EDGECONST)->setNewValue(array('=' => array_fuse($v_projects)));
$xactions[] = id(new DivinerLiveBookTransaction())->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)->setNewValue($v_view);
$xactions[] = id(new DivinerLiveBookTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)->setNewValue($v_edit);
id(new DivinerLiveBookEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($viewer)->applyTransactions($book, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Edit Basics'));
$title = pht('Edit %s', $book->getTitle());
$policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($book)->execute();
$view_capability = PhabricatorPolicyCapability::CAN_VIEW;
$edit_capability = PhabricatorPolicyCapability::CAN_EDIT;
$form = id(new AphrontFormView())->setUser($viewer)->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorProjectDatasource())->setName('projectPHIDs')->setLabel(pht('Projects'))->setValue($book->getProjectPHIDs()))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new DiffusionRepositoryDatasource())->setName('repositoryPHIDs')->setLabel(pht('Repository'))->setDisableBehavior(true)->setLimit(1)->setValue($book->getRepositoryPHID() ? array($book->getRepositoryPHID()) : null))->appendChild(id(new AphrontFormPolicyControl())->setName('viewPolicy')->setPolicyObject($book)->setCapability($view_capability)->setPolicies($policies)->setCaption($book->describeAutomaticCapability($view_capability)))->appendChild(id(new AphrontFormPolicyControl())->setName('editPolicy')->setPolicyObject($book)->setCapability($edit_capability)->setPolicies($policies)->setCaption($book->describeAutomaticCapability($edit_capability)))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton($view_uri));
$object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
$timeline = $this->buildTransactionTimeline($book, new DivinerLiveBookTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(array($crumbs, $object_box, $timeline), array('title' => $title));
}
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$initiative = id(new FundInitiativeQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$initiative) {
return new Aphront404Response();
}
$initiative_uri = '/' . $initiative->getMonogram();
$is_close = !$initiative->isClosed();
if ($request->isFormPost()) {
$type_status = FundInitiativeTransaction::TYPE_STATUS;
if ($is_close) {
$new_status = FundInitiative::STATUS_CLOSED;
} else {
$new_status = FundInitiative::STATUS_OPEN;
}
$xaction = id(new FundInitiativeTransaction())->setTransactionType($type_status)->setNewValue($new_status);
$editor = id(new FundInitiativeEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true);
$editor->applyTransactions($initiative, array($xaction));
return id(new AphrontRedirectResponse())->setURI($initiative_uri);
}
if ($is_close) {
$title = pht('Close Initiative?');
$body = pht('Really close this initiative? Users will no longer be able to ' . 'back it.');
$button_text = pht('Close Initiative');
} else {
$title = pht('Reopen Initiative?');
$body = pht('Really reopen this initiative?');
$button_text = pht('Reopen Initiative');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addCancelButton($initiative_uri)->addSubmitButton($button_text);
}
示例6: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
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($viewer, $fact->getValueX());
$rows[] = array($name, $value);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Fact'), pht('Value')));
$table->setColumnClasses(array('wide', 'n'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Facts'));
$panel->setTable($table);
$chart_form = $this->buildChartForm();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Home'));
$title = pht('Facts');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($chart_form, $panel));
}
示例7: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$blog = id(new PhameBlogQuery())->setViewer($viewer)->withIDs(array($id))->needProfileImage(true)->executeOne();
if (!$blog) {
return new Aphront404Response();
}
if ($blog->isArchived()) {
$header_icon = 'fa-ban';
$header_name = pht('Archived');
$header_color = 'dark';
} else {
$header_icon = 'fa-check';
$header_name = pht('Active');
$header_color = 'bluegrey';
}
$picture = $blog->getProfileImageURI();
$header = id(new PHUIHeaderView())->setHeader($blog->getName())->setUser($viewer)->setPolicyObject($blog)->setImage($picture)->setStatus($header_icon, $header_color, $header_name);
$actions = $this->renderActions($blog, $viewer);
$properties = $this->renderProperties($blog, $viewer, $actions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Blogs'), $this->getApplicationURI('blog/'));
$crumbs->addTextCrumb($blog->getName());
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$timeline = $this->buildTransactionTimeline($blog, new PhameBlogTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->newPage()->setTitle($blog->getName())->setCrumbs($crumbs)->appendChild(array($object_box, $timeline));
}
示例8: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$post = id(new PhamePostQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->executeOne();
if (!$post) {
return new Aphront404Response();
}
$blog = $post->getBlog();
$crumbs = $this->buildApplicationCrumbs();
if ($blog) {
$crumbs->addTextCrumb($blog->getName(), $this->getApplicationURI('blog/view/' . $blog->getID() . '/'));
} else {
$crumbs->addTextCrumb(pht('[No Blog]'), null);
}
$crumbs->addTextCrumb($post->getTitle(), $this->getApplicationURI('post/view/' . $post->getID() . '/'));
$crumbs->setBorder(true);
$actions = $this->renderActions($post, $viewer);
$properties = $this->renderProperties($post, $viewer);
$action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIconFont('fa-bars')->addClass('phui-mobile-menu')->setDropdownMenu($actions);
$header = id(new PHUIHeaderView())->setHeader($post->getTitle())->setUser($viewer)->setPolicyObject($post)->addActionLink($action_button);
$document = id(new PHUIDocumentViewPro())->setHeader($header)->setPropertyList($properties);
if ($post->isDraft()) {
$document->appendChild(id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Draft Post'))->appendChild(pht('Only you can see this draft until you publish it. ' . 'Use "Preview / Publish" to publish this post.')));
}
if (!$post->getBlog()) {
$document->appendChild(id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_WARNING)->setTitle(pht('Not On A Blog'))->appendChild(pht('This post is not associated with a blog (the blog may have ' . 'been deleted). Use "Move Post" to move it to a new blog.')));
}
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($post, PhamePost::MARKUP_FIELD_BODY)->process();
$document->appendChild(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY)));
$timeline = $this->buildTransactionTimeline($post, id(new PhamePostTransactionQuery())->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
$timeline = phutil_tag_div('phui-document-view-pro-box', $timeline);
$add_comment = $this->buildCommentForm($post);
return $this->newPage()->setTitle($post->getTitle())->addClass('pro-white-background')->setPageObjectPHIDs(array($post->getPHID()))->setCrumbs($crumbs)->appendChild(array($document, $timeline, $add_comment));
}
示例9: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$name = $request->getURIData('name');
$service = id(new AlmanacServiceQuery())->setViewer($viewer)->withNames(array($name))->executeOne();
if (!$service) {
return new Aphront404Response();
}
$title = pht('Service %s', $service->getName());
$property_list = $this->buildPropertyList($service);
$action_list = $this->buildActionList($service);
$property_list->setActionList($action_list);
$header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($service->getName())->setPolicyObject($service);
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($property_list);
$messages = $service->getServiceType()->getStatusMessages($service);
if ($messages) {
$box->setFormErrors($messages);
}
if ($service->getIsLocked()) {
$this->addLockMessage($box, pht('This service is locked, and can not be edited.'));
}
$bindings = $this->buildBindingList($service);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($service->getName());
$timeline = $this->buildTransactionTimeline($service, new AlmanacServiceTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($box, $bindings, $this->buildAlmanacPropertiesTable($service), $timeline));
}
示例10: renderModuleStatus
public function renderModuleStatus(AphrontRequest $request)
{
$viewer = $request->getViewer();
$types = AphrontHTTPParameterType::getAllTypes();
$table = id(new PhabricatorHTTPParameterTypeTableView())->setHTTPParameterTypes($types);
return id(new PHUIObjectBoxView())->setHeaderText(pht('HTTP Parameter Types'))->setTable($table);
}
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$resource = id(new DrydockResourceQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$resource) {
return new Aphront404Response();
}
$title = pht('Resource %s %s', $resource->getID(), $resource->getName());
$header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($resource)->setHeader($title);
$actions = $this->buildActionListView($resource);
$properties = $this->buildPropertyListView($resource, $actions);
$resource_uri = 'resource/' . $resource->getID() . '/';
$resource_uri = $this->getApplicationURI($resource_uri);
$pager = new PHUIPagerView();
$pager->setURI(new PhutilURI($resource_uri), 'offset');
$pager->setOffset($request->getInt('offset'));
$logs = id(new DrydockLogQuery())->setViewer($viewer)->withResourceIDs(array($resource->getID()))->executeWithOffsetPager($pager);
$log_table = id(new DrydockLogListView())->setUser($viewer)->setLogs($logs)->render();
$log_table->appendChild($pager);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Resource %d', $resource->getID()));
$locks = $this->buildLocksTab($resource->getPHID());
$commands = $this->buildCommandsTab($resource->getPHID());
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties, pht('Properties'))->addPropertyList($locks, pht('Slot Locks'))->addPropertyList($commands, pht('Commands'));
$lease_box = $this->buildLeaseBox($resource);
$log_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Resource Logs'))->setTable($log_table);
return $this->buildApplicationPage(array($crumbs, $object_box, $lease_box, $log_box), array('title' => $title));
}
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$export = id(new PhabricatorCalendarExportQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$export) {
return new Aphront404Response();
}
$export_uri = $export->getURI();
$is_disable = !$export->getIsDisabled();
if ($request->isFormPost()) {
$xactions = array();
$xactions[] = id(new PhabricatorCalendarExportTransaction())->setTransactionType(PhabricatorCalendarExportDisableTransaction::TRANSACTIONTYPE)->setNewValue($is_disable ? 1 : 0);
$editor = id(new PhabricatorCalendarExportEditor())->setActor($viewer)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->setContentSourceFromRequest($request);
$editor->applyTransactions($export, $xactions);
return id(new AphrontRedirectResponse())->setURI($export_uri);
}
if ($is_disable) {
$title = pht('Disable Export');
$body = pht('Disable this export? The export URI will no longer function.');
$button = pht('Disable Export');
} else {
$title = pht('Enable Export');
$body = pht('Enable this export? Anyone who knows the export URI will be able ' . 'to export the data.');
$button = pht('Enable Export');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addCancelButton($export_uri)->addSubmitButton($button);
}
示例13: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$credential = id(new PassphraseCredentialQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$credential) {
return new Aphront404Response();
}
$type = PassphraseCredentialType::getTypeByConstant($credential->getCredentialType());
if (!$type) {
throw new Exception(pht('Credential has invalid type "%s"!', $type));
}
$view_uri = '/K' . $credential->getID();
if ($credential->getIsLocked()) {
return $this->newDialog()->setTitle(pht('Credential Already Locked'))->appendChild(pht('This credential is already locked.'))->addCancelButton($view_uri, pht('Close'));
}
if ($request->isFormPost()) {
$xactions = array();
$xactions[] = id(new PassphraseCredentialTransaction())->setTransactionType(PassphraseCredentialTransaction::TYPE_CONDUIT)->setNewValue(0);
$xactions[] = id(new PassphraseCredentialTransaction())->setTransactionType(PassphraseCredentialTransaction::TYPE_LOCK)->setNewValue(1);
$editor = id(new PassphraseCredentialTransactionEditor())->setActor($viewer)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->applyTransactions($credential, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
return $this->newDialog()->setTitle(pht('Lock Credential'))->appendChild(pht('This credential will be locked and the secret will be hidden ' . 'forever. If Conduit access is enabled, it will be revoked. ' . 'Anything relying on this credential will still function. This ' . 'operation can not be undone.'))->addSubmitButton(pht('Lock Credential'))->addCancelButton($view_uri);
}
示例14: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
// NOTE: We require CAN_EDIT to view this page.
$document = id(new LegalpadDocumentQuery())->setViewer($viewer)->withIDs(array($id))->needDocumentBodies(true)->needContributors(true)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$document) {
return new Aphront404Response();
}
$subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID($document->getPHID());
$document_body = $document->getDocumentBody();
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer);
$engine->addObject($document_body, LegalpadDocumentBody::MARKUP_FIELD_TEXT);
$timeline = $this->buildTransactionTimeline($document, new LegalpadTransactionQuery(), $engine);
$title = $document_body->getTitle();
$header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($document);
$actions = $this->buildActionView($document);
$properties = $this->buildPropertyView($document, $engine, $actions);
$comment_form_id = celerity_generate_unique_node_id();
$add_comment = $this->buildAddCommentView($document, $comment_form_id);
$crumbs = $this->buildApplicationCrumbs($this->buildSideNav());
$crumbs->addTextCrumb($document->getMonogram(), '/' . $document->getMonogram());
$crumbs->addTextCrumb(pht('Manage'));
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties)->addPropertyList($this->buildDocument($engine, $document_body));
$content = array($crumbs, $object_box, $timeline, $add_comment);
return $this->buildApplicationPage($content, array('title' => $title, 'pageObjects' => array($document->getPHID())));
}
示例15: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$pager = new PHUIPagerView();
$pager->setURI($request->getRequestURI(), 'page');
$pager->setOffset($request->getInt('page'));
$query = id(new PhabricatorTokenReceiverQuery());
$objects = $query->setViewer($viewer)->executeWithOffsetPager($pager);
$counts = $query->getTokenCounts();
$handles = array();
$phids = array();
if ($counts) {
$phids = mpull($objects, 'getPHID');
$handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->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');
$box = id(new PHUIObjectBoxView())->setHeaderText($title)->setObjectList($list);
$nav = $this->buildSideNav();
$nav->setCrumbs($this->buildApplicationCrumbs()->addTextCrumb($title));
$nav->selectFilter('leaders/');
$nav->appendChild($box);
$nav->appendChild($pager);
return $this->newPage()->setTitle($title)->appendChild($nav);
}