本文整理汇总了PHP中ResultContext::setParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::setParameter方法的具体用法?PHP ResultContext::setParameter怎么用?PHP ResultContext::setParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::setParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ListSets
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');
}
示例2: Index
public function Index()
{
AssetLoadManager::register('bundleableEditor');
$t_comm = new ca_commerce_communications();
$t_user = new ca_users();
$o_result_context = new ResultContext($this->request, 'ca_commerce_communications', 'basic_search_library');
$va_options = array();
$o_db = new Db();
// filtering options
foreach (array('created_on' => 'string', 'search' => 'string', 'user_id' => 'int', 'read_status' => 'string') as $vs_f => $vs_type) {
if (array_key_exists($vs_f, $_REQUEST)) {
$vm_v = $this->request->getParameter($vs_f, pString);
$o_result_context->setParameter('caClientCommunicationList_' . $vs_f, $vm_v);
} else {
$vm_v = $o_result_context->getParameter('caClientCommunicationList_' . $vs_f);
}
switch ($vs_type) {
case 'int':
if (strlen($vm_v)) {
$vm_v = (int) $vm_v;
}
break;
}
if ($vs_f == 'read_status') {
$va_options[$vs_f] = $vm_v;
switch ($vm_v) {
case 'read':
$vs_f = 'readOnly';
$vm_v = true;
break;
case 'unread':
$vs_f = 'unreadOnly';
$vm_v = true;
break;
default:
break;
}
}
if ($vs_f == 'user_id') {
if (!$this->request->getParameter('client_user_id_autocomplete', pString)) {
continue;
}
$o_search = new UserSearch();
$va_labels = caProcessRelationshipLookupLabel($o_search->search("ca_users.user_id:{$vm_v}"), $t_user, array('stripTags' => true));
if (sizeof($va_labels)) {
$va_label = array_pop($va_labels);
$va_options['_user_id_display'] = $va_label['label'];
}
}
if ($vs_f != 'search') {
$t_comm->set($vs_f, $vm_v);
}
$va_options[$vs_f] = $vm_v;
}
if ($pn_transaction_id = $this->request->getParameter('transaction_id', pInteger)) {
// if set load messages for this transaction
$va_options['transaction_id'] = $pn_transaction_id;
}
$this->view->setVar('t_communication', $t_comm);
$this->view->setVar('filter_options', $va_options);
$this->view->setVar('message_list', $t_comm->getMessages($this->request->getUserID(), $va_options));
//$o_result_context->setResultList($va_order_ids);
$o_result_context->setAsLastFind();
$o_result_context->saveContext();
$this->render('list_communications_html.php');
}
示例3: ResultContext
//$this->setVar('tooltip_idno', $qr_hits->get('idno'));
//TooltipManager::add(
// "#searchThumbnail{$vn_object_id}", $this->render('../Results/ca_objects_result_tooltip_html.php')
//);
$vn_col++;
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>';
示例4: Index
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');
}
示例5: setDetail
//.........这里部分代码省略.........
$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;
}
}