public function Index() { $o_search = new CollectionSearch(); $qr_res = $o_search->search("*", array("sort" => "ca_collections.preferred_labels.name")); $this->view->setVar('results', $qr_res); #$t_collection = new ca_collections(45); #$this->view->setVar('t_item', $t_collection); $this->render('/index_html.php'); }
/** * Given a item_id (request parameter 'id') returns a list of direct children for use in the hierarchy browser * Returned data is JSON format */ public function Get($pa_additional_query_params = null, $pa_options = null) { $ps_query = $this->request->getParameter('term', pString); $pb_exact = $this->request->getParameter('exact', pInteger); $ps_exclude = $this->request->getParameter('exclude', pString); $va_excludes = explode(";", $ps_exclude); $ps_type = $this->request->getParameter('type', pString); $ps_types = $this->request->getParameter('types', pString); $pb_no_subtypes = (bool) $this->request->getParameter('noSubtypes', pInteger); $pb_quickadd = (bool) $this->request->getParameter('quickadd', pInteger); $pb_no_inline = (bool) $this->request->getParameter('noInline', pInteger); $t_object = new ca_objects(); $t_collection = new ca_collections(); if (!($pn_limit = $this->request->getParameter('limit', pInteger))) { $pn_limit = 100; } $va_items = array(); if (($vn_str_len = mb_strlen($ps_query)) > 0) { if ($vn_str_len < 3) { $pb_exact = true; } // force short strings to be an exact match (using a very short string as a stem would perform badly and return too many matches in most cases) $o_object_search = new ObjectSearch(); $o_collection_search = new CollectionSearch(); $pa_types = array(); if ($ps_types) { $pa_types = explode(';', $ps_types); } else { if ($ps_type) { $pa_types = array($ps_type); } } // Get type_ids $vs_type_query = ''; $va_ids = array(); if (sizeof($pa_types)) { $va_types = $this->opo_item_instance->getTypeList(); $va_types_proc = array(); foreach ($va_types as $vn_type_id => $va_type) { $va_types_proc[$vn_type_id] = $va_types_proc[$va_type['idno']] = $vn_type_id; } foreach ($pa_types as $ps_type) { if (isset($va_types_proc[$ps_type])) { $va_ids[$va_types_proc[$ps_type]] = true; } } $va_ids = array_keys($va_ids); if (sizeof($va_ids) > 0) { $t_list = new ca_lists(); if (!$pb_no_subtypes) { foreach ($va_ids as $vn_id) { $va_children = $t_list->getItemsForList($this->opo_item_instance->getTypeListCode(), array('item_id' => $vn_id, 'idsOnly' => true)); $va_ids = array_merge($va_ids, $va_children); } $va_ids = array_flip(array_flip($va_ids)); } $o_object_search->addResultFilter($this->opo_item_instance->tableName() . '.' . $this->opo_item_instance->getTypeFieldName(), 'IN', join(",", $va_ids)); } } else { $va_ids = null; } // add any additional search elements $vs_additional_query_params = ''; if (is_array($pa_additional_query_params) && sizeof($pa_additional_query_params)) { $vs_additional_query_params = ' AND (' . join(' AND ', $pa_additional_query_params) . ')'; } // add filters if (isset($pa_options['filters']) && is_array($pa_options['filters']) && sizeof($pa_options['filters'])) { foreach ($pa_options['filters'] as $va_filter) { $o_object_search->addResultFilter($va_filter[0], $va_filter[1], $va_filter[2]); } } // do search $va_opts = array('exclude' => $va_excludes, 'limit' => $pn_limit); if ($vn_restrict_to_hier_id = $this->request->getParameter('currentHierarchyOnly', pInteger)) { $o_object_search->addResultFilter('ca_objects.hier_object_id', '=', (int) $vn_restrict_to_hier_id); } $qr_res = $o_object_search->search('(' . $ps_query . (intval($pb_exact) ? '' : '*') . ')' . $vs_type_query . $vs_additional_query_params, array('search_source' => 'Lookup', 'no_cache' => false, 'sort' => 'ca_objects.idno_sort')); $qr_res->setOption('prefetch', $pn_limit); $qr_res->setOption('dontPrefetchAttributes', true); if (is_array($va_objects = caProcessRelationshipLookupLabel($qr_res, new ca_objects(), $va_opts))) { foreach ($va_objects as $vn_object_id => $va_object) { $va_objects[$vn_object_id]['id'] = 'ca_objects-' . $va_objects[$vn_object_id]['id']; } } //if ($vs_hier_fld && ($vn_restrict_to_hier_id = $this->request->getParameter('currentHierarchyOnly', pInteger))) { //$o_collection_search->addResultFilter('ca_collections.hier_collection_id', '=', (int)$vn_restrict_to_hier_id); // How to restrict objects? //} $qr_res = $o_collection_search->search('(' . $ps_query . (intval($pb_exact) ? '' : '*') . ')' . $vs_type_query . $vs_additional_query_params, array('search_source' => 'Lookup', 'no_cache' => false, 'sort' => 'ca_collections.idno_sort')); $qr_res->setOption('prefetch', $pn_limit); $qr_res->setOption('dontPrefetchAttributes', true); if (is_array($va_collections = caProcessRelationshipLookupLabel($qr_res, new ca_collections(), $va_opts))) { foreach ($va_collections as $vn_collection_id => $va_collection) { $va_collections[$vn_collection_id]['id'] = 'ca_collections-' . $va_collections[$vn_collection_id]['id']; } } } if (!is_array($va_objects)) { $va_objects = array(); } if (!is_array($va_collections)) { $va_collections = array(); } if (!sizeof($va_objects) && !sizeof($va_collections)) { $va_objects[-1] = _t('No matches found for <em>%1</em>', $ps_query); } $this->view->setVar('object_list', $va_objects); $this->view->setVar('collection_list', $va_collections); return $this->render(str_replace(' ', '_', 'ajax_object_collection_list_html.php')); }
$t_object = new ca_objects(); $t_featured = new ca_sets(); # --- get access setting so can check access of objects if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } # --- grab 1 archival showcase collection to feature in side box # -- get the collection type $o_lists = new ca_lists(); $vn_showcase_collection_type_id = $o_lists->getItemIDFromList('collection_types', 'archival_showcase'); $o_collectionSearch = new CollectionSearch(); $o_collectionSearch->addResultFilter("ca_collections.access", "IN", join($va_access_values, ", ")); $o_collectionSearch->addResultFilter("ca_collections.type_id", "=", $vn_showcase_collection_type_id); $o_showcase_collection_results = $o_collectionSearch->search("*"); if ($o_showcase_collection_results->numHits() > 0) { $o_showcase_collection_results->nextHit(); $vn_featured_collection_id = $o_showcase_collection_results->get("ca_collections.collection_id"); $vs_featured_collection_text = strip_tags($o_showcase_collection_results->get("ca_collections.description")); $vs_featured_collection_label = join($o_showcase_collection_results->getDisplayLabels($this->request), "; "); $vs_featured_collection_thumb = ""; # --- get an item from the collection to use it's media as the thumbnail $o_collectionItemSearch = new ObjectSearch(); $o_collectionItemSearch->addResultFilter("ca_collections.collection_id", "=", $o_showcase_collection_results->get("collection_id")); $o_collectionItemSearch->addResultFilter("ca_objects.access", "IN", join($va_access_values, ", ")); $o_collectionItemSearchResults = $o_collectionItemSearch->search("*"); if ($o_collectionItemSearchResults->numHits()) { while ($o_collectionItemSearchResults->nextHit()) { if ($vs_featured_collection_thumb = $o_collectionItemSearchResults->getMediaTag('ca_object_representations.media', 'icon', array('checkAccess' => $va_access_values))) { break;
/** * */ 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'); }
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; } }
<?php require_once __CA_LIB_DIR__ . "/ca/Search/CollectionSearch.php"; # --- get all collections $o_search = new CollectionSearch(); $qr_collections = $o_search->search("ca_collections.access:1", array("sort" => "ca_collection_labels.name")); ?> <div id="content"><div id="content-inner"> <div id="content-area"> <div id="node-19" class="node node-type-page"><div class="node-inner"> <div id="hpTitle">Moving Images</div> <div id="hpText"> We care for approximately 800 moving image collections, which would take more than a year to watch. Of these, 300+ are described online at the collection level. To read about each collection, click on the collection name. <b>Search</b> by entering a word in the Search box. <b>Browse</b> by clicking on one of the terms above: <?php print caNavLink($this->request, _t('Places'), '', '', 'Browse', 'PlaceList', array('target' => 'ca_collections')) . ", " . caNavLink($this->request, _t('Genres'), '', '', 'Browse', 'GenreList', array('target' => 'ca_collections')) . ", " . caNavLink($this->request, _t('Subjects'), '', '', 'Browse', 'SubjectList', array('target' => 'ca_collections')) . ", " . caNavLink($this->request, _t('Decades'), '', '', 'Browse', 'DecadeList', array('target' => 'ca_collections')) . ", " . caNavLink($this->request, _t('People'), '', '', 'Browse', 'PeopleList', array('target' => 'ca_collections')); ?> <br/><br/>Fifty new collections are being described in 2010, thanks to a generous grant from the Council on Library and Information Resources/Andrew W. Mellon Foundation Cataloging Hidden Collections and Archives program. For more information about this project please visit <?php print caNavLink($this->request, _t('here'), '', '', 'Browse', 'HiddenCollectionsList'); ?> . <br/><br/>Item Description: More than 20,000 individual items (film reels and videotapes) are described in our research database, which we are converting to share here. Please check back, or contact the archives for more information. </div> <!--<div id="hpSearch"><form name="hp_search" action="<?php print caNavUrl($this->request, '', 'Search', 'Index'); ?> " method="get"> Search: <input type="text" name="search" value="" autocomplete="off" size="100"/><input type="submit" name="op" id="edit-submit" value="GO" class="form-submit" /><input type="hidden" name="target" value="ca_collections" /> </form></div>-->
<?php require_once __CA_LIB_DIR__ . "/ca/Search/CollectionSearch.php"; # --- get all collections $o_search = new CollectionSearch(); $qr_collections = $o_search->search("ca_collections.access:1", array("sort" => "ca_collection_labels.name", "checkAccess" => array(1))); ?> <div id="browseListBody"><a name="top"></a> <div id="title">Collections</div> <div id="introText"> We care for approximately 800 moving image collections, which would take more than a year to watch. Of these, 300+ are described online at the collection level. To read about each collection, click on the collection name. </div><!-- end introText --> <?php if ($qr_collections->numHits() > 0) { $va_collections_by_letter = array(); $i = 0; while ($qr_collections->nextHit()) { $vs_collection = ""; $vs_letter = ""; $vs_link = ""; $vs_collection = join('; ', $qr_collections->getDisplayLabels($this->request)); $vs_letter = mb_substr($vs_collection, 0, 1); if ($i != 0 && $vs_letter != $vs_last_letter) { $va_collections_by_letter[$vs_last_letter] = $va_temp; $va_temp = array(); } $vs_link = caNavLink($this->request, $vs_collection, '', 'Detail', 'Collection', 'Show', array('collection_id' => $qr_collections->get("collection_id"))); $va_temp[] = $vs_link; $vs_last_letter = $vs_letter; $i++;
<?php require_once __CA_LIB_DIR__ . "/ca/Search/CollectionSearch.php"; require_once __CA_MODELS_DIR__ . "/ca_collections.php"; require_once __CA_MODELS_DIR__ . '/ca_sets.php'; # --- get all collections $o_search = new CollectionSearch(); $qr_collections = $o_search->search("ca_collections.access:1 and ca_collections_curatorial_collections:1644", array("sort" => "ca_collection_labels.name", 'checkAccess' => array(1))); ?> <div id="browseListBody"> <div id="title">Moving Images of Work Life, 1916-1960</div> <div id="introText"> These collections were selected as records of work by men and women in northern New England agricultural environments, traditional and modernizing industries, and early twentieth century urban situations. <br/><br/>What is the purpose of describing these moving images and what is our relationship to the works? <ul> <li>Our purpose is to raise public and scholarly awareness of moving images as important primary source materials for enjoyment and use.</li> <li>We have a custodial relationship, striving to treat the donors and materials with respect and attention--in perpetuity.</li> <li>The benefit of online descriptive records with image surrogates is that many more people will know the collections exist.</li> <li>An important shortcoming of online access is that the small screen diminishes the experience by skipping the clarity and thoughtfulness of discussion during research. This is a largely unrecognized downside to instant search/return/next.</li> <li>Our true goal is to support and encourage a much closer relationship between you and the collections. Interaction with the moving images in their larger context at the archives has enormous benefits.</li> </ul> Funding from the Council on Library and Information Services, <a href="http://www.clir.org/hiddencollections/index.html" target="_blank">Cataloging Hidden Special Collections and Archives program</a>. <br/><br/>Katrina Dixon was the project media cataloger. <br/>Karan Sheldon was the project director. <a href="mailto:karan@oldfilm.org">karan@oldfilm.org</a> <br/><br/><br/> <div class="subTitle">Featured Collections</div> <div id="featuredCollections">