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


PHP PHUIObjectBoxView::setShowHide方法代码示例

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


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

示例1: processSearchRequest

 private function processSearchRequest()
 {
     $parent = $this->getDelegatingController();
     $request = $this->getRequest();
     $user = $request->getUser();
     $engine = $this->getSearchEngine();
     $nav = $this->getNavigation();
     if ($request->isFormPost()) {
         $saved_query = $engine->buildSavedQueryFromRequest($request);
         $engine->saveQuery($saved_query);
         return id(new AphrontRedirectResponse())->setURI($engine->getQueryResultsPageURI($saved_query->getQueryKey()) . '#R');
     }
     $named_query = null;
     $run_query = true;
     $query_key = $this->queryKey;
     if ($this->queryKey == 'advanced') {
         $run_query = false;
         $query_key = $request->getStr('query');
     } else {
         if (!strlen($this->queryKey)) {
             $found_query_data = false;
             if ($request->isHTTPGet()) {
                 // If this is a GET request and it has some query data, don't
                 // do anything unless it's only before= or after=. We'll build and
                 // execute a query from it below. This allows external tools to build
                 // URIs like "/query/?users=a,b".
                 $pt_data = $request->getPassthroughRequestData();
                 foreach ($pt_data as $pt_key => $pt_value) {
                     if ($pt_key != 'before' && $pt_key != 'after') {
                         $found_query_data = true;
                         break;
                     }
                 }
             }
             if (!$found_query_data) {
                 // Otherwise, there's no query data so just run the user's default
                 // query for this application.
                 $query_key = head_key($engine->loadEnabledNamedQueries());
             }
         }
     }
     if ($engine->isBuiltinQuery($query_key)) {
         $saved_query = $engine->buildSavedQueryFromBuiltin($query_key);
         $named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
     } else {
         if ($query_key) {
             $saved_query = id(new PhabricatorSavedQueryQuery())->setViewer($user)->withQueryKeys(array($query_key))->executeOne();
             if (!$saved_query) {
                 return new Aphront404Response();
             }
             $named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
         } else {
             $saved_query = $engine->buildSavedQueryFromRequest($request);
             // Save the query to generate a query key, so "Save Custom Query..." and
             // other features like Maniphest's "Export..." work correctly.
             $engine->saveQuery($saved_query);
         }
     }
     $nav->selectFilter('query/' . $saved_query->getQueryKey(), 'query/advanced');
     $form = id(new AphrontFormView())->setUser($user)->setAction($request->getPath());
     $engine->buildSearchForm($form, $saved_query);
     $errors = $engine->getErrors();
     if ($errors) {
         $run_query = false;
     }
     $submit = id(new AphrontFormSubmitControl())->setValue(pht('Execute Query'));
     if ($run_query && !$named_query && $user->isLoggedIn()) {
         $submit->addCancelButton('/search/edit/' . $saved_query->getQueryKey() . '/', pht('Save Custom Query...'));
     }
     // TODO: A "Create Dashboard Panel" action goes here somewhere once
     // we sort out T5307.
     $form->appendChild($submit);
     if ($this->getPreface()) {
         $nav->appendChild($this->getPreface());
     }
     if ($named_query) {
         $title = $named_query->getQueryName();
     } else {
         $title = pht('Advanced Search');
     }
     $box = new PHUIObjectBoxView();
     if ($run_query || $named_query) {
         $box->setShowHide(pht('Edit Query'), pht('Hide Query'), $form, $this->getApplicationURI('query/advanced/?query=' . $query_key), !$named_query ? true : false);
     } else {
         $box->setForm($form);
     }
     $nav->appendChild($box);
     if ($run_query) {
         $box->setAnchor(id(new PhabricatorAnchorView())->setAnchorName('R'));
         try {
             $query = $engine->buildQueryFromSavedQuery($saved_query);
             $pager = $engine->newPagerForSavedQuery($saved_query);
             $pager->readFromRequest($request);
             $objects = $engine->executeQuery($query, $pager);
             // TODO: To support Dashboard panels, rendering is moving into
             // SearchEngines. Move it all the way in and then get rid of this.
             $interface = 'PhabricatorApplicationSearchResultsControllerInterface';
             if ($parent instanceof $interface) {
                 $list = $parent->renderResultsList($objects, $saved_query);
             } else {
//.........这里部分代码省略.........
开发者ID:TomCN7,项目名称:phabricator,代码行数:101,代码来源:PhabricatorApplicationSearchController.php


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