Ejemplo n.º 1
0
 private function _doSearch($ps_type, $ps_search, $ps_sort)
 {
     $va_access_values = caGetUserAccessValues($this->request);
     $vb_no_cache = (bool) $this->request->getParameter('no_cache', pInteger);
     if (!$this->request->user->canDoAction('can_search_' . ($ps_type == 'ca_tour_stops' ? 'ca_tours' : $ps_type))) {
         return '';
     }
     switch ($ps_type) {
         case 'ca_objects':
             $o_object_search = new ObjectSearch();
             return $o_object_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_object_lots':
             $o_object_lots_search = new ObjectLotSearch();
             return $o_object_lots_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_entities':
             $o_entity_search = new EntitySearch();
             return $o_entity_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_places':
             $o_place_search = new PlaceSearch();
             return $o_place_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_occurrences':
             $o_occurrence_search = new OccurrenceSearch();
             return $o_occurrence_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_collections':
             $o_collection_search = new CollectionSearch();
             return $o_collection_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_storage_locations':
             $o_storage_location_search = new StorageLocationSearch();
             return $o_storage_location_search->search($ps_search == '*' ? '(ca_storage_locations.is_enabled:1)' : '(' . $ps_search . ') AND (ca_storage_locations.is_enabled:1)', array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_loans':
             $o_loan_search = new LoanSearch();
             return $o_loan_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_movements':
             $o_movement_search = new MovementSearch();
             return $o_movement_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_tours':
             $o_tour_search = new TourSearch();
             return $o_tour_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         case 'ca_tour_stops':
             $o_tour_stop_search = new TourStopSearch();
             return $o_tour_stop_search->search($ps_search, array('sort' => $ps_sort, 'search_source' => 'Quick', 'limit' => $this->opn_num_results_per_item_type, 'no_cache' => $vb_no_cache, 'checkAccess' => $va_access_values));
             break;
         default:
             return null;
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function secondarySearch()
 {
     $pn_spage = (int) $this->request->getParameter('spage', pInteger);
     $ps_type = $this->request->getParameter('type', pString);
     $this->view->setVar('search_type', $ps_type);
     $va_access_values = caGetUserAccessValues($this->request);
     $ps_search = $this->opo_result_context->getSearchExpression();
     switch ($ps_type) {
         case 'ca_entities':
             $o_search = new EntitySearch();
             $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values));
             break;
         case 'ca_places':
             $o_search = new PlaceSearch();
             $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values));
             break;
         case 'ca_occurrences':
             $o_search = new OccurrenceSearch();
             $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values));
             break;
         case 'ca_collections':
             $o_search = new CollectionSearch();
             $qr_res = $o_search->search($ps_search, array('checkAccess' => $va_access_values));
             break;
         default:
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/' . _t('Invalid secondary search type') . '?r=' . urlencode($this->request->getFullUrlPath()));
             return;
             break;
     }
     $this->view->setVar('secondaryItemsPerPage', $this->opa_items_per_secondary_search_page);
     $this->view->setVar('page_' . $ps_type, $pn_spage);
     if ($pn_spage > 0) {
         $qr_res->seek($pn_spage * $this->opa_items_per_secondary_search_page);
     }
     $this->view->setVar('secondary_search_' . $ps_type, $qr_res);
     $this->render('Results/search_secondary_results/' . $ps_type . '_html.php');
 }
Ejemplo n.º 3
0
        if ($vs_places_for_display) {
            ?>
		<div class="ad_col"><div>
			<span class="listhead caps"><?php 
            print _t("Places");
            ?>
</span>
			<ul><?php 
            print $vs_places_for_display;
            ?>
</ul>
		</div></div><!--end ad_col 2 -->
<?php 
        }
    }
    $o_place_search = new PlaceSearch();
    $qr_places = $o_place_search->search("ca_entities.entity_id: " . $vn_entity_id, array("checkAccess" => $va_access_values));
    #while($qr_places->nextHit()){
    #	print $qr_places->get("ca_place_labels.name");
    #}
    if ($qr_places->numHits()) {
        $o_map = new GeographicMap(355, 225, 'map');
        $va_map_stats = $o_map->mapFrom($qr_places, "georeference", array("request" => $this->request, "checkAccess" => $va_access_values, 'contentTemplate' => "^ca_places.preferred_labels.name"));
        if ($va_map_stats['points'] > 0) {
            print '<div class="ad_gmap">' . $o_map->render('HTML', array('delimiter' => "<br/>")) . '</div><!-- end ad_gmap -->';
        }
    }
    ?>
<div class="clear padded"></div>
<div id="ad_comments">
<?php