public function Edit($pa_values = null, $pa_options = null) { $o_result_context = new ResultContext($this->request, 'ca_relationship_types', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('type_id', pInteger); $vn_parent_id = $this->request->getParameter('parent_id', pInteger); // If we're creating a new record we'll need to establish the table_num // from the parent (there's always a parent) if (!$vn_id) { $t_parent = new ca_relationship_types($vn_parent_id); if (!$t_parent->getPrimaryKey()) { $this->postError(1230, _t("Invalid parent"), "RelationshipTypeEditorController->Edit()"); return; } $this->request->setParameter('table_num', $t_parent->get('table_num')); } if (!is_array($va_cur_result) || !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all types in the same level as the currently selected type // $t_instance = new ca_relationship_types(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($this->request->getParameter('type_id', pInteger), array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
public function ListDisplays() { AssetLoadManager::register('tableList'); $t_display = new ca_bundle_displays(); $this->view->setVar('t_display', $t_display); $this->view->setVar('display_list', $va_displays = caExtractValuesByUserLocale($t_display->getBundleDisplays(array('user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)), null, null, array())); $o_result_context = new ResultContext($this->request, 'ca_bundle_displays', 'basic_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList(is_array($va_displays) ? array_keys($va_displays) : array()); $o_result_context->saveContext(); $this->view->setVar('table_list', caFilterTableList($t_display->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST'))); $this->render('bundle_display_list_html.php'); }
public function Index() { AssetLoadManager::register('tableList'); $vo_dm = Datamodel::load(); $va_elements = ca_metadata_elements::getRootElementsAsList(null, null, true, true); $this->view->setVar('element_list', $va_elements); $this->view->setVar('attribute_types', Attribute::getAttributeTypes()); $o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search'); $o_result_context->setResultList(array_keys($va_elements)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); return $this->render('elements_list_html.php'); }
public function ListForms() { AssetLoadManager::register('tableList'); $t_form = new ca_search_forms(); $this->view->setVar('t_form', $t_form); $this->view->setVar('form_list', $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)), null, null, array())); $o_result_context = new ResultContext($this->request, 'ca_search_forms', 'basic_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList(is_array($va_forms) ? array_keys($va_forms) : array()); $o_result_context->saveContext(); $this->view->setVar('table_list', caFilterTableList($t_form->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST'))); $this->render('search_form_list_html.php'); }
public function Edit() { $o_result_context = new ResultContext($this->request, 'ca_tour_stops', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('stop_id', pInteger); if (is_array($va_cur_result) && !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all items in the same level as the currently selected item // $t_instance = new ca_list_items(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($vn_id, array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
public function ListSets() { AssetLoadManager::register('tableList'); $o_result_context = new ResultContext($this->request, 'ca_sets', 'basic_search'); $t_set = new ca_sets(); $this->view->setVar('t_set', $t_set); $vn_user_id = !(bool) $this->request->config->get('ca_sets_all_users_see_all_sets') ? $this->request->getUserID() : null; if ($this->request->user->canDoAction('is_administrator') || $this->request->user->canDoAction('can_administrate_sets')) { $ps_mode = $this->request->getParameter('mode', pString); if (strlen($ps_mode) > 0) { $pn_mode = (int) $ps_mode; $o_result_context->setParameter('set_display_mode', $pn_mode); } else { $pn_mode = (int) $o_result_context->getParameter('set_display_mode'); } switch ($pn_mode) { case 0: default: $va_set_list = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'access' => __CA_SET_EDIT_ACCESS__)), null, null, array()); break; case 1: $va_set_list = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'allUsers' => true)), null, null, array()); break; case 2: $va_set_list = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'publicUsers' => true)), null, null, array()); break; } } else { $va_set_list = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'access' => __CA_SET_EDIT_ACCESS__)), null, null, array()); } if ($va_set_list) { foreach ($va_set_list as $id => $va_set) { $va_set_list[$id]['can_delete'] = $this->UserCanDeleteSet($va_set['user_id']); } } $this->view->setVar('mode', $pn_mode); $this->view->setVar('set_list', $va_set_list); // get content types for sets $this->view->setVar('table_list', caFilterTableList($t_set->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST'))); $o_result_context->setAsLastFind(); $o_result_context->setResultList(array_keys($va_set_list)); $o_result_context->saveContext(); $this->render('set_list_html.php'); }
protected function _initView($pa_options = null) { AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register('sortableUI'); AssetLoadManager::register('bundleListEditorUI'); if ($vn_rc = parent::_initView()) { $t_screen = $this->view->getVar('t_subject'); $this->opn_ui_id = $t_screen->get('ui_id'); $t_ui = new ca_editor_uis($this->opn_ui_id); $va_screens = $t_ui->getScreens(null, array('showAll' => true)); if (is_array($va_screens)) { $o_result_context = new ResultContext($this->request, 'ca_editor_ui_screens', 'basic_search'); $o_result_context->setResultList(array_keys($va_screens)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); } } return $vn_rc; }
/** * */ public function ListUIs() { AssetLoadManager::register('tableList'); $this->checkConfiguration(); $vo_dm = Datamodel::load(); $va_uis = ca_editor_uis::getUIList(null); foreach ($va_uis as $vs_key => $va_ui) { if (!($t_instance = $vo_dm->getInstanceByTableNum($va_ui['editor_type'], true))) { continue; } $va_uis[$vs_key]['editor_type'] = $t_instance->getProperty('NAME_PLURAL'); } $this->view->setVar('editor_ui_list', $va_uis); $o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search'); $o_result_context->setResultList(array_keys($va_uis)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); $t_ui = new ca_editor_uis(); $this->view->setVar('table_list', caFilterTableList($t_ui->getFieldInfo('editor_type', 'BOUNDS_CHOICE_LIST'))); return $this->render('ui_list_html.php'); }
private function _setResultContextForSecondarySearch($ps_table_name, $ps_expression, $po_result) { $opo_result_context = new ResultContext($this->request, $ps_table_name, 'basic_search'); $opo_result_context->setSearchExpression($ps_expression); $t_model = $this->opo_datamodel->getInstanceByTableName($ps_table_name, true); $vs_pk = $t_model->primaryKey(); $po_result->seek(0); $va_found_item_ids = array(); while ($po_result->nextHit()) { $va_found_item_ids[] = $po_result->get($ps_table_name . '.' . $vs_pk); } $opo_result_context->setResultList($va_found_item_ids); $opo_result_context->setAsLastFind(); $opo_result_context->saveContext(); $po_result->seek(0); return true; }
/** * */ public function __call($ps_function, $pa_args) { $o_config = caGetBrowseConfig(); $o_search_config = caGetSearchConfig(); $pa_options = array_shift($pa_args); $vb_is_advanced = (bool) $this->request->getParameter('_advanced', pInteger); $vs_find_type = $vb_is_advanced ? $this->ops_find_type . '_advanced' : $this->ops_find_type; $this->view->setVar("config", $o_config); $ps_function = strtolower($ps_function); $ps_type = $this->request->getActionExtra(); $this->view->setVar("browse_type", $ps_function); if (!($va_browse_info = caGetInfoForBrowseType($ps_function))) { // invalid browse type – throw error die("Invalid browse type {$ps_function}"); } $vs_class = $va_browse_info['table']; $va_types = caGetOption('restrictToTypes', $va_browse_info, array(), array('castTo' => 'array')); $this->opo_result_context = new ResultContext($this->request, $va_browse_info['table'], $vs_find_type); $this->opo_result_context->setAsLastFind(); MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search %1", $va_browse_info["displayName"]) . ": " . $this->opo_result_context->getSearchExpression()); if ($vb_is_advanced) { $this->opo_result_context->setSearchExpression(caGetQueryStringForHTMLFormInput($this->opo_result_context)); } $this->view->setVar('browseInfo', $va_browse_info); $this->view->setVar('options', caGetOption('options', $va_browse_info, array(), array('castTo' => 'array'))); $ps_view = caGetOption('view', $pa_options, $this->request->getParameter('view', pString)); $va_views = caGetOption('views', $va_browse_info, array(), array('castTo' => 'array')); if (!is_array($va_views) || sizeof($va_views) == 0) { $va_views = array('list' => array(), 'images' => array(), 'timeline' => array(), 'map' => array(), 'timelineData' => array(), 'pdf' => array()); } else { $va_views['pdf'] = array(); } if (!in_array($ps_view, array_keys($va_views))) { $ps_view = array_shift(array_keys($va_views)); } $vs_format = $ps_view == 'timelineData' ? 'json' : 'html'; #caAddPageCSSClasses(array($vs_class, $ps_function, $ps_view)); caAddPageCSSClasses(array($vs_class, $ps_function)); $this->view->setVar('isNav', (bool) $this->request->getParameter('isNav', pInteger)); // flag for browses that originate from nav bar $t_instance = $this->getAppDatamodel()->getInstanceByTableName($vs_class, true); $vn_type_id = $t_instance->getTypeIDForCode($ps_type); $this->view->setVar('t_instance', $t_instance); $this->view->setVar('table', $va_browse_info['table']); $this->view->setVar('primaryKey', $t_instance->primaryKey()); $this->view->setVar('browse', $o_browse = caGetBrowseInstance($vs_class)); $this->view->setVar('views', caGetOption('views', $va_browse_info, array(), array('castTo' => 'array'))); $this->view->setVar('view', $ps_view); $this->view->setVar('viewIcons', $o_config->getAssoc("views")); // // Load existing browse if key is specified // if ($ps_cache_key = $this->request->getParameter('key', pString)) { $o_browse->reload($ps_cache_key); } if (is_array($va_types) && sizeof($va_types)) { $o_browse->setTypeRestrictions($va_types); } // // 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)) { $o_browse->removeAllCriteria(); } 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 = $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); $this->view->setVar('sort_direction', $ps_sort_direction); $va_options = array('checkAccess' => $this->opa_access_values); if ($va_restrict_to_fields = caGetOption('restrictSearchToFields', $va_browse_info, null)) { $va_options['restrictSearchToFields'] = $va_restrict_to_fields; } if (caGetOption('dontShowChildren', $va_browse_info, false)) { $o_browse->addResultFilter('ca_objects.parent_id', 'is', 'null'); } $o_browse->execute($va_options); // // Facets // if ($vs_facet_group = caGetOption('facetGroup', $va_browse_info, null)) { $o_browse->setFacetGroup($vs_facet_group); } $va_available_facet_list = caGetOption('availableFacets', $va_browse_info, null); $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($ps_function . '_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 // $qr_res = $o_browse->getResults(array('sort' => $va_sort_by[$ps_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 = $this->opo_result_context->getItemsPerPage())) { $pn_hits_per_block = $o_config->get("defaultHitsPerBlock"); } } $this->opo_result_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)); $this->opo_result_context->setParameter('key', $vs_key); if (($vn_key_start = $vn_start - 500) < 0) { $vn_key_start = 0; } $qr_res->seek($vn_key_start); $this->opo_result_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); $this->opo_result_context->saveContext(); if ($vn_type_id) { if ($this->render("Browse/{$vs_class}_{$vs_type}_{$ps_view}_{$vs_format}.php")) { return; } } switch ($ps_view) { case 'pdf': $this->_genExport($qr_res, $this->request->getParameter("export_format", pString), $vs_search_expression, $vs_search_expression); break; case 'timelineData': $this->view->setVar('view', 'timeline'); $this->render("Browse/browse_results_timelineData_json.php"); break; default: $this->render("Browse/browse_results_html.php"); break; } }
if ($vn_col > $vn_numCols) { $vn_col = 1; } $va_related_objects[] = $vn_object_id; } } # save object id's in result context $o_search_result_context = new ResultContext($this->request, "ca_objects", $va_other_params['detail_type']); $o_search_result_context->setAsLastFind(); if ($va_other_params['entity_id']) { $o_search_result_context->setParameter("entity_id", $va_other_params['entity_id']); } if ($va_other_params['occurrence_id']) { $o_search_result_context->setParameter("occurrence_id", $va_other_params['occurrence_id']); } $o_search_result_context->setResultList($va_related_objects); $o_search_result_context->saveContext(); ?> <div class="ad_thumbs" <?php print $vn_numCols == 3 ? "style='width:555px;'" : ""; ?> ><div> <?php $i = 1; while ($i <= $vn_numCols) { print '<div class="col">' . join("<br/>", ${"va_col" . $i}) . '</div>'; $i++; } ?> <div style="clear:both;"><!-- empty --></div></div></div><!--end ad_thumbs--> <script type="text/javascript">
public function Delete() { if (!($t_group = $this->getGroupObject())) { $this->notification->addNotification(_t("You cannot delete this group"), __NOTIFICATION_TYPE_ERROR__); $this->render('group_list_html.php'); return; } if ($this->request->getParameter('confirm', pInteger)) { $t_group->setMode(ACCESS_WRITE); $t_group->delete(true); if ($t_group->numErrors()) { foreach ($t_group->errors() as $o_e) { $this->request->addActionError($o_e, 'general'); } } $o_result_context = new ResultContext($this->request, 'ca_user_groups', 'basic_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList(array()); $o_result_context->saveContext(); $this->ListGroups(); return; } else { $this->render('group_delete_html.php'); } }
function setDetail() { if (!$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm')); return; } AssetLoadManager::register("mediaViewer"); $ps_view = $this->request->getParameter('view', pString); if (!in_array($ps_view, array('thumbnail', 'timeline', 'timelineData', 'pdf'))) { $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(); } $va_set_items = caExtractValuesByUserLocale($t_set->getItems(array("user_id" => $this->request->getUserID(), "thumbnailVersions" => array("medium"), "checkAccess" => $this->opa_access_values))); $this->view->setVar("set", $t_set); $this->view->setVar("set_items", $va_set_items); $va_comments = $t_set->getComments(); $this->view->setVar("comments", $va_comments); $o_context = new ResultContext($this->request, 'ca_objects', 'sets'); $o_context->setResultList($va_set_ids = $t_set->getItems(array('idsOnly' => true))); $o_context->saveContext(); $o_context->setAsLastFind(); MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Lightbox") . ": " . $t_set->getLabelForDisplay()); switch ($ps_view) { case 'pdf': $qr_res = caMakeSearchResult('ca_objects', $va_set_ids); $this->view->setVar('result', $qr_res); $this->_genExport($qr_res, '_pdf_checklist', $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; } }
function Index() { $vn_y = $this->ops_date_range; $va_period_data = array(); // // Do browse for objects from period; we'll use the facets for related entities, occurrences and list items // from this browse to generate lists of which have related objects to show from it. // $vo_object_browse = new ObjectBrowse(); // we'll do a browse $vo_object_browse->addCriteria('_search', array('ca_objects.creation_date:"' . $vn_y . '"')); // criteria is a search for creation date $vo_object_browse->execute(); // execute the browse // // Get events & exhibitions (occurrences) // $o_occ_search = new OccurrenceSearch(); $qr_occs = $o_occ_search->search("ca_occurrences.event_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.event_date", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_occ_ids = array(); while ($qr_occs->nextHit()) { $va_occ_ids[] = $qr_occs->get("ca_occurrences.occurrence_id"); } $qr_occs->seek(0); // result context for occ $o_search_result_context_occ = new ResultContext($this->request, "ca_occurrences", 'chronology'); $o_search_result_context_occ->setAsLastFind(); $o_search_result_context_occ->setResultList($va_occ_ids); $o_search_result_context_occ->setParameter("period", $this->opn_period); $o_search_result_context_occ->saveContext(); $va_period_data["occurrences"] = $qr_occs; // Get list of occurrences that have associated objects *from this period* $va_related_occs = $vo_object_browse->getFacet('occurrence_facet'); $va_period_data["occurrences_with_objects"] = is_array($va_related_occs) ? array_keys($vo_object_browse->getFacet('occurrence_facet')) : array(); // grab the related occurrences facet to get a list of occurrences with objects; the keys of the returned array are occurrence_ids // // Get entity list // $o_ent_search = new EntitySearch(); $qr_entities = $o_ent_search->search("ca_entities.arrival_date:\"" . $vn_y . "\"", array("sort" => "ca_entity_labels.surname", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_entity_ids = array(); while ($qr_entities->nextHit()) { $va_entity_ids[] = $qr_entities->get("ca_entities.entity_id"); } $qr_entities->seek(0); $this->opo_search_result_context_entity->setAsLastFind(); $this->opo_search_result_context_entity->setResultList($va_entity_ids); $this->opo_search_result_context_entity->setParameter("period", $this->opn_period); $this->opo_search_result_context_entity->saveContext(); $va_period_data["entities"] = $qr_entities; $va_related_entities = $vo_object_browse->getFacet('entity_facet'); $va_period_data["entities_with_objects"] = is_array($va_related_entities) ? array_keys($va_related_entities) : array(); // grab the related entities facet to get a list of entities with objects; the keys of the returned array are entity_ids // // Get styles/schools (list items) list // $o_styles_schools_search = new ListItemSearch(); $qr_styles_schools_search = $o_styles_schools_search->search("ca_list_items.term_date:\"" . $vn_y . "\"", array("sort" => "ca_list_item_labels.name_singular", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_period_data["styles_schools"] = $qr_styles_schools_search; $va_related_list_items = $vo_object_browse->getFacet('style'); $va_period_data["list_items_with_objects"] = is_array($va_related_list_items) ? array_keys($va_related_list_items) : array(); // grab the related list items facet to get a list of list items with objects; the keys of the returned array are item_ids # -- make array of entity_ids so can find places associated with these entities to map // $va_entities = array(); // if($qr_entities->numHits()){ // while($qr_entities->nextHit()){ // $va_entities[] = $qr_entities->get("entity_id"); // } // } // $qr_entities->seek(0); // $o_place_search = new PlaceSearch(); // $o_place_search->addResultFilter("ca_entities.entity_id", "IN", join(',', $va_entities)); // $qr_places = $o_place_search->search("*", array("no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); // $o_map = new GeographicMap(450, 250, 'map'); // $va_map_stats = $o_map->mapFrom($qr_places, "georeference", array("ajaxContentUrl" => caNavUrl($this->request, "eastend", "Chronology", "getMapItemInfo"), "request" => $this->request, "checkAccess" => $this->opa_access_values)); // $va_period_data["map"] = $o_map->render('HTML', array('delimiter' => "<br/>")); // $va_period_data["places"] = $qr_places; $o_obj_search = new ObjectSearch(); $qr_objects = $o_obj_search->search("ca_objects.creation_date:\"" . $vn_y . "\" AND (ca_object.object_status:349 OR ca_object.object_status:347 OR ca_object.object_status:193)", array("sort" => "ca_objects.creation_date", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values)); $va_period_data["objects"] = $qr_objects; $va_object_ids = array(); while ($qr_objects->nextHit()) { $va_object_ids[] = $qr_objects->get("ca_objects.object_id"); } $qr_objects->seek(0); $this->opo_result_context->setAsLastFind(); $this->opo_result_context->setResultList($va_object_ids); $this->opo_result_context->setParameter("period", $this->opn_period); $this->opo_result_context->saveContext(); $this->view->setVar('period_data', $va_period_data); $this->render('chronology_period_html.php'); }
/** * */ function Index() { if (!$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'form')); return; } if (!($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) { $t_set = new ca_sets(); } JavascriptLoadManager::register('sortableUI'); # --- get all sets for user $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'user_id' => $this->request->getUserID()))); if (sizeof($va_sets) == 0) { # --- if there are not any sets for this user, make a new set for them $t_new_set = new ca_sets(); $vn_new_set_id = null; $t_new_set->setMode(ACCESS_WRITE); $t_new_set->set('access', 0); $t_new_set->set('table_num', 57); // 57=ca_objects $t_list = new ca_lists(); $vn_set_id = $t_list->getItemIDFromList('set_types', $this->request->config->get('user_set_type')); $t_new_set->set('type_id', $vn_set_id); $t_new_set->set('user_id', $this->request->getUserID()); $t_new_set->set('set_code', $this->request->getUserID() . '_' . time()); $t_new_set->insert(); if (!$t_new_set->numErrors()) { if ($vn_new_set_id = $t_new_set->getPrimaryKey()) { global $g_ui_locale_id; // current locale_id for user $t_new_set->addLabel(array('name' => _t("Your first lightbox")), $g_ui_locale_id, null, true); // select the current set $this->request->user->setVar('current_set_id', $vn_new_set_id); # --- load new set $t_set = new ca_sets($vn_new_set_id); # --- get the sets again so the new set is included $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'user_id' => $this->request->getUserID()))); } } } $t_new_set = new ca_sets(); # --- new set object used for access drop down in new set form $this->view->setVar('t_set', $t_set); $this->view->setVar('t_new_set', $t_new_set); $this->view->setVar('set_list', $va_sets); $this->view->setVar('set_name', $t_set->getLabelForDisplay()); $this->view->setVar('set_description', $t_set->get("ca_sets.set_intro")); $this->view->setVar('set_access', $t_set->get("ca_sets.access")); if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } $this->view->setVar('items', $va_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('thumbnail', 'icon'), 'checkAccess' => $va_access_values, 'user_id' => $this->request->getUserID())))); $va_found_item_ids = array(); foreach ($va_items as $vn_i => $va_item) { $va_found_item_ids[] = $va_item['row_id']; } $t_trans = new ca_commerce_transactions(); $t_trans->load(array('set_id' => $t_set->getPrimaryKey())); $vn_transaction_id = $t_trans->getPrimaryKey(); $t_comm = new ca_commerce_communications(); $this->view->setVar('messages', $t_comm->getMessages($this->request->getUserID(), array('transaction_id' => $vn_transaction_id))); $opo_result_context = new ResultContext($this->request, 'ca_objects', 'sets'); $opo_result_context->setResultList($va_found_item_ids); $opo_result_context->setAsLastFind(); $opo_result_context->saveContext(); # --- use a different view if client services is enabled if ($this->request->config->get("enable_client_services")) { $this->render('Sets/client_services_html.php'); } else { $this->render('Sets/sets_html.php'); } }
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) { # --- 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) { $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; } }
/** * */ public function Index($pa_options = null) { $ps_search = $this->request->getParameter('search', pString); $ps_sort = $this->request->getParameter('sort', pString); if (!$ps_search) { $ps_search = $this->request->session->getVar('quick_search_last_search'); } if (!in_array($ps_sort, array('name', 'idno'))) { if (!($ps_sort = $this->request->session->getVar('quick_search_last_sort'))) { $ps_sort = 'name'; } } MetaTagManager::setWindowTitle(_t('Quick search')); $o_config = Configuration::load(); $vs_default_actions["ca_objects"] = $this->request->user->canDoAction("can_edit_ca_objects") ? "Edit" : "Summary"; $vs_default_actions["ca_object_lots"] = $this->request->user->canDoAction("can_edit_ca_object_lots") ? "Edit" : "Summary"; $vs_default_actions["ca_entities"] = $this->request->user->canDoAction("can_edit_ca_entities") ? "Edit" : "Summary"; $vs_default_actions["ca_places"] = $this->request->user->canDoAction("can_edit_ca_places") ? "Edit" : "Summary"; $vs_default_actions["ca_occurrences"] = $this->request->user->canDoAction("can_edit_ca_occurrences") ? "Edit" : "Summary"; $vs_default_actions["ca_collections"] = $this->request->user->canDoAction("can_edit_ca_collections") ? "Edit" : "Summary"; $vs_default_actions["ca_storage_locations"] = $this->request->user->canDoAction("can_edit_ca_storage_locations") ? "Edit" : "Summary"; $vs_default_actions["ca_loans"] = $this->request->user->canDoAction("can_edit_ca_loans") ? "Edit" : "Summary"; $vs_default_actions["ca_movements"] = $this->request->user->canDoAction("can_edit_ca_movements") ? "Edit" : "Summary"; $vs_default_actions["ca_tours"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary"; $vs_default_actions["ca_tour_stops"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary"; $va_searches = array('ca_collections' => array('name' => 'ca_collection_labels.name', 'displayidno' => 'ca_collections.idno', 'idno' => 'ca_collections.idno_sort', 'displayname' => _t('Collections'), 'primary_key' => 'collection_id', 'module' => 'editor/collections', 'controller' => 'CollectionEditor', 'action' => $vs_default_actions["ca_collections"], 'searchModule' => 'find', 'searchController' => 'SearchCollections', 'searchAction' => "Index"), 'ca_objects' => array('name' => 'ca_object_labels.name', 'displayidno' => 'ca_objects.idno', 'idno' => 'ca_objects.idno_sort', 'displayname' => _t('Objects'), 'primary_key' => 'object_id', 'module' => 'editor/objects', 'controller' => 'ObjectEditor', 'action' => $vs_default_actions["ca_objects"], 'searchModule' => 'find', 'searchController' => 'SearchObjects', 'searchAction' => "Index"), 'ca_object_lots' => array('name' => 'ca_object_lot_labels.name', 'displayidno' => 'ca_object_lots.idno_stub', 'idno' => 'ca_object_lots.idno_stub_sort', 'displayname' => _t('Object lots'), 'primary_key' => 'lot_id', 'module' => 'editor/object_lots', 'controller' => 'ObjectLotEditor', 'action' => $vs_default_actions["ca_object_lots"], 'searchModule' => 'find', 'searchController' => 'SearchObjectLots', 'searchAction' => "Index"), 'ca_entities' => array('name' => 'ca_entity_labels.surname;ca_entity_labels.forename', 'displayidno' => 'ca_entities.idno', 'idno' => 'ca_entities.idno_sort', 'displayname' => _t('Entities'), 'primary_key' => 'entity_id', 'module' => 'editor/entities', 'controller' => 'EntityEditor', 'action' => $vs_default_actions["ca_entities"], 'searchModule' => 'find', 'searchController' => 'SearchEntities', 'searchAction' => "Index"), 'ca_places' => array('name' => 'ca_place_labels.name', 'displayidno' => 'ca_places.idno', 'idno' => 'ca_places.idno_sort', 'displayname' => _t('Places'), 'primary_key' => 'place_id', 'module' => 'editor/places', 'controller' => 'PlaceEditor', 'action' => $vs_default_actions["ca_places"], 'searchModule' => 'find', 'searchController' => 'SearchPlaces', 'searchAction' => "Index"), 'ca_occurrences' => array('name' => 'ca_occurrence_labels.name', 'displayidno' => 'ca_occurrences.idno', 'idno' => 'ca_occurrences.idno_sort', 'displayname' => _t('Occurrences'), 'primary_key' => 'occurrence_id', 'module' => 'editor/occurrences', 'controller' => 'OccurrenceEditor', 'action' => $vs_default_actions["ca_occurrences"], 'searchModule' => 'find', 'searchController' => 'SearchOccurrences', 'searchAction' => "Index"), 'ca_storage_locations' => array('name' => 'ca_storage_location_labels.name', 'displayidno' => '', 'idno' => '', 'displayname' => _t('Storage locations'), 'primary_key' => 'location_id', 'module' => 'editor/storage_locations', 'controller' => 'StorageLocationEditor', 'action' => $vs_default_actions["ca_storage_locations"], 'searchModule' => 'find', 'searchController' => 'SearchStorageLocations', 'searchAction' => "Index"), 'ca_loans' => array('name' => 'ca_loan_labels.name', 'displayidno' => 'ca_loans.idno', 'idno' => 'ca_loans.idno_sort', 'displayname' => _t('Loans'), 'primary_key' => 'loan_id', 'module' => 'editor/loans', 'controller' => 'LoanEditor', 'action' => $vs_default_actions["ca_loans"], 'searchModule' => 'find', 'searchController' => 'SearchLoans', 'searchAction' => "Index"), 'ca_movements' => array('name' => 'ca_movement_labels.name', 'displayidno' => 'ca_movements.idno', 'idno' => 'ca_movements.idno_sort', 'displayname' => _t('Movements'), 'primary_key' => 'movement_id', 'module' => 'editor/movements', 'controller' => 'MovementEditor', 'action' => $vs_default_actions["ca_movements"], 'searchModule' => 'find', 'searchController' => 'SearchMovements', 'searchAction' => "Index"), 'ca_tours' => array('name' => 'ca_tour_labels.name', 'displayidno' => 'ca_tours.tour_code', 'idno' => 'ca_tours.tour_code', 'displayname' => _t('Tours'), 'primary_key' => 'tour_id', 'module' => 'editor/tours', 'controller' => 'TourEditor', 'action' => $vs_default_actions["ca_tours"], 'searchModule' => 'find', 'searchController' => 'SearchTours', 'searchAction' => "Index"), 'ca_tour_stops' => array('name' => 'ca_tour_stop_labels.name', 'displayidno' => 'ca_tour_stops.idno', 'idno' => 'ca_tour_stops.idno_sort', 'displayname' => _t('Tour stops'), 'primary_key' => 'stop_id', 'module' => 'editor/tour_stops', 'controller' => 'TourStopEditor', 'action' => $vs_default_actions["ca_tour_stops"], 'searchModule' => 'find', 'searchController' => 'SearchTourStops', 'searchAction' => "Index")); $t_list = new ca_lists(); $this->view->setVar('occurrence_types', caExtractValuesByUserLocale($t_list->getItemsForList('occurrence_types'))); if (sizeof($va_aps_in_search = caSearchGetAccessPoints($ps_search))) { $va_aps = caSearchGetTablesForAccessPoints($va_aps_in_search); $vb_uses_aps = true; } else { $vb_uses_aps = false; } $va_single_results = array(); $pn_multiple_results = 0; foreach ($va_searches as $vs_table => $va_sorts) { if ($o_config->get($vs_table . '_disable') || $vs_table == 'ca_tour_stops' && $o_config->get('ca_tours_disable') || $vb_uses_aps && !in_array($vs_table, $va_aps)) { unset($va_searches[$vs_table]); continue; } if (!($vo_result = $this->_doSearch($vs_table, $ps_search, $va_sorts[$ps_sort]))) { unset($va_searches[$vs_table]); continue; } $vo_result->setOption('prefetch', $this->opn_num_results_per_item_type); // get everything we need in one pass $vo_result->setOption('dontPrefetchAttributes', true); // don't bother trying to prefetch attributes as we don't need them $this->view->setVar($vs_table . '_results', $vo_result); $va_found_item_ids = array(); while ($vo_result->nextHit()) { $va_found_item_ids[] = $vo_result->get($va_sorts['primary_key']); } $vo_result->seek(0); $o_result_context = new ResultContext($this->request, $vs_table, 'quick_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList($va_found_item_ids); $o_result_context->saveContext(); if ($vo_result->numHits() > 0) { if ($vo_result->numHits() == 1) { $va_single_results[$vs_table] = $va_found_item_ids[0]; } else { $pn_multiple_results = 1; } } } $this->view->setVar('searches', $va_searches); // note last quick search if ($ps_search) { $this->request->session->setVar('quick_search_last_search', $ps_search); } if ($ps_sort) { $this->request->session->setVar('quick_search_last_sort', $ps_sort); } $this->view->setVar('search', $ps_search); $this->view->setVar('sort', $this->request->session->getVar('quick_search_last_sort')); $this->view->setVar('maxNumberResults', $this->opn_num_results_per_item_type); // did we find only a single result in a single table? If so, then redirect to that record instead of showing results if (!$pn_multiple_results && sizeof($va_single_results) == 1) { foreach ($va_single_results as $vs_table => $vn_id) { $this->response->setRedirect(caEditorUrl($this->request, $vs_table, $vn_id)); return; } } $this->render('Results/quick_search_results_html.php'); }