本文整理汇总了PHP中ResultContext::getCurrentSortDirection方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::getCurrentSortDirection方法的具体用法?PHP ResultContext::getCurrentSortDirection怎么用?PHP ResultContext::getCurrentSortDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::getCurrentSortDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDetail
//.........这里部分代码省略.........
$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) {
# --- set the default sortDirection if available
$va_sort_direction = $this->opo_config->getAssoc("sortDirection");
if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
$o_context->setCurrentSortDirection($ps_sort_direction);
}
$ps_secondary_sort = "";
}
if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
if (!($ps_sort_direction = $o_context->getCurrentSortDirection())) {
$ps_sort_direction = 'asc';
}
}
$o_context->setCurrentSort($ps_sort);
$o_context->setCurrentSecondarySort($ps_secondary_sort);
$o_context->setCurrentSortDirection($ps_sort_direction);
$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('sort', $ps_sort);
$va_secondary_sort_by = $this->opo_config->getAssoc("secondarySortBy");
$this->view->setVar('secondarySortBy', is_array($va_secondary_sort_by) ? $va_secondary_sort_by : null);
$this->view->setVar('secondarySortBySelect', $vs_secondary_sort_by_select = is_array($va_secondary_sort_by) ? caHTMLSelect("secondary_sort", $va_secondary_sort_by, array('id' => "secondary_sort"), array("value" => $ps_secondary_sort)) : '');
$this->view->setVar('secondarySort', $ps_secondary_sort);
$this->view->setVar('sortDirection', $ps_sort_direction);
$va_options = array('checkAccess' => $this->opa_access_values, 'no_cache' => true);
$o_browse->execute(array_merge($va_options, array('strictPhraseSearching' => true)));
//
// Facets
//
if ($vs_facet_group = $this->opo_config->get("set_facet_group")) {
$o_browse->setFacetGroup($vs_facet_group);
}
$va_available_facet_list = $this->opo_config->get("availableFacets");
$va_facets = $o_browse->getInfoForAvailableFacets();
if (is_array($va_available_facet_list) && sizeof($va_available_facet_list)) {
foreach ($va_facets as $vs_facet_name => $va_facet_info) {
if (!in_array($vs_facet_name, $va_available_facet_list)) {
unset($va_facets[$vs_facet_name]);
}
}
}
foreach ($va_facets as $vs_facet_name => $va_facet_info) {