當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ResultContext::getItemsPerPage方法代碼示例

本文整理匯總了PHP中ResultContext::getItemsPerPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP ResultContext::getItemsPerPage方法的具體用法?PHP ResultContext::getItemsPerPage怎麽用?PHP ResultContext::getItemsPerPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ResultContext的用法示例。


在下文中一共展示了ResultContext::getItemsPerPage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setDetail


//.........這裏部分代碼省略.........
             $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) {
         $va_facets[$vs_facet_name]['content'] = $o_browse->getFacetContent($vs_facet_name, array("checkAccess" => $this->opa_access_values));
     }
     $this->view->setVar('facets', $va_facets);
     $this->view->setVar('key', $vs_key = $o_browse->getBrowseID());
     $this->request->session->setVar('lightbox_last_browse_id', $vs_key);
     //
     // Current criteria
     //
     $va_criteria = $o_browse->getCriteriaWithLabels();
     if (isset($va_criteria['_search']) && isset($va_criteria['_search']['*'])) {
         unset($va_criteria['_search']);
     }
     $va_criteria_for_display = array();
     foreach ($va_criteria as $vs_facet_name => $va_criterion) {
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet_name);
         foreach ($va_criterion as $vn_criterion_id => $vs_criterion) {
             $va_criteria_for_display[] = array('facet' => $va_facet_info['label_singular'], 'facet_name' => $vs_facet_name, 'value' => $vs_criterion, 'id' => $vn_criterion_id);
         }
     }
     $this->view->setVar('criteria', $va_criteria_for_display);
     //
     // Results
     //
     $vs_combined_sort = $va_sort_by[$ps_sort];
     if ($ps_secondary_sort) {
         $vs_combined_sort .= ";" . $va_secondary_sort_by[$ps_secondary_sort];
     }
     $qr_res = $o_browse->getResults(array('sort' => $vs_combined_sort, 'sort_direction' => $ps_sort_direction));
     $this->view->setVar('result', $qr_res);
     if (!($pn_hits_per_block = $this->request->getParameter("n", pString))) {
         if (!($pn_hits_per_block = $o_context->getItemsPerPage())) {
             $pn_hits_per_block = $this->opo_config->get("defaultHitsPerBlock") ? $this->opo_config->get("defaultHitsPerBlock") : 36;
         }
     }
     $o_context->getItemsPerPage($pn_hits_per_block);
     $this->view->setVar('hits_per_block', $pn_hits_per_block);
     $this->view->setVar('start', $vn_start = $this->request->getParameter('s', pInteger));
     $o_context->setParameter('key', $vs_key);
     if (($vn_key_start = $vn_start - 500) < 0) {
         $vn_key_start = 0;
     }
     $qr_res->seek($vn_key_start);
     $o_context->setResultList($qr_res->getPrimaryKeyValues(1000));
     if ($o_block_result_context) {
         $o_block_result_context->setResultList($qr_res->getPrimaryKeyValues(1000));
         $o_block_result_context->saveContext();
     }
     $qr_res->seek($vn_start);
     $o_context->saveContext();
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . ucfirst($this->ops_lightbox_display_name) . ": " . $t_set->getLabelForDisplay());
     switch ($ps_view) {
         case 'pdf':
             $this->_genExport($qr_res, $this->request->getParameter("export_format", pString), $vs_label = $t_set->get('ca_sets.preferred_labels'), $vs_label);
         case 'timelineData':
             $this->view->setVar('view', 'timeline');
             $this->render("Sets/set_detail_timelineData_json.php");
             break;
         default:
             $this->render("Sets/set_detail_html.php");
             break;
     }
 }
開發者ID:kai-iak,項目名稱:pawtucket2,代碼行數:101,代碼來源:SetsController.php


注:本文中的ResultContext::getItemsPerPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。