本文整理汇总了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 {
//.........这里部分代码省略.........