本文整理汇总了PHP中ResultContext::getCurrentSort方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::getCurrentSort方法的具体用法?PHP ResultContext::getCurrentSort怎么用?PHP ResultContext::getCurrentSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::getCurrentSort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
//.........这里部分代码省略.........
switch ($va_facet_info["group_mode"]) {
case "alphabetical":
case "list":
default:
$this->view->setVar('facet_content', $o_browse->getFacetContent($vs_facet, array("checkAccess" => $this->opa_access_values)));
$this->render("Browse/list_facet_html.php");
break;
case "hierarchical":
$this->render("Browse/hierarchy_facet_html.php");
break;
}
return;
}
//
// Add criteria and execute
//
$vs_search_expression = $this->opo_result_context->getSearchExpression();
if ($vs_facet = $this->request->getParameter('facet', pString)) {
$o_browse->addCriteria($vs_facet, array($this->request->getParameter('id', pString)));
} else {
if ($o_browse->numCriteria() == 0) {
$o_browse->addCriteria("_search", array($vs_search_expression . ($o_search_config->get('matchOnStem') && !preg_match('!\\*$!', $vs_search_expression) && preg_match('![\\w]+$!', $vs_search_expression) ? '*' : '')));
}
}
//
// Sorting
//
$vb_sort_changed = false;
$o_block_result_context = null;
if (!($ps_sort = $this->request->getParameter("sort", pString))) {
// inherit sort setting from multisearch? (used when linking to full results from multisearch result)
if ($this->request->getParameter("source", pString) === 'multisearch') {
$o_block_result_context = new ResultContext($this->request, $va_browse_info['table'], 'multisearch', $ps_function);
if ($ps_sort !== $o_block_result_context->getCurrentSort() && $o_block_result_context->getCurrentSort()) {
$ps_sort = $o_block_result_context->getCurrentSort();
$vb_sort_changed = true;
}
}
if (!$ps_sort && !($ps_sort = $this->opo_result_context->getCurrentSort())) {
if (is_array($va_sorts = caGetOption('sortBy', $va_browse_info, null))) {
$ps_sort = array_shift(array_keys($va_sorts));
$vb_sort_changed = true;
}
}
} else {
$vb_sort_changed = true;
}
if ($vb_sort_changed) {
# --- set the default sortDirection if available
$va_sort_direction = caGetOption('sortDirection', $va_browse_info, null);
if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
$this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
}
}
if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
if (!($ps_sort_direction = $this->opo_result_context->getCurrentSortDirection())) {
$ps_sort_direction = 'asc';
}
}
$this->opo_result_context->setCurrentSort($ps_sort);
$this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
$va_sort_by = caGetOption('sortBy', $va_browse_info, null);
$this->view->setVar('sortBy', is_array($va_sort_by) ? $va_sort_by : null);
$this->view->setVar('sortBySelect', $vs_sort_by_select = is_array($va_sort_by) ? caHTMLSelect("sort", $va_sort_by, array('id' => "sort"), array("value" => $ps_sort)) : '');
$this->view->setVar('sortControl', $vs_sort_by_select ? _t('Sort with %1', $vs_sort_by_select) : '');
$this->view->setVar('sort', $ps_sort);
示例2: setDetail
function setDetail()
{
if (!$this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
return;
}
AssetLoadManager::register("mediaViewer");
$o_context = new ResultContext($this->request, 'ca_objects', 'sets', 'lightbox');
$o_context->setAsLastFind();
$this->view->setVar('browse', $o_browse = caGetBrowseInstance("ca_objects"));
$this->view->setVar("browse_type", "caLightbox");
# --- this is only used when loading hierarchy facets and is a way to get around needing a browse type to pull the table in FindController
$ps_view = $this->request->getParameter('view', pString);
if (!in_array($ps_view, array('thumbnail', 'timeline', 'timelineData', 'pdf', 'list'))) {
$ps_view = 'thumbnail';
}
$this->view->setVar('view', $ps_view);
$this->view->setVar('views', $this->opo_config->getAssoc("views"));
if (!($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
$this->Index();
}
$vn_set_id = $t_set->get("set_id");
$this->view->setVar("set", $t_set);
$va_comments = $t_set->getComments();
$this->view->setVar("comments", $va_comments);
//
// Load existing browse if key is specified
//
if ($ps_cache_key = $this->request->getParameter('key', pString)) {
$o_browse->reload($ps_cache_key);
}
//
// Clear criteria if required
//
if ($vs_remove_criterion = $this->request->getParameter('removeCriterion', pString)) {
$o_browse->removeCriteria($vs_remove_criterion, array($this->request->getParameter('removeID', pString)));
}
if ((bool) $this->request->getParameter('clear', pInteger)) {
// Clear all refine critera but *not* underlying _search criterion
$va_criteria = $o_browse->getCriteria();
foreach ($va_criteria as $vs_criterion => $va_criterion_info) {
if ($vs_criterion == '_search') {
continue;
}
$o_browse->removeCriteria($vs_criterion, array_keys($va_criterion_info));
}
}
if ($this->request->getParameter('getFacet', pInteger)) {
$vs_facet = $this->request->getParameter('facet', pString);
$this->view->setVar('facet_name', $vs_facet);
$this->view->setVar('key', $o_browse->getBrowseID());
$va_facet_info = $o_browse->getInfoForFacet($vs_facet);
$this->view->setVar('facet_info', $va_facet_info);
# --- pull in different views based on format for facet - alphabetical, list, hierarchy
switch ($va_facet_info["group_mode"]) {
case "alphabetical":
case "list":
default:
$this->view->setVar('facet_content', $o_browse->getFacetContent($vs_facet, array("checkAccess" => $this->opa_access_values)));
$this->render("Browse/list_facet_html.php");
break;
case "hierarchical":
$this->render("Browse/hierarchy_facet_html.php");
break;
}
return;
}
//
// Add criteria and execute
//
$vs_search_expression = "ca_sets.set_id:{$vn_set_id}";
if ($o_browse->numCriteria() == 0 && $vs_search_expression) {
$o_browse->addCriteria("_search", array($vs_search_expression));
}
if ($vs_facet = $this->request->getParameter('facet', pString)) {
$o_browse->addCriteria($vs_facet, array($this->request->getParameter('id', pString)));
}
//
// Sorting
//
$vb_sort_changed = false;
if (!($ps_secondary_sort = $this->request->getParameter("secondary_sort", pString))) {
$ps_secondary_sort = $o_context->getCurrentSecondarySort();
}
$va_config_sort = $this->opo_config->getAssoc("sortBy");
if (!is_array($va_config_sort)) {
$va_config_sort = array();
}
$va_sort_by = array_merge(array(_t('Set order') => "ca_set_items.rank/{$vn_set_id}"), $va_config_sort);
if (!($ps_sort = urldecode($this->request->getParameter("sort", pString)))) {
if (!$ps_sort && !($ps_sort = $o_context->getCurrentSort())) {
if (is_array($va_sort_by)) {
$ps_sort = array_shift(array_keys($va_sort_by));
$vb_sort_changed = true;
}
}
} else {
$vb_sort_changed = true;
}
if ($vb_sort_changed) {
//.........这里部分代码省略.........