本文整理汇总了PHP中AphrontSideNavFilterView::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontSideNavFilterView::appendChild方法的具体用法?PHP AphrontSideNavFilterView::appendChild怎么用?PHP AphrontSideNavFilterView::appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontSideNavFilterView
的用法示例。
在下文中一共展示了AphrontSideNavFilterView::appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->setConcreteOnly(true)->selectAndLoadSymbols();
$classes = ipull($classes, 'name', 'name');
foreach ($classes as $class => $ignored) {
$classes[$class] = newv($class, array());
}
$classes = msort($classes, 'getName');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addFilter($class, $name);
}
$selected = $nav->selectFilter($this->class, head_key($classes));
require_celerity_resource('phabricator-ui-example-css');
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$result = $example->renderExample();
if ($result instanceof AphrontResponse) {
// This allows examples to generate dialogs, etc., for demonstration.
return $result;
}
$nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
$nav->appendChild($result);
return $this->buildApplicationPage($nav, array('title' => 'UI Example', 'device' => true));
}
示例2: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName('Herald');
$page->setBaseURI('/herald/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("☿");
$doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/herald/'))->addLabel('Rules')->addFilter('new', 'Create Rule');
$rules_map = HeraldContentTypeConfig::getContentTypeMap();
$first_filter = null;
foreach ($rules_map as $key => $value) {
$nav->addFilter('view/' . $key, $value);
if (!$first_filter) {
$first_filter = 'view/' . $key;
}
}
$nav->addSpacer()->addLabel('Utilities')->addFilter('test', 'Test Console')->addFilter('transcript', 'Transcripts');
$user = $this->getRequest()->getUser();
if ($user->getIsAdmin()) {
$nav->addSpacer()->addLabel('Admin');
$view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
foreach ($rules_map as $key => $value) {
$nav->addFilter('all/view/' . $key, $value);
}
}
$nav->selectFilter($this->getFilter(), $first_filter);
$nav->appendChild($view);
$page->appendChild($nav);
$tabs = array('help' => array('href' => $doclink, 'name' => 'Help'));
$page->setTabs($tabs, null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例3: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$user = $this->getRequest()->getUser();
$page = $this->buildStandardPageView();
$page->setApplicationName('OAuth Server');
$page->setBaseURI('/oauthserver/');
$page->setTitle(idx($data, 'title'));
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/oauthserver/'));
$nav->addLabel('Client Authorizations');
$nav->addFilter('clientauthorization', 'My Authorizations');
$nav->addSpacer();
$nav->addLabel('Clients');
$nav->addFilter('client/create', 'Create Client');
foreach ($this->getExtraClientFilters() as $filter) {
$nav->addFilter($filter['url'], $filter['label']);
}
$nav->addFilter('client', 'My Clients');
$nav->selectFilter($this->getFilter(), 'clientauthorization');
$nav->appendChild($view);
$page->appendChild($nav);
$doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html');
$page->setTabs(array('help' => array('name' => 'Help', 'href' => $doc_href)), null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例4: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName('Conduit');
$page->setBaseURI('/conduit/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("⇵");
if ($this->showSideNav()) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/conduit/'));
$method_filters = $this->getMethodFilters();
foreach ($method_filters as $group => $methods) {
$nav->addLabel($group);
foreach ($methods as $method) {
$method_name = $method['full_name'];
$display_name = $method_name;
switch ($method['status']) {
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
$display_name = '(' . $display_name . ')';
break;
}
$nav->addFilter('method/' . $method_name, $display_name);
}
$nav->addSpacer();
}
$nav->selectFilter($this->getFilter());
$nav->appendChild($view);
$body = $nav;
} else {
$body = $view;
}
$page->appendChild($body);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$id = $request->getURIData('class');
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
$classes = msort($classes, 'getName');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addFilter($class, $name);
}
$selected = $nav->selectFilter($id, head_key($classes));
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$result = $example->renderExample();
if ($result instanceof AphrontResponse) {
// This allows examples to generate dialogs, etc., for demonstration.
return $result;
}
require_celerity_resource('phabricator-ui-example-css');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($example->getName());
$note = id(new PHUIInfoView())->setTitle(pht('%s (%s)', $example->getName(), get_class($example)))->appendChild($example->getDescription())->setSeverity(PHUIInfoView::SEVERITY_NODATA);
$nav->appendChild(array($crumbs, $note, $result));
return $this->buildApplicationPage($nav, array('title' => $example->getName()));
}
示例6: processRequest
public function processRequest()
{
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
$classes = msort($classes, 'getName');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addFilter($class, $name);
}
$selected = $nav->selectFilter($this->class, head_key($classes));
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$result = $example->renderExample();
if ($result instanceof AphrontResponse) {
// This allows examples to generate dialogs, etc., for demonstration.
return $result;
}
require_celerity_resource('phabricator-ui-example-css');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($example->getName());
$header = id(new PHUIHeaderView())->setHeader(pht('%s (%s)', $example->getName(), get_class($example)))->setSubheader($example->getDescription())->setNoBackground(true);
$nav->appendChild(array($crumbs, $header, phutil_tag('br'), $result));
return $this->buildApplicationPage($nav, array('title' => $example->getName()));
}
示例7: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
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));
}
$params = array_filter(array('phid' => $request->getStr('phid')));
// Fill in the defaults we'll actually use for calculations if any
// parameters are missing.
$params += array('phid' => $user->getPHID());
$side_nav = new AphrontSideNavFilterView();
$side_nav->setBaseURI(id(new PhutilURI('/differential/stats/'))->alter('phid', $params['phid']));
foreach (array(DifferentialAction::ACTION_CLOSE, DifferentialAction::ACTION_ACCEPT, DifferentialAction::ACTION_REJECT, DifferentialAction::ACTION_UPDATE, DifferentialAction::ACTION_COMMENT) as $action) {
$verb = ucfirst(DifferentialAction::getActionPastTenseVerb($action));
$side_nav->addFilter($action, $verb);
}
$this->filter = $side_nav->selectFilter($this->filter, DifferentialAction::ACTION_CLOSE);
$panels = array();
$handles = $this->loadViewerHandles(array($params['phid']));
$filter_form = id(new AphrontFormView())->setAction('/differential/stats/' . $this->filter . '/')->setUser($user);
$filter_form->appendChild($this->renderControl($params['phid'], $handles));
$filter_form->appendChild(id(new AphrontFormSubmitControl())->setValue('Filter Revisions'));
$side_nav->appendChild($filter_form);
$comments = $this->loadComments($params['phid']);
$revisions = $this->loadRevisions($params['phid']);
$diffs = $this->loadDiffs($revisions);
$panel = new AphrontPanelView();
$panel->setHeader('Differential rate analysis');
$panel->appendChild(id(new DifferentialRevisionStatsView())->setComments($comments)->setFilter($this->filter)->setRevisions($revisions)->setDiffs($diffs)->setUser($user));
$panels[] = $panel;
foreach ($panels as $panel) {
$side_nav->appendChild($panel);
}
return $this->buildStandardPageResponse($side_nav, array('title' => 'Differential statistics'));
}
示例8: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/notification/'));
$nav->addFilter('all', 'All Notifications');
$nav->addFilter('unread', 'Unread Notifications');
$filter = $nav->selectFilter($this->filter, 'all');
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getInt('offset'));
$query = new PhabricatorNotificationQuery();
$query->setUserPHID($user->getPHID());
switch ($filter) {
case 'unread':
$query->withUnread(true);
$header = pht('Unread Notifications');
$no_data = pht('You have no unread notifications.');
break;
default:
$header = pht('Notifications');
$no_data = pht('You have no notifications.');
break;
}
$notifications = $query->executeWithOffsetPager($pager);
if ($notifications) {
$builder = new PhabricatorNotificationBuilder($notifications);
$view = $builder->buildView();
} else {
$view = '<div class="phabricator-notification no-notifications">' . $no_data . '</div>';
}
$view = array('<div class="phabricator-notification-list">', $view, '</div>');
$panel = new AphrontPanelView();
$panel->setHeader($header);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->addButton(javelin_render_tag('a', array('href' => '/notification/clear/', 'class' => 'button', 'sigil' => 'workflow'), 'Mark All Read'));
$panel->appendChild($view);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Notifications'));
}
示例9: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$user = $this->getRequest()->getUser();
$page = $this->buildStandardPageView();
$page->setApplicationName(pht('OAuth Server'));
$page->setBaseURI('/oauthserver/');
$page->setTitle(idx($data, 'title'));
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/oauthserver/'));
$nav->addLabel(pht('Clients'));
$nav->addFilter('client/create', pht('Create Client'));
foreach ($this->getExtraClientFilters() as $filter) {
$nav->addFilter($filter['url'], $filter['label']);
}
$nav->addFilter('client', pht('My Clients'));
$nav->selectFilter($this->getFilter(), 'clientauthorization');
$nav->appendChild($view);
$page->appendChild($nav);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例10: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/flag/view/'));
$nav->addFilter('all', 'Flags');
$nav->selectFilter('all', 'all');
$query = new PhabricatorFlagQuery();
$query->withOwnerPHIDs(array($user->getPHID()));
$query->needHandles(true);
$flags = $query->execute();
$view = new PhabricatorFlagListView();
$view->setFlags($flags);
$view->setUser($user);
$panel = new AphrontPanelView();
$panel->setHeader('Flags');
$panel->appendChild($view);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Flags'));
}
示例11: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
if ($request->isFormPost()) {
$uri = $request->getRequestURI();
$project = head($request->getArr('set_project'));
$project = nonempty($project, null);
$uri = $uri->alter('project', $project);
$window = $request->getStr('set_window');
$uri = $uri->alter('window', $window);
return id(new AphrontRedirectResponse())->setURI($uri);
}
$base_nav = $this->buildBaseSideNav();
$base_nav->selectFilter('report', 'report');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/maniphest/report/'));
$nav->addLabel('Open Tasks');
$nav->addFilter('user', 'By User');
$nav->addFilter('project', 'By Project');
$nav->addSpacer();
$nav->addLabel('Burnup');
$nav->addFilter('burn', 'Burnup Rate');
$this->view = $nav->selectFilter($this->view, 'user');
require_celerity_resource('maniphest-report-css');
switch ($this->view) {
case 'burn':
$core = $this->renderBurn();
break;
case 'user':
case 'project':
$core = $this->renderOpenTasks();
break;
default:
return new Aphront404Response();
}
$nav->appendChild($core);
$base_nav->appendChild($nav);
return $this->buildStandardPageResponse($base_nav, array('title' => 'Maniphest Reports'));
}
示例12: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$doclink = PhabricatorEnv::getDoclink('article/Conduit_Technical_Documentation.html');
$page = $this->buildStandardPageView();
$page->setApplicationName('Conduit');
$page->setBaseURI('/conduit/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("⇵");
$page->setTabs(array('help' => array('href' => $doclink, 'name' => 'Help')), null);
if ($this->showSideNav()) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/conduit/'));
$first_filter = null;
$method_filters = $this->getMethodFilters();
foreach ($method_filters as $group => $methods) {
$nav->addLabel($group);
foreach ($methods as $method) {
$method_name = $method['full_name'];
$nav->addFilter('method/' . $method_name, $method_name);
if (!$first_filter) {
$first_filter = 'method/' . $method_name;
}
}
$nav->addSpacer();
}
$nav->addLabel('Utilities');
$nav->addFilter('log', 'Logs');
$nav->addFilter('token', 'Token');
$nav->selectFilter($this->getFilter(), $first_filter);
$nav->appendChild($view);
$body = $nav;
} else {
$body = $view;
}
$page->appendChild($body);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例13: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$this->view = $request->getURIData('view');
if ($request->isFormPost()) {
$uri = $request->getRequestURI();
$project = head($request->getArr('set_project'));
$project = nonempty($project, null);
$uri = $uri->alter('project', $project);
$window = $request->getStr('set_window');
$uri = $uri->alter('window', $window);
return id(new AphrontRedirectResponse())->setURI($uri);
}
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/maniphest/report/'));
$nav->addLabel(pht('Open Tasks'));
$nav->addFilter('user', pht('By User'));
$nav->addFilter('project', pht('By Project'));
$nav->addLabel(pht('Burnup'));
$nav->addFilter('burn', pht('Burnup Rate'));
$this->view = $nav->selectFilter($this->view, 'user');
require_celerity_resource('maniphest-report-css');
switch ($this->view) {
case 'burn':
$core = $this->renderBurn();
break;
case 'user':
case 'project':
$core = $this->renderOpenTasks();
break;
default:
return new Aphront404Response();
}
$crumbs = $this->buildApplicationCrumbs()->addTextCrumb(pht('Reports'));
$nav->appendChild($core);
$title = pht('Maniphest Reports');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setNavigation($nav);
}
示例14: processRequest
public function processRequest()
{
$request = $this->getRequest();
$admin = $request->getUser();
if ($this->id) {
$user = id(new PhabricatorUser())->load($this->id);
if (!$user) {
return new Aphront404Response();
}
$base_uri = '/people/edit/' . $user->getID() . '/';
} else {
$user = new PhabricatorUser();
$base_uri = '/people/edit/';
}
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($base_uri));
$nav->addLabel('User Information');
$nav->addFilter('basic', 'Basic Information');
$nav->addFilter('role', 'Edit Roles');
$nav->addFilter('cert', 'Conduit Certificate');
$nav->addFilter('profile', 'View Profile', '/p/' . $user->getUsername() . '/');
$nav->addSpacer();
$nav->addLabel('Special');
$nav->addFilter('rename', 'Change Username');
$nav->addFilter('delete', 'Delete User');
if (!$user->getID()) {
$this->view = 'basic';
}
$view = $nav->selectFilter($this->view, 'basic');
$content = array();
if ($request->getStr('saved')) {
$notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your changes were saved.</p>');
$content[] = $notice;
}
switch ($view) {
case 'basic':
$response = $this->processBasicRequest($user);
break;
case 'role':
$response = $this->processRoleRequest($user);
break;
case 'cert':
$response = $this->processCertificateRequest($user);
break;
case 'rename':
$response = $this->processRenameRequest($user);
break;
case 'delete':
$response = $this->processDeleteRequest($user);
break;
default:
return new Aphront404Response();
}
if ($response instanceof AphrontResponse) {
return $response;
}
$content[] = $response;
if ($user->getID()) {
$nav->appendChild($content);
} else {
$nav = $this->buildSideNavView();
$nav->selectFilter('edit');
$nav->appendChild($content);
}
return $this->buildApplicationPage($nav, array('title' => 'Edit User'));
}
示例15: buildApplicationPage
public function buildApplicationPage($view, array $options)
{
$page = $this->buildStandardPageView();
$title = PhabricatorEnv::getEnvConfig('phabricator.serious-business') ? 'Phabricator' : pht('Bacon Ice Cream for Breakfast');
$application = $this->getCurrentApplication();
$page->setTitle(idx($options, 'title', $title));
if ($application) {
$page->setApplicationName($application->getName());
if ($application->getTitleGlyph()) {
$page->setGlyph($application->getTitleGlyph());
}
}
if (idx($options, 'class')) {
$page->addClass($options['class']);
}
if (!$view instanceof AphrontSideNavFilterView) {
$nav = new AphrontSideNavFilterView();
$nav->appendChild($view);
$view = $nav;
}
$user = $this->getRequest()->getUser();
$view->setUser($user);
$page->appendChild($view);
$object_phids = idx($options, 'pageObjects', array());
if ($object_phids) {
$page->appendPageObjects($object_phids);
foreach ($object_phids as $object_phid) {
PhabricatorFeedStoryNotification::updateObjectNotificationViews($user, $object_phid);
}
}
if (idx($options, 'device', true)) {
$page->setDeviceReady(true);
}
$page->setShowFooter(idx($options, 'showFooter', true));
$page->setShowChrome(idx($options, 'chrome', true));
$application_menu = $this->buildApplicationMenu();
if ($application_menu) {
$page->setApplicationMenu($application_menu);
}
return $this->buildPageResponse($page);
}