本文整理汇总了PHP中ResultContext::getLastFind方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext::getLastFind方法的具体用法?PHP ResultContext::getLastFind怎么用?PHP ResultContext::getLastFind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultContext
的用法示例。
在下文中一共展示了ResultContext::getLastFind方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例2: __construct
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'));
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', $va_access_values);
$this->opo_result_context = new ResultContext($po_request, 'ca_objects', ResultContext::getLastFind($po_request, 'ca_objects'));
JavascriptLoadManager::register('cycle');
}
示例3: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
JavascriptLoadManager::register('bundleListEditorUI');
JavascriptLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例4: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
if (!$po_request->user->canDoAction('can_batch_import_metadata')) {
$po_response->setRedirect($po_request->config->get('error_display_url') . '/n/3400?r=' . urlencode($po_request->getFullUrlPath()));
return;
}
AssetLoadManager::register('bundleableEditor');
AssetLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例5: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
// Can user batch import media?
if (!$po_request->user->canDoAction('can_batch_import_media')) {
$po_response->setRedirect($po_request->config->get('error_display_url') . '/n/3410?r=' . urlencode($po_request->getFullUrlPath()));
return;
}
AssetLoadManager::register('bundleableEditor');
AssetLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
$this->opa_importable_tables = array(caGetTableDisplayName('ca_objects') => 'ca_objects', caGetTableDisplayName('ca_entities') => 'ca_entities', caGetTableDisplayName('ca_places') => 'ca_places', caGetTableDisplayName('ca_collections') => 'ca_collections', caGetTableDisplayName('ca_occurrences') => 'ca_occurrences', caGetTableDisplayName('ca_storage_locations') => 'ca_storage_locations', caGetTableDisplayName('ca_object_lots') => 'ca_object_lots', caGetTableDisplayName('ca_movements') => 'ca_movements', caGetTableDisplayName('ca_loans') => 'ca_loans');
foreach ($this->opa_importable_tables as $vs_key => $vs_table) {
if ($this->getRequest()->getAppConfig()->get($vs_table . '_disable')) {
unset($this->opa_importable_tables[$vs_key]);
}
}
}
示例6: Show
//.........这里部分代码省略.........
$va_sort = array('sort' => $vs_sort);
}
$qr_hits = $this->opo_browse->getResults($va_sort);
$vn_num_pages = ceil($qr_hits->numHits() / $vn_items_per_page);
$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);
}
}
示例7: ucfirst
<p><label for="keyword">by keyword</label><input type="text" name="search" value="<?php
print $vs_search ? $vs_search : '';
?>
" onclick='jQuery("#quickSearch").select();' id="quickSearch" autocomplete="off" /><input type="hidden" name="searchtype" value="keyword" /><input class="button" type="image" src="<?php
print $this->request->getThemeUrlPath();
?>
/graphics/city/search-button.png" alt="search" /></p>
</fieldset>
</form>
</div>
<div id="resultBox">
<?php
}
if ($vo_result) {
$vn_num_hits = $this->getVar('num_hits');
if (ResultContext::getLastFind($this->request, 'ca_objects') != 'basic_browse') {
print '<div style="margin-top:2px; clear:left;">' . _t('Your %1 for <b>' . ucfirst($vo_result_context->getSearchExpression()) . '</b> returned %2 %3.', $this->getVar('mode_type_singular'), $vn_num_hits, $vn_num_hits == 1 ? _t('result') : _t('results')) . "</div>";
} else {
print '<div style="margin-top:2px; clear:left;">' . _t('Your %1 returned %2 %3.', $this->getVar('mode_type_singular'), $vn_num_hits, $vn_num_hits == 1 ? _t('result') : _t('results')) . "</div>";
}
if ($this->getVar('num_pages') > 1) {
print $this->render('Results/paging_controls_html.php');
} else {
print "<div class='divide'></div>";
}
if (!$vn_collection_search) {
if ($vo_result->numHits() > 0) {
?>
<a href='#' id='showRefine' onclick='jQuery("#searchRefineBox").slideDown(250); jQuery("#showRefine").hide(); jQuery("#searchOptionsBox").slideUp(250); jQuery("#showOptions").show(); return false;'><?php
print _t("Filter Search");
?>
示例8: ResultContext
*
* This source code is free and modifiable under the terms of
* GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
* the "license.txt" file for details, or visit the CollectiveAccess web site at
* http://www.CollectiveAccess.org
*
* ----------------------------------------------------------------------
*/
$vo_result = $this->getVar('result');
$vo_result_context = $this->getVar('result_context');
?>
<div id="resultBox">
<?php
if ($vo_result) {
$o_result_context = new ResultContext($this->request, 'ca_objects', 'basic_search');
$vs_search = ResultContext::getLastFind($this->request, 'ca_objects') == 'basic_browse' ? '' : $o_result_context->getSearchExpression();
?>
<div id="resultsSearchForm"><form name="artwork_Search" action="<?php
print caNavUrl($this->request, '', 'Search', 'Index');
?>
" method="get">
<input type="text" name="search" value="<?php
print $vs_search ? $vs_search : '';
?>
" autocomplete="off"/> <a href="#" name="searchButtonSubmit" onclick="document.forms.artwork_Search.submit(); return false;">Search</a>
<input type="hidden" name="target" value="ca_objects" />
<input type="hidden" name="view" value="full" />
</form></div><!-- end resultsSearchForm -->
<div id="pageHeadingResultsPage"><img src='<?php
print $this->request->getThemeUrlPath();
示例9: __call
/**
*
*/
public function __call($ps_function, $pa_args)
{
AssetLoadManager::register("panel");
AssetLoadManager::register("mediaViewer");
AssetLoadManager::register("carousel");
AssetLoadManager::register("readmore");
AssetLoadManager::register("maps");
$ps_function = strtolower($ps_function);
$ps_id = urldecode($this->request->getActionExtra());
if (!isset($this->opa_detail_types[$ps_function]) || !isset($this->opa_detail_types[$ps_function]['table']) || !($vs_table = $this->opa_detail_types[$ps_function]['table'])) {
// invalid detail type – throw error
die("Invalid detail type");
}
$t_table = $this->opo_datamodel->getInstanceByTableName($vs_table, true);
if (($vb_use_identifiers_in_urls = caUseIdentifiersInUrls()) && substr($ps_id, 0, 3) == "id:") {
$va_tmp = explode(":", $ps_id);
$ps_id = (int) $va_tmp[1];
$vb_use_identifiers_in_urls = false;
}
if (!$t_table->load($vb_use_identifiers_in_urls && $t_table->getProperty('ID_NUMBERING_ID_FIELD') ? $t_table->hasField('deleted') ? array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id, 'deleted' => 0) : array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id) : ($t_table->hasField('deleted') ? array($t_table->primaryKey() => (int) $ps_id, 'deleted' => 0) : array($t_table->primaryKey() => (int) $ps_id)))) {
// invalid id - throw error
die("Invalid id");
}
// Printables
// merge displays with drop-in print templates
//
$va_export_options = caGetAvailablePrintTemplates('summary', array('table' => $t_table->tableName()));
$this->view->setVar('export_formats', $va_export_options);
$va_options = array();
foreach ($va_export_options as $vn_i => $va_format_info) {
$va_options[$va_format_info['name']] = $va_format_info['code'];
}
// Get current display list
$t_display = new ca_bundle_displays();
foreach (caExtractValuesByUserLocale($t_display->getBundleDisplays(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_READ_ACCESS__, 'checkAccess' => caGetUserAccessValues($this->request)))) as $va_display) {
$va_options[$va_display['name']] = "_display_" . $va_display['display_id'];
}
ksort($va_options);
$this->view->setVar('export_format_select', caHTMLSelect('export_format', $va_options, array('class' => 'searchToolsSelect'), array('value' => $this->view->getVar('current_export_format'), 'width' => '150px')));
#
# Enforce access control
#
if (sizeof($this->opa_access_values) && $t_table->hasField('access') && !in_array($t_table->get("access"), $this->opa_access_values)) {
$this->notification->addNotification(_t("This item is not available for view"), "message");
$this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
return;
}
MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . $t_table->getTypeName() . ": " . $t_table->get('preferred_labels') . (($vs_idno = $t_table->get($t_table->getProperty('ID_NUMBERING_ID_FIELD'))) ? " [{$vs_idno}]" : ""));
$vs_type = $t_table->getTypeCode();
$this->view->setVar('detailType', $vs_table);
$this->view->setVar('item', $t_table);
$this->view->setVar('itemType', $vs_type);
caAddPageCSSClasses(array($vs_table, $ps_function, $vs_type));
// Do we need to pull in the multisearch result set?
if (ResultContext::getLastFind($this->request, $vs_table, array('noSubtype' => true)) === 'multisearch') {
$o_context = new ResultContext($this->request, $vs_table, 'multisearch', $ps_function);
$o_context->setAsLastFind();
$o_context->saveContext();
} else {
$o_context = ResultContext::getResultContextForLastFind($this->request, $vs_table);
}
$this->view->setVar('previousID', $vn_previous_id = $o_context->getPreviousID($t_table->getPrimaryKey()));
$this->view->setVar('nextID', $vn_next_id = $o_context->getNextID($t_table->getPrimaryKey()));
$this->view->setVar('previousURL', caDetailUrl($this->request, $vs_table, $vn_previous_id));
$this->view->setVar('nextURL', caDetailUrl($this->request, $vs_table, $vn_next_id));
$this->view->setVar('resultsURL', ResultContext::getResultsUrlForLastFind($this->request, $vs_table));
$va_options = isset($this->opa_detail_types[$ps_function]['options']) && is_array($this->opa_detail_types[$ps_function]['options']) ? $this->opa_detail_types[$ps_function]['options'] : array();
$this->view->setVar('previousLink', $vn_previous_id > 0 ? caDetailLink($this->request, caGetOption('previousLink', $va_options, _t('Previous')), '', $vs_table, $vn_previous_id) : '');
$this->view->setVar('nextLink', $vn_next_id > 0 ? caDetailLink($this->request, caGetOption('nextLink', $va_options, _t('Next')), '', $vs_table, $vn_next_id) : '');
$this->view->setVar('resultsLink', ResultContext::getResultsLinkForLastFind($this->request, $vs_table, caGetOption('resultsLink', $va_options, _t('Back'))));
$this->view->setVar('commentsEnabled', (bool) $va_options['enableComments']);
//
//
//
if (method_exists($t_table, 'getPrimaryRepresentationInstance')) {
if ($pn_representation_id = $this->request->getParameter('representation_id', pInteger)) {
$t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
$t_representation->load($pn_representation_id);
} else {
$t_representation = $t_table->getPrimaryRepresentationInstance(array("checkAccess" => $this->opa_access_values));
}
if ($t_representation) {
$this->view->setVar("t_representation", $t_representation);
$this->view->setVar("representation_id", $t_representation->get("representation_id"));
} else {
$t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
}
$this->view->setVar("representationViewer", caObjectDetailMedia($this->request, $t_table->getPrimaryKey(), $t_representation, $t_table, array("primaryOnly" => caGetOption('representationViewerPrimaryOnly', $va_options, false), "dontShowPlaceholder" => caGetOption('representationViewerDontShowPlaceholder', $va_options, false))));
}
//
// map
//
if (!is_array($va_map_attributes = caGetOption('map_attributes', $va_options, array())) || !sizeof($va_map_attributes)) {
if ($vs_map_attribute = caGetOption('map_attribute', $va_options, false)) {
$va_map_attributes = array($vs_map_attribute);
}
}
//.........这里部分代码省略.........
示例10: getResultsLinkForLastFind
/**
* Returns a Link to the results screen for the last find
*
* @param $po_request - the current request
* @param $pm_table_name_or_num - the name or number of the table to get the last find operation for
* @param $ps_content - the link content
* @param $class - (optional) name of a CSS class to apply to the link
* @param $pa_params - (optional) associative array of parameters to append onto the link URL
* @param $pa_attributes - (optional) associative array of values to use as attributes in the key (keys are attribute names and values are attribute values)
* @return string - an HTML link that will link back to the results for the last find operation
*/
public static function getResultsLinkForLastFind($po_request, $pm_table_name_or_num, $ps_content, $ps_class = null, $pa_params = null, $pa_attributes = null)
{
if (!($vs_table_name = ResultContext::getTableName($pm_table_name_or_num))) {
return null;
}
$vs_last_find = ResultContext::getLastFind($po_request, $pm_table_name_or_num);
$va_tmp = explode('/', $vs_last_find);
$o_find_navigation = Configuration::load(__CA_APP_DIR__ . '/conf/find_navigation.conf');
$va_find_nav = $o_find_navigation->getAssoc($vs_table_name);
$va_nav = $va_find_nav[$va_tmp[0]];
if (!$va_nav) {
return false;
}
if (__CA_APP_TYPE__ == 'PAWTUCKET') {
// Pawtucket-specific navigation rewriting
if (!(require_once __CA_APP_DIR__ . "/controllers/" . (trim($va_nav['module_path']) ? trim($va_nav['module_path']) . "/" : "") . $va_nav['controller'] . "Controller.php")) {
return false;
}
$vs_controller_class = $va_nav['controller'] . "Controller";
$va_nav = call_user_func_array("{$vs_controller_class}::" . $va_nav['action'], array($po_request, $vs_table_name));
$o_storage = ResultContext::_persistentStorageInstance($po_request);
if (!($vs_action = $o_storage->getVar('result_last_context_' . $vs_table_name . '_action'))) {
$vs_action = $va_nav['action'];
}
} else {
$vs_action = $va_nav['action'];
}
$va_params = array();
if (is_array($va_nav['params'])) {
$o_context = new ResultContext($po_request, $pm_table_name_or_num, $va_tmp[0], isset($va_tmp[1]) ? $va_tmp[1] : null);
foreach ($va_nav['params'] as $vs_param) {
if (!($vs_param = trim($vs_param))) {
continue;
}
if (!trim($va_params[$vs_param] = $po_request->getParameter($vs_param, pString))) {
$va_params[$vs_param] = trim($o_context->getParameter($vs_param));
}
}
if (!is_array($pa_params)) {
$pa_params = array();
}
$pa_params = array_merge($pa_params, $va_params);
}
return caNavLink($po_request, $ps_content, $ps_class, trim($va_nav['module_path']), trim($va_nav['controller']), trim($vs_action), $pa_params, $pa_attributes);
}
示例11: __call
/**
*
*/
public function __call($ps_function, $pa_args)
{
$o_config = caGetBrowseConfig();
$o_search_config = caGetSearchConfig();
$pa_options = array_shift($pa_args);
$this->view->setVar("config", $o_config);
$ps_function = strtolower($ps_function);
$ps_type = $this->request->getActionExtra();
$this->view->setVar("browse_type", $ps_function);
if (!($va_browse_info = caGetInfoForBrowseType($ps_function))) {
// invalid browse type – throw error
die("Invalid browse type {$ps_function}");
}
$vs_class = $va_browse_info['table'];
$va_types = caGetOption('restrictToTypes', $va_browse_info, array(), array('castTo' => 'array'));
$vb_is_advanced = (bool) $this->request->getParameter('_advanced', pInteger) || strpos(ResultContext::getLastFind($this->request, $vs_class), 'advanced') !== false;
$vs_find_type = $vb_is_advanced ? $this->ops_find_type . '_advanced' : $this->ops_find_type;
$this->opo_result_context = new ResultContext($this->request, $va_browse_info['table'], $vs_find_type, $ps_function);
$this->opo_result_context->setAsLastFind(true);
MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search %1", $va_browse_info["displayName"]) . ": " . $this->opo_result_context->getSearchExpression());
if ($vb_is_advanced) {
$this->opo_result_context->setSearchExpression(caGetQueryStringForHTMLFormInput($this->opo_result_context, array('matchOnStem' => $o_search_config->get('matchOnStem'))));
}
$this->view->setVar('browseInfo', $va_browse_info);
$this->view->setVar('paging', in_array(strtolower($va_browse_info['paging']), array('continuous', 'nextprevious', 'letter')) ? strtolower($va_browse_info['paging']) : 'continuous');
$this->view->setVar('options', caGetOption('options', $va_browse_info, array(), array('castTo' => 'array')));
$ps_view = $this->request->getParameter('view', pString);
$va_views = caGetOption('views', $va_browse_info, array(), array('castTo' => 'array'));
if (!is_array($va_views) || sizeof($va_views) == 0) {
$va_views = array('list' => array(), 'images' => array(), 'timeline' => array(), 'map' => array(), 'timelineData' => array(), 'pdf' => array());
} else {
$va_views['pdf'] = array();
$va_views['timelineData'] = array();
}
if (!in_array($ps_view, array_keys($va_views))) {
$ps_view = array_shift(array_keys($va_views));
}
$vs_format = $ps_view == 'timelineData' ? 'json' : 'html';
caAddPageCSSClasses(array($vs_class, $ps_function));
$this->view->setVar('isNav', (bool) $this->request->getParameter('isNav', pInteger));
// flag for browses that originate from nav bar
$t_instance = $this->getAppDatamodel()->getInstanceByTableName($vs_class, true);
$vn_type_id = $t_instance->getTypeIDForCode($ps_type);
$this->view->setVar('t_instance', $t_instance);
$this->view->setVar('table', $va_browse_info['table']);
$this->view->setVar('primaryKey', $t_instance->primaryKey());
$this->view->setVar('browse', $o_browse = caGetBrowseInstance($vs_class));
$this->view->setVar('views', caGetOption('views', $va_browse_info, array(), array('castTo' => 'array')));
$this->view->setVar('view', $ps_view);
$this->view->setVar('viewIcons', $o_config->getAssoc("views"));
//
// Load existing browse if key is specified
//
if ($ps_cache_key = $this->request->getParameter('key', pString)) {
$o_browse->reload($ps_cache_key);
}
if (is_array($va_types) && sizeof($va_types)) {
$o_browse->setTypeRestrictions($va_types);
}
//
// Clear criteria if required
//
if ($vs_remove_criterion = $this->request->getParameter('removeCriterion', pString)) {
$o_browse->removeCriteria($vs_remove_criterion, array($this->request->getParameter('removeID', pString)));
}
if ((bool) $this->request->getParameter('clear', pInteger)) {
// Clear all refine critera but *not* underlying _search criterion
$va_criteria = $o_browse->getCriteria();
foreach ($va_criteria as $vs_criterion => $va_criterion_info) {
if ($vs_criterion == '_search') {
continue;
}
$o_browse->removeCriteria($vs_criterion, array_keys($va_criterion_info));
}
}
if ($this->request->getParameter('getFacet', pInteger)) {
$vs_facet = $this->request->getParameter('facet', pString);
$this->view->setVar('facet_name', $vs_facet);
$this->view->setVar('key', $o_browse->getBrowseID());
$va_facet_info = $o_browse->getInfoForFacet($vs_facet);
$this->view->setVar('facet_info', $va_facet_info);
# --- pull in different views based on format for facet - alphabetical, list, hierarchy
switch ($va_facet_info["group_mode"]) {
case "alphabetical":
case "list":
default:
$this->view->setVar('facet_content', $o_browse->getFacetContent($vs_facet, array("checkAccess" => $this->opa_access_values)));
$this->render("Browse/list_facet_html.php");
break;
case "hierarchical":
$this->render("Browse/hierarchy_facet_html.php");
break;
}
return;
}
//
// Add criteria and execute
//.........这里部分代码省略.........
示例12: getResultsLinkForLastFind
/**
* Returns a Link to the results screen for the last find
*
* @param $po_request - the current request
* @param $pm_table_name_or_num - the name or number of the table to get the last find operation for
* @param $ps_content - the link content
* @param $class - (optional) name of a CSS class to apply to the link
* @param $pa_params - (optional) associative array of parameters to append onto the link URL
* @param $pa_attributes - (optional) associative array of values to use as attributes in the key (keys are attribute names and values are attribute values)
* @return string - an HTML link that will link back to the results for the last find operation
*/
public static function getResultsLinkForLastFind($po_request, $pm_table_name_or_num, $ps_content, $ps_class = null, $pa_params = null, $pa_attributes = null)
{
if (!($vs_table_name = ResultContext::getTableName($pm_table_name_or_num))) {
return null;
}
$vs_last_find = ResultContext::getLastFind($po_request, $pm_table_name_or_num);
$o_find_navigation = Configuration::load($po_request->config->get('find_navigation'));
$va_find_nav = $o_find_navigation->getAssoc($vs_table_name);
$va_nav = $va_find_nav[$vs_last_find];
if (!$va_nav) {
return false;
}
$va_params = array();
if (is_array($va_nav['params'])) {
$o_context = new ResultContext($po_request, $pm_table_name_or_num, $vs_last_find);
foreach ($va_nav['params'] as $vs_param) {
if (!($vs_param = trim($vs_param))) {
continue;
}
if (!trim($va_params[$vs_param] = $po_request->getParameter($vs_param, pString))) {
$va_params[$vs_param] = trim($o_context->getParameter($vs_param));
}
}
if (!is_array($pa_params)) {
$pa_params = array();
}
$pa_params = array_merge($pa_params, $va_params);
}
return caNavLink($po_request, $ps_content, $ps_class, trim($va_nav['module_path']), trim($va_nav['controller']), trim($va_nav['action']), $pa_params, $pa_attributes);
}
示例13: is_array
* the "license.txt" file for details, or visit the CollectiveAccess web site at
* http://www.CollectiveAccess.org
*
* ----------------------------------------------------------------------
*/
$va_facets = $this->getVar('available_facets');
$va_facets_with_content = $this->getVar('facets_with_content');
$va_facet_info = $this->getVar('facet_info');
$va_criteria = is_array($this->getVar('criteria')) ? $this->getVar('criteria') : array();
$va_results = $this->getVar('result');
$o_result_context = $this->getVar('result_context');
$vs_browse_target = $this->getVar('target');
$vs_browse_type_code = $o_result_context->getTypeRestriction($vn_has_changed);
if (!$this->request->isAjax()) {
$o_result_context = new ResultContext($this->request, $vs_browse_target, 'basic_browse');
$vs_search = ResultContext::getLastFind($this->request, $vs_browse_target) == 'basic_browse' ? '' : $o_result_context->getSearchExpression();
?>
<div id="resultsSearchForm"><form name="browseSearch" action="<?php
print caNavUrl($this->request, '', 'Search', 'Index');
?>
" method="get">
<input type="text" name="search" value="<?php
print $vs_search ? $vs_search : '';
?>
" autocomplete="off"/> <a href="#" name="searchButtonSubmit" onclick="document.forms.browseSearch.submit(); return false;">Search</a>
<input type="hidden" name="target" value="<?php
print $vs_browse_target;
?>
" />
<input type="hidden" name="view" value="full" />
</form></div><!-- end resultsSearchForm -->