public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } $t_list = new ca_lists(); $pn_type_restriction_id = $t_list->getItemIDFromList('occurrence_types', 'chronology'); // set type restrictions for searches $o_search_result_context = new ResultContext($this->request, "ca_occurrences", 'basic_search'); $o_search_result_context->setTypeRestriction($pn_type_restriction_id); $o_search_result_context->saveContext(); }
/** * Search handler (returns search form and results, if any) * Most logic is contained in the BaseSearchController->Index() method; all you usually * need to do here is instantiate a new subject-appropriate subclass of BaseSearch * (eg. CollectionSearch for collections, EntitySearch for entities) and pass it to BaseSearchController->Index() */ public function Index($pa_options = null) { $pa_options['search'] = new ItemTagSearch(); return parent::Index($pa_options); }
/** * Returns "search tools" widget */ public function Tools($pa_parameters) { // pass instance of subject-appropriate search object as second parameter (ex. for an object search this is an instance of ObjectSearch() return parent::Tools($pa_parameters); }
/** * Search handler (returns search form and results, if any) * Most logic is contained in the BaseSearchController->Index() method; all you usually * need to do here is instantiate a new subject-appropriate subclass of BaseSearch * (eg. ObjectSearch for objects, EntitySearch for entities) and pass it to BaseSearchController->Index() */ public function Index($pa_options = null) { $pa_options['search'] = $this->opo_browse; AssetLoadManager::register('imageScroller'); AssetLoadManager::register('tabUI'); AssetLoadManager::register('panel'); // get request data $va_relation_ids = explode(';', $this->getRequest()->getParameter('ids', pString)); $vs_rel_table = $this->getRequest()->getParameter('relTable', pString); $vs_interstitial_prefix = $this->getRequest()->getParameter('interstitialPrefix', pString); $vs_primary_table = $this->getRequest()->getParameter('primaryTable', pString); $vn_primary_id = $this->getRequest()->getParameter('primaryID', pInteger); $va_access_values = caGetUserAccessValues($this->getRequest()); if (!($vs_sort = $this->opo_result_context->getCurrentSort())) { $va_tmp = array_keys($this->opa_sorts); $vs_sort = array_shift($va_tmp); } // we need the rel table to translate the incoming relation_ids to object ids for the list search result $o_interstitial_res = caMakeSearchResult($vs_rel_table, $va_relation_ids); $va_ids = array(); $va_relation_id_map = array(); while ($o_interstitial_res->nextHit()) { $va_ids[$o_interstitial_res->get('relation_id')] = $o_interstitial_res->get('ca_objects.object_id'); $va_relation_id_map[$o_interstitial_res->get('ca_objects.object_id')] = array('relation_id' => $o_interstitial_res->get('relation_id'), 'relationship_typename' => $o_interstitial_res->getWithTemplate('^relationship_typename')); } $this->getView()->setVar('relationIdMap', $va_relation_id_map); $this->getView()->setVar('interstitialPrefix', $vs_interstitial_prefix); $this->getView()->setVar('relTable', $vs_rel_table); $this->getView()->setVar('primaryTable', $vs_primary_table); $this->getView()->setVar('primaryID', $vn_primary_id); $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection(); $va_search_opts = array('sort' => $vs_sort, 'sortDirection' => $vs_sort_direction, 'checkAccess' => $va_access_values, 'no_cache' => true, 'resolveLinksUsing' => $vs_primary_table, 'primaryIDs' => array($vs_primary_table => array($vn_primary_id))); $o_res = caMakeSearchResult('ca_objects', array_values($va_ids), $va_search_opts); $pa_options['result'] = $o_res; $pa_options['view'] = 'Search/ca_objects_table_html.php'; // override render $this->getView()->setVar('noRefine', true); return parent::Index($pa_options); }
/** * Search handler (returns search form and results, if any) * Most logic is contained in the BaseSearchController->Search() method; all you usually * need to do here is instantiate a new subject-appropriate subclass of BaseSearch * (eg. ObjectSearch for objects, EntitySearch for entities) and pass it to BaseSearchController->Search() */ public function Index($pa_options = null) { $ps_search = $this->opo_result_context->getSearchExpression(); $va_access_values = caGetUserAccessValues($this->request); if ($this->request->config->get('do_secondary_searches')) { if ($this->request->config->get('do_secondary_search_for_ca_entities')) { $o_search = new EntitySearch(); $qr_res = $o_search->search($ps_search, array('no_cache' => true, 'checkAccess' => $va_access_values)); $this->view->setVar('secondary_search_ca_entities', $qr_res); $this->_setResultContextForSecondarySearch('ca_entities', $ps_search, $qr_res); } if ($this->request->config->get('do_secondary_search_for_ca_places')) { $o_search = new PlaceSearch(); $qr_res = $o_search->search($ps_search, array('no_cache' => true, 'checkAccess' => $va_access_values)); $this->view->setVar('secondary_search_ca_places', $qr_res); $this->_setResultContextForSecondarySearch('ca_places', $ps_search, $qr_res); } if ($this->request->config->get('do_secondary_search_for_ca_occurrences')) { $o_search = new OccurrenceSearch(); $qr_res = $o_search->search($ps_search, array('no_cache' => true, 'checkAccess' => $va_access_values)); $this->view->setVar('secondary_search_ca_occurrences', $qr_res); $this->_setResultContextForSecondarySearch('ca_occurrences', $ps_search, $qr_res); } if ($this->request->config->get('do_secondary_search_for_ca_collections')) { $o_search = new CollectionSearch(); $qr_res = $o_search->search($ps_search, array('no_cache' => true, 'checkAccess' => $va_access_values)); $this->view->setVar('secondary_search_ca_collections', $qr_res); $this->_setResultContextForSecondarySearch('ca_collections', $ps_search, $qr_res); } } $this->view->setVar('secondaryItemsPerPage', $this->opa_items_per_secondary_search_page); $pa_options['search'] = $this->opo_browse; return parent::Index($pa_options); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')); JavascriptLoadManager::register('smoothDivScrollVertical'); MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css'); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('eastend plugin is not enabled')); } // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } if ($this->request->config->get("dont_enforce_access_settings")) { $this->opa_access_values = array(); } else { $this->opa_access_values = caGetUserAccessValues($this->request); } $this->view->setVar('access_values', $this->opa_access_values); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'chronology'); $t_list = new ca_lists(); $pn_type_restriction_id_entity = $t_list->getItemIDFromList('entity_types', 'individual'); // set type restrictions for searches $this->opo_search_result_context_entity = new ResultContext($this->request, "ca_entities", 'chronology'); $this->opo_search_result_context_entity->setTypeRestriction($pn_type_restriction_id_entity); $this->opo_search_result_context_entity->saveContext(); $va_periods = $this->opa_periods; $this->view->setVar('periods', $this->opa_periods); $vn_year = $this->request->getParameter('year', pInteger); $vn_period = $this->request->getParameter('period', pInteger); if (!$vn_period || !$va_periods[$vn_period]) { if ($vn_year) { # --- determine the period from the year foreach ($va_periods as $i => $va_per_info) { if ($vn_year >= $va_per_info["start"] && $vn_year <= $va_per_info["end"]) { $vn_period = $i; break; } } } else { $vn_period = $this->opn_default_period; } } $this->view->setVar('period', $vn_period); $this->opn_period = $vn_period; if (!$vn_year) { $vn_year = $va_periods[$vn_period]["start"]; } $this->view->setVar('year', $vn_year); if ($va_periods[$vn_period]["displayAllYears"] == 1) { $this->ops_date_range = $va_periods[$vn_period]["start"] . " to " . $va_periods[$vn_period]["end"]; } else { $this->ops_date_range = $vn_year; } JavascriptLoadManager::register('maps'); }
/** * Search handler (returns search form and results, if any) * Most logic is contained in the BaseSearchController->Search() method; all you usually * need to do here is instantiate a new subject-appropriate subclass of BaseSearch * (eg. ObjectSearch for objects, EntitySearch for entities) and pass it to BaseSearchController->Search() */ public function Index($pa_options = null) { if (!is_array($pa_options)) { $pa_options = array(); } $pa_form_codes = caGetAvailableAdvancedSearchFormCodes($this->ops_tablename); $ps_form = $this->_getFormName(); $va_form_info = caGetSearchExpressionFromAdvancedSearchForm($_REQUEST); $is_restricted = $_POST['access']; if (!($ps_search = $va_form_info['expression'])) { $ps_search = $this->opo_result_context->getSearchExpression(); } else { $this->opo_result_context->isNewSearch(true); $this->opo_result_context->setParameter('form_data', $va_form_info['form_data']); } $this->opo_result_context->setSearchExpression($ps_search); $this->opo_result_context->saveContext(true); return parent::Index($this->opo_browse, array_merge($pa_options, array('view' => 'Search/ca_objects_search_advanced_html.php', 'vars' => array('form' => $ps_form, 'form_codes' => $pa_form_codes, 'is_restricted' => $is_restricted)))); }