本文整理汇总了PHP中ResultContext::getIndexInResultList方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::getIndexInResultList方法的具体用法?PHP ResultContext::getIndexInResultList怎么用?PHP ResultContext::getIndexInResultList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::getIndexInResultList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Show
//.........这里部分代码省略.........
$qr_hits->seek(($vn_p - 1) * $vn_items_per_page);
} else {
$vn_num_pages = 0;
}
$this->view->setVar('browse_results', $qr_hits);
$this->view->setVar('num_pages', (int) $vn_num_pages);
$this->view->setVar('items_per_page', (int) $vn_items_per_page);
$this->view->setVar('opo_browse', $this->opo_browse);
$this->view->setVar('sorts', $this->opa_sorts);
// supported sorts for the object browse
// browse criteria in an easy-to-display format
$va_browse_criteria = array();
foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
$va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
$va_criteria_list = array();
foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
$va_criteria_list[] = $vs_criteria_label;
}
$va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
}
$this->view->setVar('browse_criteria', $va_browse_criteria);
} else {
// not configured for browse
$this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', null);
$this->view->setVar('show_browse', false);
}
}
$this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id', $vn_item_id);
# Next and previous navigation
$opo_result_context = new ResultContext($this->request, $this->ops_tablename, ResultContext::getLastFind($this->request, $this->ops_tablename));
$this->view->setVar('next_id', $opo_result_context->getNextID($vn_item_id));
$this->view->setVar('previous_id', $opo_result_context->getPreviousID($vn_item_id));
# Is the item we're show details for in the result set?
$this->view->setVar('is_in_result_list', $opo_result_context->getIndexInResultList($vn_item_id) != '?');
# Item instance and id
$this->view->setVar('t_item', $t_item);
$this->view->setVar($t_item->getPrimaryKey(), $vn_item_id);
# Item - preferred
$this->view->setVar('label', $t_item->getLabelForDisplay());
# Item - nonpreferred
$this->view->setVar('nonpreferred_labels', caExtractValuesByUserLocale($t_item->getNonPreferredLabels()));
# Item timestamps (creation and last change)
if ($va_entry_info = $t_item->getCreationTimestamp()) {
$this->view->setVar('date_of_entry', date('m/d/Y', $va_entry_info['timestamp']));
}
if ($va_last_change_info = $t_item->getLastChangeTimestamp()) {
$this->view->setVar('date_of_last_change', date('m/d/Y', $va_last_change_info['timestamp']));
}
# Media representations to display (objects only)
if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
// check rep access
$this->view->setVar('t_primary_rep', $t_primary_rep);
$va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
unset($va_display_info['display_version']);
$va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
unset($va_display_info['poster_frame_version']);
$this->view->setVar('primary_rep_display_options', $va_rep_display_info);
}
}
}
#
# User-generated comments, tags and ratings
#
示例2: Detail
function Detail()
{
JavascriptLoadManager::register('panel');
if ($this->request->config->get("dont_enforce_access_settings")) {
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
$va_jumpToList = $this->ops_jumpToList;
$this->view->setVar('jumpToList', $va_jumpToList);
$va_periods = $this->ops_periods;
$this->view->setVar('periods', $va_periods);
$vn_year = $this->request->getParameter('year', pInteger);
$vn_period = $this->request->getParameter('period', pInteger);
if (!$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;
}
}
}
}
$this->view->setVar('period', $vn_period);
if (!$vn_year) {
$vn_year = $va_periods[$vn_period]["start"];
}
$this->view->setVar('year', $vn_year);
$vn_y = "";
if ($va_periods[$vn_period]["displayAllYears"] == 1) {
$vn_y = $va_periods[$vn_period]["start"] . " to " . $va_periods[$vn_period]["end"];
} else {
$vn_y = $vn_year;
}
$o_search = new OccurrenceSearch();
$t_list = new ca_lists();
$vn_chronology_type_id = $t_list->getItemIDFromList('occurrence_types', 'chronology');
$vn_exhibition_type_id = $t_list->getItemIDFromList('occurrence_types', 'exhibition');
$vn_bibliography_type_id = $t_list->getItemIDFromList('occurrence_types', 'bibliography');
$vn_artwork_type_id = $t_list->getItemIDFromList('object_types', 'artwork');
$vn_chron_images_type_id = $t_list->getItemIDFromList('object_types', 'chronology_image');
$va_years_info = array();
$qr_events = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_chronology_type_id} AND ca_occurrences.date.parsed_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
$va_event_ids = array();
if ($qr_events->numHits() > 0) {
while ($qr_events->nextHit()) {
$va_event_ids[] = $qr_events->get("occurrence_id");
}
}
$opo_result_context = new ResultContext($this->request, "ca_occurrences", "basic_search");
foreach ($va_event_ids as $vn_event_id) {
if ($opo_result_context->getIndexInResultList($vn_event_id) != '?') {
$this->view->setVar("show_back_button", 1);
break;
}
}
$qr_events->seek(0);
$va_years_info["events"] = $qr_events;
$qr_exhibitions = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_exhibition_type_id} AND ca_occurrences.date.parsed_date:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
$va_years_info["exhibitions"] = $qr_exhibitions;
$qr_bibliographies = $o_search->search("ca_occurrences.access:1 AND ca_occurrences.type_id:{$vn_bibliography_type_id} AND ca_occurrences.bib_year_published:\"" . $vn_y . "\"", array("sort" => "ca_occurrences.bib_year_published", "no_cache" => !$this->opb_cache_searches));
$va_years_info["bibliographies"] = $qr_bibliographies;
$o_obj_search = new ObjectSearch();
$qr_artworks = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_artwork_type_id}", array("sort" => "ca_objects.idno_sort", "no_cache" => !$this->opb_cache_searches));
$va_years_info["artworks"] = $qr_artworks;
$qr_chron_images = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_chron_images_type_id}", array("sort" => "ca_objects.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
$va_years_info["chron_images"] = $qr_chron_images;
$this->view->setVar('years_info', $va_years_info);
$this->view->setVar('num_images', $qr_chron_images->numHits());
$va_reps = array();
if ($qr_chron_images->numHits() > 0) {
while ($qr_chron_images->nextHit()) {
$t_image_object = new ca_objects($qr_chron_images->get("object_id"));
# Media representations to display (objects only)
if ($t_primary_rep = $t_image_object->getPrimaryRepresentationInstance()) {
if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
// check rep access
# --- build array of thumbnails on related images for display under main image
$va_temp = array();
$va_temp["representation_id"] = $t_primary_rep->get("representation_id");
$va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
$va_temp["object_id"] = $qr_chron_images->get("object_id");
$va_reps[$qr_chron_images->get("object_id")] = $va_temp;
if (!$vn_display_image_set) {
$vn_display_image_set = 1;
$this->view->setVar("image_object_id", $qr_chron_images->get("object_id"));
$this->view->setVar("image_description", $t_image_object->get("ca_objects.description"));
$this->view->setVar("image_photographer", $t_image_object->get("ca_objects.provenance"));
$this->view->setVar('t_primary_rep', $t_primary_rep);
$va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
unset($va_display_info['display_version']);
$va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
unset($va_display_info['poster_frame_version']);
$this->view->setVar('primary_rep_display_options', $va_rep_display_info);
}
}
}
//.........这里部分代码省略.........