<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_sets', '{set_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
* 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 * * ---------------------------------------------------------------------- */ $po_request = $this->getVar('request'); $va_item_list = $this->getVar('item_list'); $vs_table_num = $this->getVar('table_num'); $vs_table_display = $this->getVar('table_display'); $vs_status_display = $this->getVar('status_display'); $vs_widget_id = $this->getVar('widget_id'); $vn_height_px = $this->getVar('height_px'); ?> <div class="dashboardWidgetContentContainer"> <div class="dashboardWidgetHeading"><?php print _t("Showing %1 <span style='font-weight:bold; text-transform:lowercase;'>%2</span> with status <span style='font-weight:bold; text-transform:lowercase;'>\"%3\"</span>", sizeof($va_item_list), $vs_table_display, $vs_status_display); ?> </div> <div class="dashboardWidgetScrollMedium"><ul> <?php foreach ($va_item_list as $vn_id => $va_record) { print "<li><a href=\"" . caEditorUrl($po_request, $vs_table_num, $vn_id) . "\">" . (strlen($va_record["display"]) > 0 ? $va_record["display"] : _t("[BLANK]")) . "</a></li>\n"; } ?> </ul></div> </div>
?> <a href="#" class="caInterstitialEditButton listRelEditButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_INTERSTITIAL_EDIT_BUNDLE__); ?> </a><?php } if (!$vb_read_only && !$vb_dont_show_del) { ?> <a href="#" class="caDeleteItemButton listRelDeleteButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a><?php } ?> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_occurrences', '{occurrence_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"></a> <span id='<?php print $vs_id_prefix; ?> _BundleTemplateDisplay{n}'> <?php print caGetRelationDisplayString($this->request, 'ca_list_items', array(), array('display' => '_display', 'makeLink' => false)); ?> </span> <input type="hidden" name="<?php print $vs_id_prefix;
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_loans', '{loan_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
case 'next_to': document.location = '<?php print caEditorUrl($this->request, $t_subject->tableName(), 0); ?> /type_id/' + type_id + '/parent_id/' + id; break; default: alert("Invalid action!"); break; } } } if (typeof _navigateToNewObjectForm != 'function') { function _navigateToNewObjectForm(type_id, parent_collection_id) { document.location = '<?php print caEditorUrl($this->request, "ca_objects", 0); ?> /type_id/' + type_id + '/collection_id/' + parent_collection_id; } } // Set up "explore" hierarchy browser var o<?php print $vs_id_prefix; ?> ExploreHierarchyBrowser = null; function _init<?php print $vs_id_prefix; ?> ExploreHierarchyBrowser() {
/** * */ private function _getLogDisplayOutput($pa_log, $pa_options = null) { $ps_id = isset($pa_options['id']) && $pa_options['id'] ? $pa_options['id'] : ''; $vs_output = ''; if ($ps_id) { $vs_output .= '<script language="JavaScript" type="text/javascript"> /* <![CDATA[ */ $(document).ready(function(){ $("#' . $ps_id . '").caFormatListTable(); }); /* ]]> */ </script>'; } $vs_output .= '<table ' . ($ps_id ? 'id="' . $ps_id . '"' : '') . ' class="listtable" width="100%" border="0" cellpadding="0" cellspacing="1"> <thead> <tr> <th class="list-header-unsorted"> ' . _t('Date') . ' </th> <th class="list-header-unsorted"> ' . _t('User') . ' </th> <th class="list-header-unsorted"> ' . _t('Subject') . ' </th> <th class="list-header-unsorted"> ' . _t('Changes') . ' </th> </tr> </thead> <tbody>'; if (!sizeof($pa_log)) { $vs_output .= "<tr><td colspan='4'><div class='contentError' align='center'>" . _t('No change log available') . "</div></td></tr>\n"; } else { foreach (array_reverse($pa_log) as $vn_unit_id => $va_log_entries) { if (is_array($va_log_entries) && sizeof($va_log_entries)) { $vs_output .= "\t<tr>"; $vs_output .= "<td>" . $va_log_entries[0]['datetime'] . "</td>"; if (trim($va_log_entries[0]['user_fullname'])) { $vs_output .= "<td>"; if (trim($va_log_entries[0]['user_email'])) { $vs_output .= " <a href='mailto:" . $va_log_entries[0]['user_email'] . "'>" . $va_log_entries[0]['user_fullname'] . "</a>"; } else { $vs_output .= $va_log_entries[0]['user_fullname']; } $vs_output .= "</td>"; } else { $vs_output .= "<td> </td>"; } if (isset($pa_options['request']) && $pa_options['request']) { $vs_output .= "<td><a href='" . caEditorUrl($pa_options['request'], $va_log_entries[0]['subject_table_num'], $va_log_entries[0]['subject_id']) . "'>" . $va_log_entries[0]['subject'] . "</a></td>"; } else { $vs_output .= "<td>" . $va_log_entries[0]['subject'] . "</td>"; } $vs_output .= "<td>"; foreach ($va_log_entries as $va_log_entry) { foreach ($va_log_entry['changes'] as $va_change) { $vs_output .= '<span class="logChangeLabel">' . $va_log_entry['changetype_display'] . ' ' . $va_change['label'] . '</span>: ' . $va_change['description'] . "<br/>\n"; } } $vs_output .= "</div></td>"; $vs_output .= "</tr>\n"; } } } $vs_output .= "</table>\n"; return $vs_output; }
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_places', '{place_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__); ?> </a> </td> </tr> </table> <?php } else { $vn_use_as_root_id = 'null'; if (sizeof($va_settings['restrict_to_lists']) == 1) {
/** * Return HTML form element for editing. * * @param array $pa_element_info An array of information about the metadata element being edited * @param array $pa_options array Options include: * class = the CSS class to apply to all visible form elements [Default=lookupBg] * width = the width of the form element [Default=field width defined in metadata element definition] * height = the height of the form element [Default=field height defined in metadata element definition] * request = the RequestHTTP object for the current request; required for lookups to work [Default is null] * * @return string */ public function htmlFormElement($pa_element_info, $pa_options = null) { $t_instance = self::elementTypeToInstance($this->getType()); $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth')); $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : 'lookupBg'); if ($pa_options['request']) { if ($vs_restrict_to_type = caGetOption('restrictTo' . $this->ops_name_singular . 'TypeIdno', $pa_element_info['settings'], null)) { $va_params = array('max' => 50, 'type' => $vs_restrict_to_type); } else { $va_params = array('max' => 50); } $vs_url = caNavUrl($pa_options['request'], 'lookup', $this->ops_name_singular, 'Get', $va_params); } else { // no lookup is possible return $this->getDisplayValue(); } $va_pieces = caEditorUrl($pa_options['request'], $t_instance->tableName(), 0, true); $va_pieces['controller'] = str_replace('Editor', 'QuickAdd', $va_pieces['controller']); $va_pieces['action'] = 'Form'; $vs_quickadd_url = caNavUrl($pa_options['request'], $va_pieces['module'], $va_pieces['controller'], $va_pieces['action'], array($t_instance->primaryKey() => 0)); $o_view = new View($pa_options['request'], $pa_options['request']->getViewsDirectoryPath() . "/bundles/"); $o_view->setVar('field_name_prefix', "{fieldNamePrefix}{$pa_element_info['element_id']}"); $o_view->setVar('quickadd_url', $vs_quickadd_url); $o_view->setVar('lookup_url', $vs_url); $o_view->setVar('options', $pa_options); $o_view->setVar('settings', $va_settings); $o_view->setVar('element_info', $pa_element_info); $o_view->setVar('class', $vs_class); return $o_view->render('authority_attribute.php'); }
/** * Returns an HTML to edit an item in the appropriate bundle-based editor. If no specified item is specified (eg. no id value is set) * the a link to create a new item of the specfied type is returned. * * @param HTTPRequest $po_request The current request object * @param string $ps_content The displayed content of the link * @param string $ps_classname CSS classname(s) to apply to the link * @param string $ps_table The name or table_num of the edited items table * @param int $pn_id Optional row_id for edited item. If omitted a link will be returned to create a new item record. Note that unless the verifyLink option is set, the link will be returned with the specified id whether or not it actually exists. * @param array $pa_additional_parameters Optional array of parameters to return on the editor url * @param array $pa_attributes Optional array of attributes to set on the link's <a> tag. You can use this to set the id of the link, as well as any other <a> parameter. * @param array $pa_options Optional array of options. Supported options are: * verifyLink - if true and $pn_id is set, then existence of record with specified id is verified before link is returned. If the id does not exist then null is returned. Default is false - no verification performed. */ function caEditorLink($po_request, $ps_content, $ps_classname, $ps_table, $pn_id, $pa_additional_parameters = null, $pa_attributes = null, $pa_options = null) { if (!($vs_url = caEditorUrl($po_request, $ps_table, $pn_id, false, $pa_additional_parameters, $pa_options))) { return null; } $vs_tag = "<a href='" . $vs_url . "'"; if ($ps_classname) { $vs_tag .= " class='{$ps_classname}'"; } if (is_array($pa_attributes)) { foreach ($pa_attributes as $vs_attribute => $vs_value) { $vs_tag .= " {$vs_attribute}='" . htmlspecialchars($vs_value, ENT_QUOTES, 'UTF-8') . "'"; } } $vs_tag .= '>' . $ps_content . '</a>'; return $vs_tag; }
BrowserIsClosed') == 1) { jQuery("#browseToggle").click(); } oHierBrowser.setUpHierarchy(id); } function caCloseBrowser() { if (!stateCookieJar.get('<?php print $vs_table; ?> BrowserIsClosed')) { jQuery("#browseToggle").click(); } } function _navigateToNewForm(type_id) { document.location = '<?php print caEditorUrl($this->request, $vs_table, 0); ?> /type_id/' + type_id + '/parent_id/' + oHierBrowser.getSelectedItemID(); } </script> <!--- END HIERARCHY BROWSER ---> <br /> <?php } } ?> <script type="text/javascript"> function caSaveSearch(form_id, label, field_names) { var vals = {}; jQuery(field_names).each(function(i, field_name) { // process all fields in form
$vn_c = 1; while ($o_children->nextHit()) { if (!($vn_representation_id = (int) $o_children->get('ca_object_representations.representation_id'))) { continue; } $vs_preview_url = $o_children->getMediaUrl('ca_object_representations.media', 'preview'); $vs_preview_path = $o_children->getMediaPath('ca_object_representations.media', 'preview'); $va_preview_info = $o_children->getMediaInfo('ca_object_representations.media', 'preview'); $vs_large_url = $o_children->getMediaUrl('ca_object_representations.media', 'large'); $vs_large_path = $o_children->getMediaPath('ca_object_representations.media', 'large'); $va_large_info = $o_children->getMediaInfo('ca_object_representations.media', 'large'); $vs_page_url = $o_children->getMediaUrl('ca_object_representations.media', 'page'); $vs_page_path = $o_children->getMediaPath('ca_object_representations.media', 'page'); $va_page_info = $o_children->getMediaInfo('ca_object_representations.media', 'page'); $va_pages[] = array('title' => $vs_title = $o_children->get('ca_objects.preferred_labels.name'), 'subject_id' => $vn_subject_id, 'representation_id' => $vn_representation_id, 'thumbnail_url' => $vs_preview_url, 'thumbnail_path' => $vs_preview_path, 'thumbnail_width' => $va_preview_info['WIDTH'], 'thumbnail_height' => $va_preview_info['HEIGHT'], 'thumbnail_mimetype' => $va_preview_info['MIMETYPE'], 'normal_url' => $vs_large_url, 'normal_path' => $vs_large_path, 'normal_width' => $va_large_info['WIDTH'], 'normal_height' => $va_large_info['HEIGHT'], 'normal_mimetype' => $va_large_info['MIMETYPE'], 'large_url' => $vs_page_url, 'large_path' => $vs_page_path, 'large_width' => $va_page_info['WIDTH'], 'large_height' => $va_page_info['HEIGHT'], 'large_mimetype' => $va_page_info['MIMETYPE']); $va_sections[] = array('title' => $vs_title, 'page' => $vn_c, 'subject_id' => $vn_subject_id, 'representation_id' => $vn_representation_id, 'isSelected' => 0, 'editUrl' => caEditorUrl($this->request, $t_subject->tableName(), $vn_subject_id), 'downloadUrl' => caNavUrl($this->request, $va_url['module'], $va_url['controller'], 'DownloadMedia', array($t_subject->primaryKey() => $t_subject->getPrimaryKey(), 'representation_id' => $vn_representation_id, 'value_id' => $vn_value_id, 'version' => 'original'))); $vn_c++; } $vs_book_viewer_content_mode = 'hierarchy_of_representations'; $vb_use_book_reader = true; } else { if ($vb_should_use_book_viewer && $this->getVar('num_multifiles') > 0) { // Create book viewer from single representation with multifiles $vb_use_book_reader = true; $vn_subject_id = $t_subject->getPrimaryKey(); foreach ($t_rep->getFileList(null, 0, null, array('preview', 'large_preview', 'page_preview')) as $vn_id => $va_file) { $va_pages[] = array('subject_id' => $vn_subject_id, 'representation_id' => $vn_representation_id, 'thumbnail_url' => $va_file['preview_url'], 'thumbnail_path' => $va_file['preview_path'], 'thumbnail_width' => $va_file['preview_width'], 'thumbnail_height' => $va_file['preview_height'], 'thumbnail_mimetype' => $va_file['preview_mimetype'], 'normal_url' => $va_file['large_preview_url'], 'normal_path' => $va_file['large_preview_path'], 'normal_width' => $va_file['large_preview_width'], 'normal_height' => $va_file['large_preview_height'], 'normal_mimetype' => $va_file['large_preview_mimetype'], 'large_url' => $va_file['page_preview_url'], 'large_path' => $va_file['page_preview_path'], 'large_width' => $va_file['page_preview_width'], 'large_height' => $va_file['page_preview_height'], 'large_mimetype' => $va_file['page_preview_mimetype']); } $vs_book_viewer_content_mode = 'multifiles'; } }
/** * Generate SIMILE timeline output in specified format * * @param array $pa_viz_settings Array of visualization settings taken from visualization.conf * @param string $ps_format Specifies format to generate output in. Currently only 'HTML' is supported. * @param array $pa_options Array of options to use when rendering output. Supported options are: * width = * height = * request = current request; required for generation of editor links */ public function render($pa_viz_settings, $ps_format = 'HTML', $pa_options = null) { if (!($vo_data = $this->getData())) { return null; } $this->opn_num_items_rendered = 0; $po_request = isset($pa_options['request']) && $pa_options['request'] ? $pa_options['request'] : null; list($vs_width, $vs_height) = $this->_parseDimensions(caGetOption('width', $pa_options, 500), caGetOption('height', $pa_options, 500)); $o_dm = Datamodel::load(); // generate events $va_events = array(); $va_sources = $pa_viz_settings['sources']; $vs_table = $vo_data->tableName(); $vs_pk = $o_dm->getTablePrimaryKeyName($vs_table); $vs_first_date = $vn_first_date = null; $vs_last_date = $vn_last_date = null; $va_dates = array(); while ($vo_data->nextHit()) { foreach ($va_sources as $vs_source_code => $va_source_info) { $vs_start = trim($vo_data->get($va_source_info['data'], array('start_as_iso8601' => true, 'dateFormat' => 'iso8601'))); $vs_end = trim($vo_data->get($va_source_info['data'], array('end_as_iso8601' => true, 'dateFormat' => 'iso8601'))); $vn_start = $vo_data->get($va_source_info['data'], array('startHistoricTimestamp' => true)); $vn_end = $vo_data->get($va_source_info['data'], array('endHistoricTimestamp' => true)); if ($vn_start < 0 || $vn_end < 0) { continue; } // TODO: negative numbers mean "BC" which apparently cannot be plotted if ($vn_end >= 2000000) { $va_iso = caGetISODates(_t("today")); $vs_end = $va_iso['end']; $va_historic = caDateToHistoricTimestamps(_t("today")); $vn_end = $va_historic['end']; } if (!$vs_start || !$vs_end) { continue; } if ($vs_start == _t('undated') || $vs_end == _t('undated')) { continue; } if (is_null($vn_first_date) || $vn_first_date > $vn_start) { $vn_first_date = $vn_start; $vs_first_date = $vs_start; } if (is_null($vn_last_date) || $vn_last_date < $vn_end) { $vn_last_date = $vn_end; $vs_last_date = $vs_end; } $va_dates[] = $vs_start; $va_events[] = array('id' => $vs_table . '_' . ($vn_id = $vo_data->get("{$vs_table}.{$vs_pk}")), 'start' => $vs_start, 'end' => $vs_end, 'isDuration' => (int) $vn_start != (int) $vn_end ? true : false, 'title' => caProcessTemplateForIDs(strip_tags($va_source_info['display']['title_template']), $vs_table, array($vn_id)), 'description' => caProcessTemplateForIDs($va_source_info['display']['description_template'], $vs_table, array($vn_id)), 'link' => $po_request ? caEditorUrl($po_request, $vo_data->tableName(), $vn_id) : null, 'image' => $va_source_info['display']['image'] ? $vo_data->getWithTemplate($va_source_info['display']['image'], array('returnURL' => true)) : null, 'icon' => $va_source_info['display']['icon'] ? $vo_data->getWithTemplate($va_source_info['display']['icon'], array('returnURL' => true)) : null); } } $this->opn_num_items_rendered = sizeof($va_events); // Find median date - timeline will open there (as good a place as any, no?) $vs_default_date = $va_dates[floor((sizeof($va_dates) - 1) / 2)]; // Derive scale for timeline bands $vn_span = $vn_last_date - $vn_first_date; if ($vn_span > 1000) { // millennia $vs_detail_band_scale = " Timeline.DateTime.CENTURY"; $vs_overview_band_scale = " Timeline.DateTime.MILLENNIUM"; } elseif ($vn_span > 100) { // centuries $vs_detail_band_scale = " Timeline.DateTime.DECADE"; $vs_overview_band_scale = " Timeline.DateTime.CENTURY"; } elseif ($vn_span > 10) { // decades $vs_detail_band_scale = " Timeline.DateTime.YEAR"; $vs_overview_band_scale = " Timeline.DateTime.DECADE"; } elseif ($vn_span > 1) { // years $vs_detail_band_scale = " Timeline.DateTime.MONTH"; $vs_overview_band_scale = " Timeline.DateTime.YEAR"; } elseif ($vn_span > 0.1) { // months $vs_detail_band_scale = " Timeline.DateTime.DAY"; $vs_overview_band_scale = " Timeline.DateTime.MONTH"; } else { // days $vs_detail_band_scale = " Timeline.DateTime.HOUR"; $vs_overview_band_scale = " Timeline.DateTime.DAY"; } $va_highlight_spans = array(); $vs_highlight_span = ''; if (isset($pa_options['highlightSpans']) && is_array($pa_options['highlightSpans'])) { foreach ($pa_options['highlightSpans'] as $vs_span_name => $va_span_info) { $va_range = caGetISODates($va_span_info['range']); $vs_span_color = isset($va_span_info['color']) && $va_span_info['color'] ? $va_span_info['color'] : '#FFC080'; $vs_start_label = isset($va_span_info['startLabel']) && $va_span_info['startLabel'] ? $va_span_info['startLabel'] : ''; $vs_end_label = isset($va_span_info['endLabel']) && $va_span_info['endLabel'] ? $va_span_info['endLabel'] : ''; $vs_span_css_class = isset($va_span_info['class']) && $va_span_info['class'] ? $va_span_info['class'] : 't-highlight1'; $va_highlight_spans[] = "new Timeline.SpanHighlightDecorator({\n\t\t\t\t\t\tdateTimeFormat: 'iso8601',\n startDate: '" . $va_range['start'] . "',\n endDate: '" . $va_range['end'] . "',\n color: '{$vs_span_color}', \n opacity: 50,\n startLabel: '{$vs_start_label}', \n endLabel: '{$vs_end_label}',\n cssClass: '{$vs_span_css_class}'\n })"; } $vs_highlight_span = "caTimelineBands[0].decorators = [" . join(",\n", $va_highlight_spans) . "];"; } $vs_buf = "\n\t<div id='caResultTimeline' style='width: {$vs_width}; height: {$vs_height}; border: 1px solid #aaa'></div>\n<script type='text/javascript'>\n\tvar caTimelineEventSource = new Timeline.DefaultEventSource();\n\tvar caTimelineEventJson = {\n\t\t\"dateTimeFormat\": \"iso8601\", \n\t\t\"events\" : " . json_encode($va_events) . "\n\t}; \n\tcaTimelineEventSource.loadJSON(caTimelineEventJson, '');\n\t\n\tvar theme = Timeline.ClassicTheme.create();\n\t\n\tvar caTimelineBands = [\n Timeline.createBandInfo({\n\t\t\teventPainter: Timeline.CompactEventPainter,\n\t\t\teventPainterParams: {\n\t\t\t\ticonLabelGap: 5,\n\t\t\t\tlabelRightMargin: 20,\n\n\t\t\t\ticonWidth: 72,\n\t\t\t\ticonHeight: 72,\n\n\t\t\t\tstackConcurrentPreciseInstantEvents: {\n\t\t\t\t\tlimit: 5,\n\t\t\t\t\tmoreMessageTemplate: '%0 More',\n\t\t\t\t\ticon: null,\n\t\t\t\t\ticonWidth: 72,\n\t\t\t\t\ticonHeight: 72\n\t\t\t\t}\n\t\t\t},\n\t\t\teventSource:\t caTimelineEventSource,\n\t\t\tdate:\t\t\t'{$vs_default_date}',\n\t\t\twidth: '85%', \n\t\t\tintervalUnit: \t{$vs_detail_band_scale}, \n\t\t\tintervalPixels: 100,\n\t\t\ttheme: \t\t\ttheme\n\t}),\n Timeline.createBandInfo({\n \t eventSource:\t caTimelineEventSource,\n \t date:\t\t\t'{$vs_default_date}',\n width: '10%', \n intervalUnit: {$vs_overview_band_scale}, \n intervalPixels: 200,\n layout: \t\t'overview',\n \t theme: \t\t theme\n })\n ];\n\tcaTimelineBands[1].syncWith = 0;\n\tcaTimelineBands[1].highlight = true;\n\t\n\t{$vs_highlight_span}\n\t\n\tvar caTimeline = Timeline.create(document.getElementById('caResultTimeline'), caTimelineBands);\n</script>\t\n"; return $vs_buf; }
$va_tags = $this->getVar('tags_list'); $vs_widget_id = $this->getVar('widget_id'); $vb_unmoderated = 0; ?> <div class="dashboardWidgetContentContainer"> <?php if (sizeof($va_tags) > 0) { print "<div class='dashboardWidgetHeading'>" . _t("Displaying the last %1 %2 tags", $this->getVar("limit"), $this->getVar("tag_type")) . "</div>"; ?> <form id="tagListForm"><input type="hidden" name="mode" value="list"> <div class="dashboardWidgetScrollMedium" style="padding-left:10px;"><ul> <?php foreach ($va_tags as $va_tag_info) { print "<li>" . (!$va_tag_info["moderated_on"] ? "<input type=\"checkbox\" name=\"tag_relation_id[]\" value=\"" . $va_tag_info['relation_id'] . "\"> " : ""); print "<span style='font-size:12px; font-weight:bold;'>" . _t("%1 tagged %2 with \"%3\"", $va_tag_info["fname"] . " " . $va_tag_info["lname"], "<a href='" . caEditorUrl($po_request, $va_tag_info['table_num'], $va_tag_info['row_id']) . "'>" . $va_tag_info["item_tagged"] . "</a>", $va_tag_info["tag"]) . "</span><br/>\n"; print $va_tag_info["created_on"] ? _t("Created on") . ": " . $va_tag_info["created_on"] : ""; print ($va_tag_info["moderated_on"] ? ", " . _t("Approved on") . ": " . date("n/d/y", $va_tag_info["moderated_on"]) : "") . "<br/>"; print "</li>"; if (!$va_tag_info["moderated_on"]) { $vb_unmoderated = 1; } } ?> </ul></div> <?php if ($vb_unmoderated) { ?> <div style="padding-top:10px; text-align:center; padding-right:20px;"> <a href='#' onclick='jQuery("#tagListForm").attr("action", "<?php print caNavUrl($po_request, 'manage', 'Tags', 'Approve');
$va_object_collection_collection_ancestors = $this->getVar('object_collection_collection_ancestors'); $vb_do_objects_x_collections_hierarchy = false; if ($vb_objects_x_collections_hierarchy_enabled && is_array($va_object_collection_collection_ancestors)) { $pa_ancestors = $va_object_collection_collection_ancestors + $pa_ancestors; $vb_do_objects_x_collections_hierarchy = true; } if (is_array($pa_ancestors) && sizeof($pa_ancestors) > 0) { $va_path = array(); foreach ($pa_ancestors as $vn_id => $va_item) { $vs_item_id = $vb_do_objects_x_collections_hierarchy ? $va_item['table'] . '-' . $va_item['item_id'] : $va_item['item_id']; if ($vn_id === '') { $va_path[] = "<a href='#'>" . _t('New %1', $t_subject->getTypeName()) . "</a>"; } else { $vs_label = $va_item['label']; if ($pn_id && $va_item[$t_subject->primaryKey()] && $vs_item_id != $pn_id) { $va_path[] = '<a href="' . caEditorUrl($this->request, $t_subject->tableName(), $vn_id) . '">' . $vs_label . '</a>'; } else { $va_path[] = "<a href='#' onclick='jQuery(\"#{$ps_id_prefix}HierarchyBrowserContainer\").slideDown(250); o{$ps_id_prefix}HierarchyBrowser.setUpHierarchy(\"{$vs_item_id}\"); return false;'>{$vs_label}</a>"; } } } print join(' ➔ ', $va_path); } ?> </div><!-- end hierNav --> </div><!-- end bundleContainer --> <?php if ($pn_id > 0) { ?> <div id="<?php print $ps_id_prefix;
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_collections', '{collection_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
* 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 * * ---------------------------------------------------------------------- */ $po_request = $this->getVar('request'); $va_item_list = $this->getVar('item_list'); $vs_table_num = $this->getVar('table_num'); $vs_table_display = $this->getVar('table_display'); $vs_widget_id = $this->getVar('widget_id'); $vn_height_px = $this->getVar('height_px'); $idno_display = $this->getVar('idno_display'); ?> <div class="dashboardWidgetContentContainer"> <div class="dashboardWidgetHeading"><?php print _t("Showing the last %1 <span style='font-weight:bold; text-transform:lowercase;'>%2</span> created", sizeof($va_item_list), $vs_table_display); ?> </div> <div class="dashboardWidgetScrollMedium"><ul> <?php foreach ($va_item_list as $vn_id => $va_record) { print "<li>" . "<a href=\"" . caEditorUrl($po_request, $vs_table_num, $vn_id) . "\">" . (strlen($va_record["display"]) > 0 ? $va_record["display"] : _t("[BLANK]")) . ($idno_display && strlen($va_record["idno"]) > 0 ? " [" . $va_record["idno"] . "]" : "") . ($idno_display && strlen($va_record["idno_stub"]) > 0 ? " [" . $va_record["idno_stub"] . "]" : "") . "</a> - " . $va_record['datetime'] . "</li>\n"; } ?> </ul></div> </div>
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_entities', '{entity_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
* Copyright 2010 Whirl-i-Gig * * For more information visit http://www.CollectiveAccess.org * * This program is free software; you may redistribute it and/or modify it under * the terms of the provided license as published by Whirl-i-Gig * * CollectiveAccess is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of * 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 * * ---------------------------------------------------------------------- */ $po_request = $this->getVar('request'); $va_instances = $this->getVar('instances'); $va_settings = $this->getVar('settings'); $vs_widget_id = $this->getVar('widget_id'); ?> <div class="dashboardWidgetContentContainer" style="text-align:center; margin-right:20px;"> <?php print "<div><a href='" . caEditorUrl($po_request, "ca_objects", $this->getVar("object_id")) . "'>" . $this->getVar("image") . "</a></div>"; print "<div style='font-weight:bold; font-size:13px; margin-top:3px;'><a href='" . caEditorUrl($po_request, "ca_objects", $this->getVar("object_id")) . "'>" . $this->getVar("label") . "</a></div>"; ?> </div>
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_tour_stops', '{stop_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
public function DuplicateItems() { $t_set = new ca_sets($this->getRequest()->getParameter('set_id', pInteger)); if (!$t_set->getPrimaryKey()) { return; } if ($this->getRequest()->getParameter('setForDupes', pString) == 'current') { $pa_dupe_options = array('addToCurrentSet' => true); } else { $pa_dupe_options = array('addToCurrentSet' => false); } unset($_REQUEST['form_timestamp']); $t_dupe_set = $t_set->duplicateItemsInSet($this->getRequest()->getUserID(), $pa_dupe_options); if (!$t_dupe_set) { $this->notification->addNotification(_t('Could not duplicate items in set: %1', join(';', $t_set->getErrors())), __NOTIFICATION_TYPE_ERROR__); $this->Edit(); return; } $this->notification->addNotification(_t('Records have been successfully duplicated and added to set'), __NOTIFICATION_TYPE_INFO__); $this->opo_response->setRedirect(caEditorUrl($this->getRequest(), 'ca_sets', $t_dupe_set->getPrimaryKey())); return; }
/** * Download (accessible) media for all records in this set */ public function getSetMedia() { set_time_limit(600); // allow a lot of time for this because the sets can be potentially large $o_dm = Datamodel::load(); $t_set = new ca_sets($this->request->getParameter('set_id', pInteger)); if (!$t_set->getPrimaryKey()) { $this->notification->addNotification(_t('No set defined'), __NOTIFICATION_TYPE_ERROR__); $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey())); return false; } $va_record_ids = array_keys($t_set->getItemRowIDs(array('limit' => 100000))); if (!is_array($va_record_ids) || !sizeof($va_record_ids)) { $this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__); $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey())); return false; } $vs_subject_table = $o_dm->getTableName($t_set->get('table_num')); $t_instance = $o_dm->getInstanceByTableName($vs_subject_table); $qr_res = $vs_subject_table::createResultSet($va_record_ids); $qr_res->filterNonPrimaryRepresentations(false); $va_paths = array(); while ($qr_res->nextHit()) { $va_original_paths = $qr_res->getMediaPaths('ca_object_representations.media', 'original'); if (sizeof($va_original_paths) > 0) { $va_paths[$qr_res->get($t_instance->primaryKey())] = array('idno' => $qr_res->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'paths' => $va_original_paths); } } if (sizeof($va_paths) > 0) { $vs_tmp_name = caGetTempFileName('DownloadSetMedia', 'zip'); $o_phar = new PharData($vs_tmp_name, null, null, Phar::ZIP); foreach ($va_paths as $vn_pk => $va_path_info) { $vn_c = 1; foreach ($va_path_info['paths'] as $vs_path) { if (!file_exists($vs_path)) { continue; } $vs_filename = $va_path_info['idno'] ? $va_path_info['idno'] : $vn_pk; $vs_filename .= "_{$vn_c}"; if ($vs_ext = pathinfo($vs_path, PATHINFO_EXTENSION)) { $vs_filename .= ".{$vs_ext}"; } $o_phar->addFile($vs_path, $vs_filename); $vn_c++; } } $o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/'); // send download $vs_set_code = $t_set->get('set_code'); $o_view->setVar('tmp_file', $vs_tmp_name); $o_view->setVar('download_name', 'media_for_' . mb_substr(preg_replace('![^A-Za-z0-9]+!u', '_', $vs_set_code ? $vs_set_code : $t_set->getPrimaryKey()), 0, 20) . '.zip'); $this->response->addContent($o_view->render('ca_sets_download_media.php')); return; } else { $this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__); $this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey())); return; } return $this->Edit(); }
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_storage_locations', '{location_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__); ?> </a> </td> </tr> </table> <?php } else { ?> <div style="float: right;"><a href="#" class="caDeleteItemButton"><?php
<div id="<?php print $vs_id_prefix . $t_item->tableNum() . '_rel'; ?> "> <?php // // Template to generate display for existing items // ?> <textarea class='caItemTemplate' style='display: none;'> <div id="<?php print $vs_id_prefix; ?> Item_{n}" class="labelInfo roundedRel"> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_list_items', '{item_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}">{{label}}</a> ({{relationship_typename}}) <input type="hidden" name="<?php print $vs_id_prefix; ?> _type_id{n}" id="<?php print $vs_id_prefix; ?> _type_id{n}" value="{type_id}"/> <input type="hidden" name="<?php print $vs_id_prefix;
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_movements', '{movement_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
/** * Generate timeline data feed * * @param array $pa_viz_settings Array of visualization settings taken from visualization.conf * @param array $pa_options Array of options to use when rendering output. Supported options are: * NONE */ public function getDataForVisualization($pa_viz_settings, $pa_options = null) { $po_request = caGetOption('request', $pa_options, null); $qr_res = $this->getData(); $vs_table_name = $qr_res->tableName(); $vs_pk = $qr_res->primaryKey(); $va_default_colors = array("#a7797e", "#dc4671", "#ab22b4", "#0650be", "#685dcd", "#6c5ace", "#7f34bd", "#6b95b4", "#56b5bc", "#41b895", "#008f4c", "#d09a24"); $va_default_colors_lighter = array("#c7999e", "#fc6691", "#cb42d4", "#2670de", "#887ded", "#8c7aee", "#9f54dd", "#8bb5d4", "#76d5dc", "#61d8b5", "#20af6c", "#f0ba44"); $va_default_colors_darker = array("#87595e", "#bc2651", "#8b0294", "#06309e", "#483dad", "#4c3aae", "#5f14bd", "#4b7594", "#36959c", "#219875", "#006f2c", "#b07a04"); $va_default_colors_num = count($va_default_colors); $vn_c = 0; while ($qr_res->nextHit()) { foreach ($pa_viz_settings['sources'] as $vs_source_name => $va_source) { $vn_event_num = 1; $vs_dates = $qr_res->get($va_source['data'], array('sortable' => true, 'returnAsArray' => false, 'delimiter' => ';')); $vs_display_date = $qr_res->get($va_source['data']); $va_dates = explode(";", $vs_dates); if ($vs_dates !== "") { $va_date_list = explode("/", $va_dates[0]); if (!$va_date_list[0] || !$va_date_list[1]) { continue; } $va_calendar_dates = caGetDateRangeForCalendar($va_date_list); $vn_row_id = $qr_res->get("{$vs_table_name}.{$vs_pk}"); $data = array("start" => $va_calendar_dates['start_iso'], "end" => $va_calendar_dates['end_iso'], "display_date" => $vs_display_date, "url" => $po_request ? caEditorUrl($po_request, $vs_table_name, $vn_row_id) : "#", "description" => $qr_res->getWithTemplate($va_source['display']['description_template']), "title" => $qr_res->getWithTemplate($va_source['display']['title_template']), "color" => "darkblue", "textColor" => "white"); $data["color"] = $va_default_colors[$vn_c % $va_default_colors_num]; if ($va_calendar_dates["start"]["hours"] === "00" && $va_calendar_dates["end"]["hours"] === "23" && $va_calendar_dates["start"]["minutes"] === "00" && $va_calendar_dates["end"]["minutes"] === "59") { $data["allDay"] = true; } $va_data[] = $data; if (isset($va_source["before"])) { $start_date = new DateTime($va_calendar_dates['start_iso']); $data = array("start" => $start_date->modify($va_source["before"])->format('c'), "end" => $va_calendar_dates['start_iso'], "display_date" => $start_date->format('d-m-Y'), "url" => $po_request ? caEditorUrl($po_request, $vs_table_name, $vn_row_id) : "#", "description" => $qr_res->getWithTemplate($va_source['display_before']['description_template']), "title" => $qr_res->getWithTemplate($va_source['display_before']['title_template']), "color" => "darkblue", "textColor" => "white", "allDay" => true); $data["color"] = $va_default_colors_lighter[$vn_c % $va_default_colors_num]; $va_data[] = $data; } if (isset($va_source["after"])) { $start_date = new DateTime($va_calendar_dates['end_iso']); $data = array("start" => $start_date->modify("+1 days")->setTime(0, 0)->format('c'), "end" => $start_date->modify($va_source["after"])->format('c'), "display_date" => $start_date->format('d-m-Y'), "url" => $po_request ? caEditorUrl($po_request, $vs_table_name, $vn_row_id) : "#", "description" => $qr_res->getWithTemplate($va_source['display_after']['description_template']), "title" => $qr_res->getWithTemplate($va_source['display_after']['title_template']), "color" => "darkblue", "textColor" => "white", "allDay" => true); $data["color"] = $va_default_colors_darker[$vn_c % $va_default_colors_num]; $va_data[] = $data; } } $vn_event_num++; } $vn_c++; if ($vn_c > 2000) { break; } } return json_encode($va_data); }
} ?> <div id="BookReader_<?php print $vn_subject_id . '_' . ($vn_representation_id ? $vn_representation_id : $vn_value_id) . '_' . $vs_display_type; ?> "> <noscript> <p><?php print _t('The BookReader requires JavaScript to be enabled. Please check that your browser supports JavaScript and that it is enabled in the browser settings.'); ?> </p> </noscript> </div> <script type="text/javascript"> <?php $va_url = caEditorUrl($this->request, $t_subject->tableName(), $vn_subject_id, true); if ($vn_representation_id > 0) { // displaying representation ?> var caBookReader = caUI.initBookReader({ containerID: 'BookReader_<?php print $vn_subject_id . '_' . $vn_representation_id . '_' . $vs_display_type; ?> ', docURL: '<?php print caNavUrl($this->request, $va_url['module'], $va_url['controller'], 'GetPageListAsJSON', array($va_url['_pk'] => $vn_subject_id, 'representation_id' => $vn_representation_id, 'content_mode' => $vs_content_mode, 'download' => 1)); ?> /data/documentData.json', page: <?php print $vn_initial_page; ?>
/** * Returns display string for relationship bundles. Used by themes/default/bundles/ca_entities.php and the like. * * @param RequestHTTP $po_request * @param string $ps_table * @param array $pa_attributes * @param array $pa_options * * @return string */ function caGetRelationDisplayString($po_request, $ps_table, $pa_attributes = null, $pa_options = null) { $o_config = Configuration::load(); $o_dm = Datamodel::load(); if (!($vs_relationship_type_display_position = caGetOption('relationshipTypeDisplayPosition', $pa_options, null))) { $vs_relationship_type_display_position = strtolower($o_config->get($ps_table . '_lookup_relationship_type_position')); } $vs_attr_str = _caHTMLMakeAttributeString(is_array($pa_attributes) ? $pa_attributes : array()); $vs_display = "{" . (isset($pa_options['display']) && $pa_options['display'] ? $pa_options['display'] : "_display") . "}"; if (isset($pa_options['makeLink']) && $pa_options['makeLink']) { $vs_display = "<a href='" . urldecode(caEditorUrl($po_request, $ps_table, '{' . $o_dm->getTablePrimaryKeyName($ps_table) . '}', false, array('rel' => true))) . "' {$vs_attr_str}>{$vs_display}</a>"; } switch ($vs_relationship_type_display_position) { case 'left': return "({{relationship_typename}}) {$vs_display}"; break; case 'none': return "{$vs_display}"; break; default: case 'right': return "{$vs_display} ({{relationship_typename}})"; break; } }
/** * * */ public function Edit() { $vs_id = $this->request->getParameter('id', pString); list($vs_table, $vn_id) = explode('-', $vs_id); if (!$vn_id) { $vn_id = $vs_table; $vs_table = 'ca_collections'; } $this->response->setRedirect(caEditorUrl($this->request, $vs_table, $vn_id)); return; }
<input type="hidden" name="<?php print $vs_id_prefix; ?> _id{n}" id="<?php print $vs_id_prefix; ?> _id{n}" value="{id}"/> </td> <td> <a href="#" class="caDeleteItemButton"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> <a href="<?php print urldecode(caEditorUrl($this->request, 'ca_objects', '{object_id}')); ?> " class="caEditItemButton" id="<?php print $vs_id_prefix; ?> _edit_related_{n}"><?php print caNavIcon($this->request, __CA_NAV_BUTTON_GO__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))); ?> </a> </td> </tr> </table> </div> </textarea> <div class="bundleContainer">
/** * */ public function Index($pa_options = null) { $ps_search = $this->request->getParameter('search', pString); $ps_sort = $this->request->getParameter('sort', pString); if (!$ps_search) { $ps_search = $this->request->session->getVar('quick_search_last_search'); } if (!in_array($ps_sort, array('name', 'idno'))) { if (!($ps_sort = $this->request->session->getVar('quick_search_last_sort'))) { $ps_sort = 'name'; } } MetaTagManager::setWindowTitle(_t('Quick search')); $o_config = Configuration::load(); $vs_default_actions["ca_objects"] = $this->request->user->canDoAction("can_edit_ca_objects") ? "Edit" : "Summary"; $vs_default_actions["ca_object_lots"] = $this->request->user->canDoAction("can_edit_ca_object_lots") ? "Edit" : "Summary"; $vs_default_actions["ca_entities"] = $this->request->user->canDoAction("can_edit_ca_entities") ? "Edit" : "Summary"; $vs_default_actions["ca_places"] = $this->request->user->canDoAction("can_edit_ca_places") ? "Edit" : "Summary"; $vs_default_actions["ca_occurrences"] = $this->request->user->canDoAction("can_edit_ca_occurrences") ? "Edit" : "Summary"; $vs_default_actions["ca_collections"] = $this->request->user->canDoAction("can_edit_ca_collections") ? "Edit" : "Summary"; $vs_default_actions["ca_storage_locations"] = $this->request->user->canDoAction("can_edit_ca_storage_locations") ? "Edit" : "Summary"; $vs_default_actions["ca_loans"] = $this->request->user->canDoAction("can_edit_ca_loans") ? "Edit" : "Summary"; $vs_default_actions["ca_movements"] = $this->request->user->canDoAction("can_edit_ca_movements") ? "Edit" : "Summary"; $vs_default_actions["ca_tours"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary"; $vs_default_actions["ca_tour_stops"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary"; $va_searches = array('ca_collections' => array('name' => 'ca_collection_labels.name', 'displayidno' => 'ca_collections.idno', 'idno' => 'ca_collections.idno_sort', 'displayname' => _t('Collections'), 'primary_key' => 'collection_id', 'module' => 'editor/collections', 'controller' => 'CollectionEditor', 'action' => $vs_default_actions["ca_collections"], 'searchModule' => 'find', 'searchController' => 'SearchCollections', 'searchAction' => "Index"), 'ca_objects' => array('name' => 'ca_object_labels.name', 'displayidno' => 'ca_objects.idno', 'idno' => 'ca_objects.idno_sort', 'displayname' => _t('Objects'), 'primary_key' => 'object_id', 'module' => 'editor/objects', 'controller' => 'ObjectEditor', 'action' => $vs_default_actions["ca_objects"], 'searchModule' => 'find', 'searchController' => 'SearchObjects', 'searchAction' => "Index"), 'ca_object_lots' => array('name' => 'ca_object_lot_labels.name', 'displayidno' => 'ca_object_lots.idno_stub', 'idno' => 'ca_object_lots.idno_stub_sort', 'displayname' => _t('Object lots'), 'primary_key' => 'lot_id', 'module' => 'editor/object_lots', 'controller' => 'ObjectLotEditor', 'action' => $vs_default_actions["ca_object_lots"], 'searchModule' => 'find', 'searchController' => 'SearchObjectLots', 'searchAction' => "Index"), 'ca_entities' => array('name' => 'ca_entity_labels.surname;ca_entity_labels.forename', 'displayidno' => 'ca_entities.idno', 'idno' => 'ca_entities.idno_sort', 'displayname' => _t('Entities'), 'primary_key' => 'entity_id', 'module' => 'editor/entities', 'controller' => 'EntityEditor', 'action' => $vs_default_actions["ca_entities"], 'searchModule' => 'find', 'searchController' => 'SearchEntities', 'searchAction' => "Index"), 'ca_places' => array('name' => 'ca_place_labels.name', 'displayidno' => 'ca_places.idno', 'idno' => 'ca_places.idno_sort', 'displayname' => _t('Places'), 'primary_key' => 'place_id', 'module' => 'editor/places', 'controller' => 'PlaceEditor', 'action' => $vs_default_actions["ca_places"], 'searchModule' => 'find', 'searchController' => 'SearchPlaces', 'searchAction' => "Index"), 'ca_occurrences' => array('name' => 'ca_occurrence_labels.name', 'displayidno' => 'ca_occurrences.idno', 'idno' => 'ca_occurrences.idno_sort', 'displayname' => _t('Occurrences'), 'primary_key' => 'occurrence_id', 'module' => 'editor/occurrences', 'controller' => 'OccurrenceEditor', 'action' => $vs_default_actions["ca_occurrences"], 'searchModule' => 'find', 'searchController' => 'SearchOccurrences', 'searchAction' => "Index"), 'ca_storage_locations' => array('name' => 'ca_storage_location_labels.name', 'displayidno' => '', 'idno' => '', 'displayname' => _t('Storage locations'), 'primary_key' => 'location_id', 'module' => 'editor/storage_locations', 'controller' => 'StorageLocationEditor', 'action' => $vs_default_actions["ca_storage_locations"], 'searchModule' => 'find', 'searchController' => 'SearchStorageLocations', 'searchAction' => "Index"), 'ca_loans' => array('name' => 'ca_loan_labels.name', 'displayidno' => 'ca_loans.idno', 'idno' => 'ca_loans.idno_sort', 'displayname' => _t('Loans'), 'primary_key' => 'loan_id', 'module' => 'editor/loans', 'controller' => 'LoanEditor', 'action' => $vs_default_actions["ca_loans"], 'searchModule' => 'find', 'searchController' => 'SearchLoans', 'searchAction' => "Index"), 'ca_movements' => array('name' => 'ca_movement_labels.name', 'displayidno' => 'ca_movements.idno', 'idno' => 'ca_movements.idno_sort', 'displayname' => _t('Movements'), 'primary_key' => 'movement_id', 'module' => 'editor/movements', 'controller' => 'MovementEditor', 'action' => $vs_default_actions["ca_movements"], 'searchModule' => 'find', 'searchController' => 'SearchMovements', 'searchAction' => "Index"), 'ca_tours' => array('name' => 'ca_tour_labels.name', 'displayidno' => 'ca_tours.tour_code', 'idno' => 'ca_tours.tour_code', 'displayname' => _t('Tours'), 'primary_key' => 'tour_id', 'module' => 'editor/tours', 'controller' => 'TourEditor', 'action' => $vs_default_actions["ca_tours"], 'searchModule' => 'find', 'searchController' => 'SearchTours', 'searchAction' => "Index"), 'ca_tour_stops' => array('name' => 'ca_tour_stop_labels.name', 'displayidno' => 'ca_tour_stops.idno', 'idno' => 'ca_tour_stops.idno_sort', 'displayname' => _t('Tour stops'), 'primary_key' => 'stop_id', 'module' => 'editor/tour_stops', 'controller' => 'TourStopEditor', 'action' => $vs_default_actions["ca_tour_stops"], 'searchModule' => 'find', 'searchController' => 'SearchTourStops', 'searchAction' => "Index")); $t_list = new ca_lists(); $this->view->setVar('occurrence_types', caExtractValuesByUserLocale($t_list->getItemsForList('occurrence_types'))); if (sizeof($va_aps_in_search = caSearchGetAccessPoints($ps_search))) { $va_aps = caSearchGetTablesForAccessPoints($va_aps_in_search); $vb_uses_aps = true; } else { $vb_uses_aps = false; } $va_single_results = array(); $pn_multiple_results = 0; foreach ($va_searches as $vs_table => $va_sorts) { if ($o_config->get($vs_table . '_disable') || $vs_table == 'ca_tour_stops' && $o_config->get('ca_tours_disable') || $vb_uses_aps && !in_array($vs_table, $va_aps)) { unset($va_searches[$vs_table]); continue; } if (!($vo_result = $this->_doSearch($vs_table, $ps_search, $va_sorts[$ps_sort]))) { unset($va_searches[$vs_table]); continue; } $vo_result->setOption('prefetch', $this->opn_num_results_per_item_type); // get everything we need in one pass $vo_result->setOption('dontPrefetchAttributes', true); // don't bother trying to prefetch attributes as we don't need them $this->view->setVar($vs_table . '_results', $vo_result); $va_found_item_ids = array(); while ($vo_result->nextHit()) { $va_found_item_ids[] = $vo_result->get($va_sorts['primary_key']); } $vo_result->seek(0); $o_result_context = new ResultContext($this->request, $vs_table, 'quick_search'); $o_result_context->setAsLastFind(); $o_result_context->setResultList($va_found_item_ids); $o_result_context->saveContext(); if ($vo_result->numHits() > 0) { if ($vo_result->numHits() == 1) { $va_single_results[$vs_table] = $va_found_item_ids[0]; } else { $pn_multiple_results = 1; } } } $this->view->setVar('searches', $va_searches); // note last quick search if ($ps_search) { $this->request->session->setVar('quick_search_last_search', $ps_search); } if ($ps_sort) { $this->request->session->setVar('quick_search_last_sort', $ps_sort); } $this->view->setVar('search', $ps_search); $this->view->setVar('sort', $this->request->session->getVar('quick_search_last_sort')); $this->view->setVar('maxNumberResults', $this->opn_num_results_per_item_type); // did we find only a single result in a single table? If so, then redirect to that record instead of showing results if (!$pn_multiple_results && sizeof($va_single_results) == 1) { foreach ($va_single_results as $vs_table => $vn_id) { $this->response->setRedirect(caEditorUrl($this->request, $vs_table, $vn_id)); return; } } $this->render('Results/quick_search_results_html.php'); }