public function Edit($pa_values = null, $pa_options = null) { $o_result_context = new ResultContext($this->request, 'ca_relationship_types', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('type_id', pInteger); $vn_parent_id = $this->request->getParameter('parent_id', pInteger); // If we're creating a new record we'll need to establish the table_num // from the parent (there's always a parent) if (!$vn_id) { $t_parent = new ca_relationship_types($vn_parent_id); if (!$t_parent->getPrimaryKey()) { $this->postError(1230, _t("Invalid parent"), "RelationshipTypeEditorController->Edit()"); return; } $this->request->setParameter('table_num', $t_parent->get('table_num')); } if (!is_array($va_cur_result) || !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all types in the same level as the currently selected type // $t_instance = new ca_relationship_types(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($this->request->getParameter('type_id', pInteger), array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
public function ListForms() { AssetLoadManager::register('tableList'); $t_form = new ca_search_forms(); $this->view->setVar('t_form', $t_form); $this->view->setVar('form_list', $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)), null, null, array())); $o_result_context = new ResultContext($this->request, 'ca_search_forms', 'basic_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList(is_array($va_forms) ? array_keys($va_forms) : array()); $o_result_context->saveContext(); $this->view->setVar('table_list', caFilterTableList($t_form->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST'))); $this->render('search_form_list_html.php'); }
public function ListDisplays() { AssetLoadManager::register('tableList'); $t_display = new ca_bundle_displays(); $this->view->setVar('t_display', $t_display); $this->view->setVar('display_list', $va_displays = caExtractValuesByUserLocale($t_display->getBundleDisplays(array('user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)), null, null, array())); $o_result_context = new ResultContext($this->request, 'ca_bundle_displays', 'basic_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList(is_array($va_displays) ? array_keys($va_displays) : array()); $o_result_context->saveContext(); $this->view->setVar('table_list', caFilterTableList($t_display->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST'))); $this->render('bundle_display_list_html.php'); }
public function Index() { AssetLoadManager::register('tableList'); $vo_dm = Datamodel::load(); $va_elements = ca_metadata_elements::getRootElementsAsList(null, null, true, true); $this->view->setVar('element_list', $va_elements); $this->view->setVar('attribute_types', Attribute::getAttributeTypes()); $o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search'); $o_result_context->setResultList(array_keys($va_elements)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); return $this->render('elements_list_html.php'); }
public function dispatchLoopShutdown() { // // Force output to be sent - we need the client to have the page before // we start flushing progress bar updates // $app = AppController::getInstance(); $req = $app->getRequest(); $resp = $app->getResponse(); $resp->sendResponse(); $resp->clearContent(); // // Do export // if (!$req->isLoggedIn()) { return; } set_time_limit(3600 * 24); // if it takes more than 24 hours we're in trouble $vn_id = $req->getParameter('exporter_id', pInteger); $t_exporter = new ca_data_exporters($vn_id); $vs_file = tempnam(__CA_APP_DIR__ . DIRECTORY_SEPARATOR . 'tmp', 'dataExport'); // we have 3 different sources for batch exports: search/browse result, sets and search expressions (deprecated) // they all operate on different parameters and on different static functions in ca_data_exporters if ($req->getParameter('caIsExportFromSearchOrBrowseResult', pInteger)) { // batch export from search or browse result $vs_find_type = $req->getParameter('find_type', pString); $vo_result_context = new ResultContext($req, $t_exporter->getTargetTableName(), $vs_find_type); $t_instance = $t_exporter->getTargetTableInstance(); $o_result = $t_instance->makeSearchResult($t_instance->tableName(), $vo_result_context->getResultList()); ca_data_exporters::exportRecordsFromSearchResult($t_exporter->get('exporter_code'), $o_result, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } else { if ($vn_set_id = $req->getParameter('set_id', pInteger)) { // batch export from set ca_data_exporters::exportRecordsFromSet($t_exporter->get('exporter_code'), $vn_set_id, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } else { // batch export from search expression (deprecated) $vs_search = $req->getParameter('search', pString); ca_data_exporters::exportRecordsFromSearchExpression($t_exporter->get('exporter_code'), $vs_search, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } } // export done, record it in session for later usage in download/destination action if (filesize($vs_file)) { $o_session = $req->getSession(); $o_session->setVar('export_file', $vs_file); $o_session->setVar('export_content_type', $t_exporter->getContentType()); $o_session->setVar('exporter_id', $t_exporter->getPrimaryKey()); caExportAddDownloadLink($req); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->opa_views = array('list' => _t('list'), 'editable' => _t('editable')); $this->opa_sorts = array_merge(array('_natural' => _t('relevance'), 'ca_list_item_labels.name_singular' => _t('name'), 'ca_list_items.idno_sort' => _t('idno')), $this->opa_sorts); $this->opo_browse = new ListItemBrowse($this->opo_result_context->getParameter('browse_id'), 'providence'); // // We need to set the same "last find" for ca_lists as well as ca_list_items; here we set // it for ca_lists... ca_list_items is taken care of automatically by BaseFindController // because $this->ops_tablename is set to ca_list_items // $o_ca_lists_result_context = new ResultContext($po_request, 'ca_lists', $this->ops_find_type); $o_ca_lists_result_context->setAsLastFind(); $o_ca_lists_result_context->saveContext(); }
public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
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'); }
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)); }
public function Edit() { $o_result_context = new ResultContext($this->request, 'ca_tour_stops', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('stop_id', pInteger); if (is_array($va_cur_result) && !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all items in the same level as the currently selected item // $t_instance = new ca_list_items(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($vn_id, array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
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)); }
/** * 将结果集转为前端的模式 * @param ResultContext $resContext */ function convertResults($resContext) { $ret = array(); $resArr = $resContext->getResArr(); foreach ($resArr as $record) { $item = array(); $record = $record->getRecord(); $item['type'] = $record['type']; $item['node_path'] = $record['node_path']; $item['var_path'] = $record['var_path']; //整理node代码 $node = $record['node']; $node_item = array(); if ($node instanceof Symbol) { $node_start = $node->getValue()->getAttribute('startLine'); $node_end = $node->getValue()->getAttribute('endLine'); } else { $node_start = $node->getAttribute('startLine'); $node_end = $node->getAttribute('endLine'); } $node_item['line'] = $node_start . "|" . $node_end; $node_item['code'] = FileUtils::getCodeByLine($record['node_path'], $node_start, $node_end); $item['node'] = $node_item; //整理var代码 $var = $record['var']; $var_item = array(); if ($var instanceof Symbol) { $var_start = $var->getValue()->getAttribute('startLine'); $var_end = $var->getValue()->getAttribute('endLine'); } elseif (is_string($var)) { $var_start = $node_start; $var_end = $node_end; } else { $var_start = $var->getAttribute('startLine'); $var_end = $var->getAttribute('endLine'); } $var_item['line'] = $var_start . "|" . $var_end; $var_item['code'] = FileUtils::getCodeByLine($record['var_path'], $var_start, $var_end); $item['var'] = $var_item; array_push($ret, $item); } return $ret; }
protected function _initView($pa_options = null) { AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register('sortableUI'); AssetLoadManager::register('bundleListEditorUI'); if ($vn_rc = parent::_initView()) { $t_screen = $this->view->getVar('t_subject'); $this->opn_ui_id = $t_screen->get('ui_id'); $t_ui = new ca_editor_uis($this->opn_ui_id); $va_screens = $t_ui->getScreens(null, array('showAll' => true)); if (is_array($va_screens)) { $o_result_context = new ResultContext($this->request, 'ca_editor_ui_screens', 'basic_search'); $o_result_context->setResultList(array_keys($va_screens)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); } } return $vn_rc; }
/** * */ public function ListUIs() { AssetLoadManager::register('tableList'); $this->checkConfiguration(); $vo_dm = Datamodel::load(); $va_uis = ca_editor_uis::getUIList(null); foreach ($va_uis as $vs_key => $va_ui) { if (!($t_instance = $vo_dm->getInstanceByTableNum($va_ui['editor_type'], true))) { continue; } $va_uis[$vs_key]['editor_type'] = $t_instance->getProperty('NAME_PLURAL'); } $this->view->setVar('editor_ui_list', $va_uis); $o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search'); $o_result_context->setResultList(array_keys($va_uis)); $o_result_context->setAsLastFind(); $o_result_context->saveContext(); $t_ui = new ca_editor_uis(); $this->view->setVar('table_list', caFilterTableList($t_ui->getFieldInfo('editor_type', 'BOUNDS_CHOICE_LIST'))); return $this->render('ui_list_html.php'); }
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)); }
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]); } } }
/** * */ 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); } } $this->view->setVar("map", ""); if (is_array($va_map_attributes) && sizeof($va_map_attributes)) { $o_map = new GeographicMap(($vn_width = caGetOption('map_width', $va_options, false)) ? $vn_width : 285, ($vn_height = caGetOption('map_height', $va_options, false)) ? $vn_height : 200, 'map'); $vn_mapped_count = 0; foreach ($va_map_attributes as $vs_map_attribute) { if ($t_table->get($vs_map_attribute)) { $o_map->mapFrom($t_table, $vs_map_attribute); $vn_mapped_count++; } } if ($vn_mapped_count > 0) { $this->view->setVar("map", $o_map->render('HTML')); } } // // comments, tags, rank // $this->view->setVar('averageRank', $t_table->getAverageRating(true)); $this->view->setVar('numRank', $t_table->getNumRatings(true)); # # User-generated comments, tags and ratings # $va_user_comments = $t_table->getComments(null, true); $va_comments = array(); if (is_array($va_user_comments)) { foreach ($va_user_comments as $va_user_comment) { if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) { # TODO: format date based on locale $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]); # -- get name of commenter if ($va_user_comment["user_id"]) { $t_user = new ca_users($va_user_comment["user_id"]); $va_user_comment["author"] = $t_user->getName(); } elseif ($va_user_comment["name"]) { $va_user_comment["author"] = $va_user_comment["name"]; } $va_comments[] = $va_user_comment; } } } $this->view->setVar('comments', $va_comments); $va_user_tags = $t_table->getTags(null, true); $va_tags = array(); if (is_array($va_user_tags)) { foreach ($va_user_tags as $va_user_tag) { if (!in_array($va_user_tag["tag"], $va_tags)) { $va_tags[] = $va_user_tag["tag"]; } } } $this->view->setVar('tags_array', $va_tags); $this->view->setVar('tags', implode(", ", $va_tags)); $this->view->setVar("itemComments", caDetailItemComments($this->request, $t_table->getPrimaryKey(), $t_table, $va_comments, $va_tags)); // // share link // $this->view->setVar("shareLink", "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, '', 'Detail', 'ShareForm', array("tablename" => $t_table->tableName(), "item_id" => $t_table->getPrimaryKey())) . "\"); return false;'>Share</a>"); // find view // first look for type-specific view if (!$this->viewExists($vs_path = "Details/{$vs_table}_{$vs_type}_html.php")) { // If no type specific view use the default $vs_path = "Details/{$vs_table}_default_html.php"; } switch ($ps_view = $this->request->getParameter('view', pString)) { case 'pdf': $this->_genExport($t_table, $this->request->getParameter("export_format", pString), 'Detail', 'Detail'); break; default: // // Tag substitution // // Views can contain tags in the form {{{tagname}}}. Some tags, such as "itemType" and "detailType" are defined by // the detail controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the // context of the item being detailed. // $va_defined_vars = array_keys($this->view->getAllVars()); // get list defined vars (we don't want to copy over them) $va_tag_list = $this->getTagListForView($vs_path); // get list of tags in view foreach ($va_tag_list as $vs_tag) { if (in_array($vs_tag, $va_defined_vars)) { continue; } if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) { $this->view->setVar($vs_tag, $t_table->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values))); } elseif (strpos($vs_tag, ".") !== false) { $this->view->setVar($vs_tag, $t_table->get($vs_tag, array('checkAccess' => $this->opa_access_values))); } else { $this->view->setVar($vs_tag, "?{$vs_tag}"); } } $this->render($vs_path); break; } }
<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"); ?>
/** * Generates detail detail. Will use a view named according to the following convention: * <table_name>_<type_code>_detail_html.php * * So for example, the detail for objects of type 'artwork' (where 'artwork' is the type code for the artwork object type) * the view would be named "ca_objects_artwork_detail_html.php * * If the type specific view does not exist, then Show() will attemp to use a generic table-wide view name like this: * <table_name>_detail_html.php * * For example: "ca_objects_detail_html.php" * * In general you should always have the table wide views defined. Then you can define type-specific views for your * application on an as-needed basis. */ public function Show($pa_options = null) { JavascriptLoadManager::register('viz'); JavascriptLoadManager::register("ca", "panel"); JavascriptLoadManager::register("jit"); JavascriptLoadManager::register('browsable'); JavascriptLoadManager::register('imageScroller'); JavascriptLoadManager::register('jquery', 'expander'); $va_access_values = caGetUserAccessValues($this->request); $this->view->setVar('access_values', $va_access_values); if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true))) { die("Invalid table name " . $this->ops_tablename . " for detail"); // shouldn't happen } if (!($vn_item_id = $this->request->getParameter($t_item->primaryKey(), pInteger))) { $this->notification->addNotification(_t("Invalid ID"), "message"); $this->response->setRedirect(caNavUrl($this->request, "", "", "", "")); return; } if (!$t_item->load($vn_item_id)) { $this->notification->addNotification(_t("ID does not exist"), "message"); $this->response->setRedirect(caNavUrl($this->request, "", "", "", "")); return; } if ($t_item->hasField('deleted') && $t_item->get('deleted')) { $this->notification->addNotification(_t("ID has been deleted"), "message"); $this->response->setRedirect(caNavUrl($this->request, "", "", "", "")); return; } // Check if item conforms to any configured display type restrictions if (method_exists($t_item, "getTypeID")) { $va_types = caMergeTypeRestrictionLists($t_item, array()); if (is_array($va_types) && sizeof($va_types) && !in_array($t_item->getTypeID(), $va_types)) { $this->notification->addNotification(_t("This item is not viewable"), "message"); $this->response->setRedirect(caNavUrl($this->request, "", "", "", "")); return; } } # # Enforce access control # if (sizeof($va_access_values) && !in_array($t_item->get("access"), $va_access_values)) { $this->notification->addNotification(_t("This item is not available for view"), "message"); $this->response->setRedirect(caNavUrl($this->request, "", "", "", "")); return; } // // In-detail browsing of objects - limited to object linked to the item being displayed // if (($vs_browse_for_table = $this->request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename)) && is_object($this->opo_browse)) { // set browse context for controller $this->setContext($this->opo_browse->getContext()); // // Restrict facets to specific group for refine browse (if set in app.conf config) // if ($vs_facet_group = $this->request->config->get('ca_objects_refine_facet_group')) { $this->opo_browse->setFacetGroup($vs_facet_group); } $t_table = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true); if ($this->request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id') != $vn_item_id) { $this->opo_browse->removeAllCriteria(); } // look for 'authority' facet for current detail table type so we can limit the object browse to the currently displayed item //$vs_limit_facet_name = null; //foreach($this->opo_browse->getInfoForFacets() as $vs_facet_name => $va_facet_info) { // if (($va_facet_info['type'] === 'authority') && ($va_facet_info['table'] === $this->ops_tablename)) { // $vs_limit_facet_name = $vs_facet_name; // break; // } //} $this->opo_browse->addFacetConfiguration($vs_limit_facet_name = '_detail_browse_' . $this->ops_tablename, array('type' => 'authority', 'table' => $this->ops_tablename, 'relationship_table' => 'ca_objects_x_entities', 'restrict_to_types' => array(), 'restrict_to_relationship_types' => array(), 'label_singular' => 'Detail browse by ' . $this->ops_tablename, 'label_plural' => 'Detail browse by ' . $this->ops_tablename, 'group_mode' => 'none', 'indefinite_article' => 'a')); if ($vs_limit_facet_name) { if (($va_configured_type_restrictions = $this->request->config->getList($this->ops_tablename . '_detail_browse_type_restrictions')) && is_array($va_configured_type_restrictions)) { $this->opo_browse->setTypeRestrictions($va_configured_type_restrictions, array('includeChildren' => false)); } $this->opo_browse->addCriteria($vs_limit_facet_name, array($vn_item_id)); $this->opo_browse->execute(array('checkAccess' => $va_access_values)); $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', $this->opo_browse->getBrowseID()); $this->view->setVar('show_browse', true); // // Browse paging // $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages"); if (!$vn_items_per_page) { $vn_items_per_page = 12; } $this->view->setVar('page', ($vn_p = $this->request->getParameter('page', pInteger)) ? $vn_p : 1); $qr_hits = null; if ($this->opo_browse) { $va_sort = array(); if ($vs_sort = $this->request->config->get('sort_browse_within_detail_for_' . $this->ops_tablename)) { $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); } } } # # User-generated comments, tags and ratings # $va_user_comments = $t_item->getComments(null, true); $va_comments = array(); if (is_array($va_user_comments)) { foreach ($va_user_comments as $va_user_comment) { if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) { # TODO: format date based on locale $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]); # -- get name of commenter $t_user = new ca_users($va_user_comment["user_id"]); $va_user_comment["author"] = $t_user->getName(); $va_comments[] = $va_user_comment; } } } $this->view->setVar('comments', $va_comments); $va_user_tags = $t_item->getTags(null, true); $va_tags = array(); if (is_array($va_user_tags)) { foreach ($va_user_tags as $va_user_tag) { if (!in_array($va_user_tag["tag"], $va_tags)) { $va_tags[] = $va_user_tag["tag"]; } } } $this->view->setVar('tags_array', $va_tags); $this->view->setVar('tags', implode(", ", $va_tags)); $this->view->setVar('result_context', $opo_result_context); # -- get average user ranking $this->view->setVar('ranking', $t_item->getAverageRating(null)); // null makes it ignore moderation status # -- get number of user rankings $this->view->setVar('numRankings', $t_item->getNumRatings(null)); // null makes it ignore moderation status # # Miscellaneous useful information # $this->view->setVar('t_relationship_types', new ca_relationship_types()); // relationship types object - used for displaying relationship type of related authority information if (method_exists($t_item, 'getTypeName')) { $this->view->setVar('typename', $t_item->getTypeName()); } // Record view $t_item->registerItemView($this->request->getUserID()); // // Render view // if (isset($pa_options['view']) && $pa_options['view']) { $this->render($pa_options['view']); } else { if ($this->getView()->viewExists($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php')) { $this->render($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php'); } else { $this->render($this->ops_tablename . '_detail_html.php'); } } }
/** * */ public function Info() { $t_set = new ca_sets($vn_set_id = $this->request->getParameter('set_id', pInteger)); $vn_user_id = !(bool) $this->request->config->get('ca_sets_all_users_see_all_sets') ? $this->request->getUserID() : null; $va_set_stats = array('mine' => caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $this->request->getUserID(), 'access' => __CA_SET_EDIT_ACCESS__)), null, null, array())); if ($this->request->user->canDoAction('is_administrator') || $this->request->user->canDoAction('can_administrate_sets')) { $va_set_stats['user'] = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'allUsers' => true)), null, null, array()); $va_set_stats['public'] = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'publicUsers' => true)), null, null, array()); } $o_result_context = new ResultContext($this->request, 'ca_sets', 'basic_search'); $pn_mode = (int) $o_result_context->getParameter('set_display_mode'); $this->view->setVar('mode', $pn_mode); $this->view->setVar('sets', $va_set_stats); return $this->render('widget_set_info_html.php', true); }
$t_collection = $this->getVar('t_item'); $vn_collection_id = $t_collection->getPrimaryKey(); $vs_title = $this->getVar('label'); $va_access_values = $this->getVar('access_values'); if (!$this->request->isAjax()) { ?> <div id="detailBody"> <div id="pageNav"> <?php if ($this->getVar('previous_id')) { print caNavLink($this->request, "‹ " . _t("Previous"), '', 'Detail', 'Collection', 'Show', array('collection_id' => $this->getVar('previous_id')), array('id' => 'previous')); } else { print "‹ " . _t("Previous"); } print " "; print ResultContext::getResultsLinkForLastFind($this->request, 'ca_collections', _t("Back"), ''); print " "; if ($this->getVar('next_id') > 0) { print caNavLink($this->request, _t("Next") . " ›", '', 'Detail', 'Collection', 'Show', array('collection_id' => $this->getVar('next_id')), array('id' => 'next')); } else { print _t("Next") . " ›"; } ?> </div><!-- end nav --> <h1><?php print $vs_title; ?> </h1> <?php # --- identifier if ($t_collection->get('idno')) {
/** * 报告漏洞的函数 * @param string $path 出现漏洞的文件路径 * @param Node $node 出现漏洞的node * @param Node $var 出现漏洞的变量node * @param string 漏洞的类型 */ public function report($node_path, $var_path, $node, $var, $type) { // echo "<pre>" ; // echo "有漏洞=====>". $type ."<br/>" ; // echo "漏洞变量:<br/>" ; // print_r($var) ; // echo "漏洞节点:<br/>" ; // print_r($node) ; //获取结果集上下文 $resultContext = ResultContext::getInstance(); //加入至上下文中 $record = new Result($node_path, $var_path, $type, $node, $var); //如果存在记录则不添加,反之才添加 if ($resultContext->isRecordExists($record)) { return; } else { $resultContext->addResElement($record); } }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * 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
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); } } } } } $this->view->setVar("reps", $va_reps); $this->render('Chronology/year_detail_html.php'); }
print caHTMLSelect('lang', $va_locale_options, array('id' => 'caLocaleSelectorSelect', 'onchange' => 'window.location = \'' . caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), $this->request->getAction(), array('lang' => '')) . '\' + jQuery(\'#caLocaleSelectorSelect\').val();'), array('value' => $g_ui_locale, 'dontConvertAttributeQuotesToEntities' => true)); print "</form>\n"; } ?> </div><!-- end topbar --> <div id="pageArea"> <div id="header"> <?php print caNavLink($this->request, "<img src='" . $this->request->getThemeUrlPath() . "/graphics/" . $this->request->config->get('header_img') . "' border='0'>", "", "", "", ""); ?> <?php // get last search ('basic_search' is the find type used by the SearchController) $o_result_context = new ResultContext($this->request, 'ca_objects', 'basic_search'); $vs_search = $o_result_context->getSearchExpression(); ?> <div id="nav"> <div id="MFinto"> <?php print $this->render('Splash/MF_text_html.php'); ?> </div> <div id="search"><form name="header_search" action="<?php print caNavUrl($this->request, '', 'Search', 'Index'); ?> " method="get">
/** * */ public function __call($ps_function, $pa_args) { $o_config = caGetBrowseConfig(); $o_search_config = caGetSearchConfig(); $pa_options = array_shift($pa_args); $vb_is_advanced = (bool) $this->request->getParameter('_advanced', pInteger); $vs_find_type = $vb_is_advanced ? $this->ops_find_type . '_advanced' : $this->ops_find_type; $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')); $this->opo_result_context = new ResultContext($this->request, $va_browse_info['table'], $vs_find_type); $this->opo_result_context->setAsLastFind(); 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)); } $this->view->setVar('browseInfo', $va_browse_info); $this->view->setVar('options', caGetOption('options', $va_browse_info, array(), array('castTo' => 'array'))); $ps_view = caGetOption('view', $pa_options, $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(); } 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, $ps_view)); 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)) { $o_browse->removeAllCriteria(); } 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 // $vs_search_expression = $this->opo_result_context->getSearchExpression(); if ($vs_facet = $this->request->getParameter('facet', pString)) { $o_browse->addCriteria($vs_facet, array($this->request->getParameter('id', pString))); } else { if ($o_browse->numCriteria() == 0) { $o_browse->addCriteria("_search", array($vs_search_expression . ($o_search_config->get('matchOnStem') && !preg_match('!\\*$!', $vs_search_expression) && preg_match('![\\w]+$!', $vs_search_expression) ? '*' : ''))); } } // // Sorting // $vb_sort_changed = false; $o_block_result_context = null; if (!($ps_sort = $this->request->getParameter("sort", pString))) { // inherit sort setting from multisearch? (used when linking to full results from multisearch result) if ($this->request->getParameter("source", pString) === 'multisearch') { $o_block_result_context = new ResultContext($this->request, $va_browse_info['table'], 'multisearch', $ps_function); if ($ps_sort !== $o_block_result_context->getCurrentSort() && $o_block_result_context->getCurrentSort()) { $ps_sort = $o_block_result_context->getCurrentSort(); $vb_sort_changed = true; } } if (!$ps_sort && !($ps_sort = $this->opo_result_context->getCurrentSort())) { if (is_array($va_sorts = caGetOption('sortBy', $va_browse_info, null))) { $ps_sort = array_shift(array_keys($va_sorts)); $vb_sort_changed = true; } } } else { $vb_sort_changed = true; } if ($vb_sort_changed) { # --- set the default sortDirection if available $va_sort_direction = caGetOption('sortDirection', $va_browse_info, null); if ($ps_sort_direction = $va_sort_direction[$ps_sort]) { $this->opo_result_context->setCurrentSortDirection($ps_sort_direction); } } if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) { if (!($ps_sort_direction = $this->opo_result_context->getCurrentSortDirection())) { $ps_sort_direction = 'asc'; } } $this->opo_result_context->setCurrentSort($ps_sort); $this->opo_result_context->setCurrentSortDirection($ps_sort_direction); $va_sort_by = caGetOption('sortBy', $va_browse_info, null); $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('sortControl', $vs_sort_by_select ? _t('Sort with %1', $vs_sort_by_select) : ''); $this->view->setVar('sort', $ps_sort); $this->view->setVar('sort_direction', $ps_sort_direction); $va_options = array('checkAccess' => $this->opa_access_values); if ($va_restrict_to_fields = caGetOption('restrictSearchToFields', $va_browse_info, null)) { $va_options['restrictSearchToFields'] = $va_restrict_to_fields; } if (caGetOption('dontShowChildren', $va_browse_info, false)) { $o_browse->addResultFilter('ca_objects.parent_id', 'is', 'null'); } $o_browse->execute($va_options); // // Facets // if ($vs_facet_group = caGetOption('facetGroup', $va_browse_info, null)) { $o_browse->setFacetGroup($vs_facet_group); } $va_available_facet_list = caGetOption('availableFacets', $va_browse_info, null); $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($ps_function . '_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 // $qr_res = $o_browse->getResults(array('sort' => $va_sort_by[$ps_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 = $this->opo_result_context->getItemsPerPage())) { $pn_hits_per_block = $o_config->get("defaultHitsPerBlock"); } } $this->opo_result_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)); $this->opo_result_context->setParameter('key', $vs_key); if (($vn_key_start = $vn_start - 500) < 0) { $vn_key_start = 0; } $qr_res->seek($vn_key_start); $this->opo_result_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); $this->opo_result_context->saveContext(); if ($vn_type_id) { if ($this->render("Browse/{$vs_class}_{$vs_type}_{$ps_view}_{$vs_format}.php")) { return; } } switch ($ps_view) { case 'pdf': $this->_genExport($qr_res, $this->request->getParameter("export_format", pString), $vs_search_expression, $vs_search_expression); break; case 'timelineData': $this->view->setVar('view', 'timeline'); $this->render("Browse/browse_results_timelineData_json.php"); break; default: $this->render("Browse/browse_results_html.php"); break; } }
* 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 * * ---------------------------------------------------------------------- */ $t_place = $this->getVar('t_item'); $vn_place_id = $t_place->getPrimaryKey(); $vs_title = $this->getVar('label'); $va_access_values = $this->getVar('access_values'); if (!$this->request->isAjax()) { ?> <div id="detailBody"> <div id="pageNav"> <?php if ($this->getVar('is_in_result_list') && ($vs_back_link = ResultContext::getResultsLinkForLastFind($this->request, 'ca_places', _t("Back"), ''))) { if ($this->getVar('previous_id')) { print caNavLink($this->request, "‹ " . _t("Previous"), '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('previous_id')), array('id' => 'previous')); } else { print "‹ " . _t("Previous"); } print " {$vs_back_link} "; if ($this->getVar('next_id') > 0) { print caNavLink($this->request, _t("Next") . " ›", '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('next_id')), array('id' => 'next')); } else { print _t("Next") . " ›"; } } ?> </div><!-- end nav --> <h2><?php
* 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 * * ---------------------------------------------------------------------- */ $t_place = $this->getVar('t_item'); $vn_place_id = $t_place->getPrimaryKey(); $vs_title = $this->getVar('label'); $t_rel_types = $this->getVar('t_relationship_types'); if (!$this->request->isAjax()) { ?> <div id="detailBody"> <div id="pageNav"> <?php print ResultContext::getResultsLinkForLastFind($this->request, 'ca_places', "<img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_up_grey.gif' width='11' height='10' border='0'> " . _t("BACK"), ''); if ($this->getVar('next_id') || $this->getVar('previous_id')) { print " "; } if ($this->getVar('previous_id')) { print caNavLink($this->request, "<img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_grey_left.gif' width='10' height='10' border='0'> " . _t("PREVIOUS"), '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('previous_id')), array('id' => 'previous')); } if ($this->getVar('next_id') && $this->getVar('previous_id')) { print " | "; } if ($this->getVar('next_id') > 0) { print caNavLink($this->request, _t("NEXT") . " <img src='" . $this->request->getThemeUrlPath() . "/graphics/arrow_grey_right.gif' width='10' height='10' border='0'>", '', 'Detail', 'Place', 'Show', array('place_id' => $this->getVar('next_id')), array('id' => 'next')); } ?> </div><!-- end nav --> <h1><?php
/** * Generates next/previous/back-to-results navigation HTML for bundleable editors * * @param $po_request RequestHTTP The current request * @param $po_instance BaseModel An instance containing the currently edited record * @param $po_result_context ResultContext The current result content * @param $pa_options array An optional array of options. Supported options are: * backText = a string to use as the "back" button text; default is "Results" * * @return string HTML implementing the navigation element */ function caEditorFindResultNavigation($po_request, $po_instance, $po_result_context, $pa_options = null) { $vn_item_id = $po_instance->getPrimaryKey(); $vs_pk = $po_instance->primaryKey(); $vs_table_name = $po_instance->tableName(); if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') { $vs_priv_table_name = 'ca_lists'; } $va_found_ids = $po_result_context->getResultList(); $vn_current_pos = $po_result_context->getIndexInResultList($vn_item_id); $vn_prev_id = $po_result_context->getPreviousID($vn_item_id); $vn_next_id = $po_result_context->getNextID($vn_item_id); if (isset($pa_options['backText']) && $pa_options['backText']) { $vs_back_text = $pa_options['backText']; } else { $vs_back_text = "<span class='resultLink'>" . _t('Results') . "</span>"; } $vs_buf = ''; if (is_array($va_found_ids) && sizeof($va_found_ids)) { if ($vn_prev_id > 0) { if ($po_request->user->canAccess($po_request->getModulePath(), $po_request->getController(), "Edit", array($vs_pk => $vn_prev_id)) && !$po_request->getAppConfig()->get($vs_table_name . '_editor_defaults_to_summary_view')) { $vs_buf .= caNavLink($po_request, '< prev', 'prev', $po_request->getModulePath(), $po_request->getController(), 'Edit' . '/' . $po_request->getActionExtra(), array($vs_pk => $vn_prev_id)) . ' '; } else { $vs_buf .= caNavLink($po_request, '< prev', 'prev', $po_request->getModulePath(), $po_request->getController(), 'Summary', array($vs_pk => $vn_prev_id)) . ' '; } } else { $vs_buf .= '<span class="prev disabled">< prev</span>'; } $vs_buf .= "<span class='resultCount'>" . ResultContext::getResultsLinkForLastFind($po_request, $vs_table_name, $vs_back_text, '') . " (" . $vn_current_pos . "/" . sizeof($va_found_ids) . ")</span>"; if (!$vn_next_id && sizeof($va_found_ids)) { $vn_next_id = $va_found_ids[0]; } if ($vn_next_id > 0) { if ($po_request->user->canAccess($po_request->getModulePath(), $po_request->getController(), "Edit", array($vs_pk => $vn_next_id)) && !$po_request->getAppConfig()->get($vs_table_name . '_editor_defaults_to_summary_view')) { $vs_buf .= ' ' . caNavLink($po_request, '> next', 'next', $po_request->getModulePath(), $po_request->getController(), 'Edit' . '/' . $po_request->getActionExtra(), array($vs_pk => $vn_next_id)); } else { $vs_buf .= ' ' . caNavLink($po_request, '> next', 'next', $po_request->getModulePath(), $po_request->getController(), 'Summary', array($vs_pk => $vn_next_id)); } } else { $vs_buf .= '<span class="next disabled">> next</span>'; } } elseif ($vn_item_id) { $vs_buf .= ResultContext::getResultsLinkForLastFind($po_request, $vs_table_name, $vs_back_text, ''); } return $vs_buf; }
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'); }