public function Export() { set_time_limit(3600); $vs_xml = ConfigurationExporter::exportConfigurationAsXML($this->request->config->get('app_name'), _t('Profile created on %1 by %2', caGetLocalizedDate(), $this->request->user->get('fname') . ' ' . $this->request->user->get('lname')), 'base', ''); $this->view->setVar('profile', $vs_xml); $this->view->setVar('profile_file_name', $this->request->config->get('app_name') . '_config.xml'); $this->render('export_configuration_binary.php'); return; }
print "<div class='unit'><h2>" . _t("Related Collection") . (sizeof($va_collections) > 1 ? "s" : "") . "</h2>"; foreach ($va_collections as $va_collection_info) { print "<div>" . $o_purifier->purify($va_collection_info['label']) . " (" . $o_purifier->purify($va_collection_info['relationship_typename']) . ")</div>"; } print "</div><!-- end unit -->"; } # --- lots $va_object_lots = $t_item->get("ca_object_lots", array("returnAsArray" => 1, 'checkAccess' => $va_access_values)); if (sizeof($va_object_lots) > 0) { print "<div class='unit'><h2>" . _t("Related Lot") . (sizeof($va_object_lots) > 1 ? "s" : "") . "</h2>"; foreach ($va_object_lots as $va_object_lot_info) { print "<div>" . $o_purifier->purify($va_object_lot_info['label']) . " (" . $o_purifier->purify($va_object_lot_info['relationship_typename']) . ")</div>"; } print "</div><!-- end unit -->"; } # --- vocabulary terms $va_terms = $t_item->get("ca_list_items", array("returnAsArray" => 1, 'checkAccess' => $va_access_values)); if (sizeof($va_terms) > 0) { print "<div class='unit'><h2>" . _t("Subject") . (sizeof($va_terms) > 1 ? "s" : "") . "</h2>"; foreach ($va_terms as $va_term_info) { print "<div>" . $o_purifier->purify($va_term_info['label']) . "</div>"; } print "</div><!-- end unit -->"; } print "<div class='notes'><b>Downloaded:</b> " . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "</unit>"; ?> </BODY> </HTML>
/** * * * @param string $ps_source * @param array $pa_options * @return bool */ public function nextRow() { if (!$this->opo_rows) { return false; } while (true) { if ($this->opn_current_row > 0) { $this->opo_rows->next(); } $this->opn_current_row++; if (!$this->opo_rows->valid()) { return false; } if ($o_row = $this->opo_rows->current()) { $this->opa_row_buf = array(null); $o_cells = $o_row->getCellIterator(); $o_cells->setIterateOnlyExistingCells(false); $va_row = array(); $vb_val_was_set = false; $vn_col = 0; $vn_last_col_set = null; foreach ($o_cells as $o_cell) { if (PHPExcel_Shared_Date::isDateTime($o_cell)) { if (!($vs_val = caGetLocalizedDate(PHPExcel_Shared_Date::ExcelToPHP(trim((string) $o_cell->getValue()))))) { if (!($vs_val = trim(PHPExcel_Style_NumberFormat::toFormattedString((string) $o_cell->getValue(), 'YYYY-MM-DD')))) { $vs_val = trim((string) $o_cell->getValue()); } } $this->opa_row_buf[] = $vs_val; } else { $this->opa_row_buf[] = $vs_val = trim((string) $o_cell->getValue()); } if (strlen($vs_val) > 0) { $vb_val_was_set = true; $vn_last_col_set = $vn_col; } $vn_col++; if ($vn_col > 255) { break; } // max 255 columns; some Excel files have *thousands* of "phantom" columns } //if (!$vb_val_was_set) { //return $this->nextRow(); // continue; //} // skip completely blank rows return $o_row; } } return false; }
/** * @param array $pa_options * progressCallback = * reportCallback = * sendMail = * log = log directory path * logLevel = KLogger loglevel. Default is "INFO" */ public static function importMetadata($po_request, $ps_source, $ps_importer, $ps_input_format, $pa_options = null) { $va_errors = $va_noticed = array(); $vn_start_time = time(); $o_config = Configuration::load(); if (!ca_data_importers::mappingExists($ps_importer)) { $va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t('Importer %1 does not exist', $ps_importer)), 'status' => 'ERROR'); return false; } $vs_log_dir = isset($pa_options['log']) ? $pa_options['log'] : null; $vn_log_level = KLogger::INFO; switch ($vs_log_level = isset($pa_options['logLevel']) ? $pa_options['logLevel'] : "INFO") { case 'DEBUG': $vn_log_level = KLogger::DEBUG; break; case 'NOTICE': $vn_log_level = KLogger::NOTICE; break; case 'WARN': $vn_log_level = KLogger::WARN; break; case 'ERR': $vn_log_level = KLogger::ERR; break; case 'CRIT': $vn_log_level = KLogger::CRIT; break; case 'ALERT': $vn_log_level = KLogger::ALERT; break; default: case 'INFO': $vn_log_level = KLogger::INFO; break; } if (!ca_data_importers::importDataFromSource($ps_source, $ps_importer, array('logDirectory' => $o_config->get('batch_metadata_import_log_directory'), 'request' => $po_request, 'format' => $ps_input_format, 'showCLIProgressBar' => false, 'useNcurses' => false, 'progressCallback' => isset($pa_options['progressCallback']) ? $pa_options['progressCallback'] : null, 'reportCallback' => isset($pa_options['reportCallback']) ? $pa_options['reportCallback'] : null, 'logDirectory' => $vs_log_dir, 'logLevel' => $vn_log_level))) { $va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Could not import source %1", $vs_data_source)), 'status' => 'ERROR'); return false; } else { $va_notices['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Imported data from source %1", $vs_data_source)), 'status' => 'SUCCESS'); //return true; } $vn_elapsed_time = time() - $vn_start_time; if (isset($pa_options['sendMail']) && $pa_options['sendMail']) { if ($vs_email = trim($po_request->user->get('email'))) { caSendMessageUsingView($po_request, array($vs_email => $po_request->user->get('fname') . ' ' . $po_request->user->get('lname')), __CA_ADMIN_EMAIL__, _t('[%1] Batch metadata import completed', $po_request->config->get('app_display_name')), 'batch_metadata_import_completed.tpl', array('notices' => $va_notices, 'errors' => $va_errors, 'numErrors' => sizeof($va_errors), 'numProcessed' => sizeof($va_notices), 'subjectNameSingular' => _t('row'), 'subjectNamePlural' => _t('rows'), 'startedOn' => $vs_started_on, 'completedOn' => caGetLocalizedDate(time()), 'elapsedTime' => caFormatInterval($vn_elapsed_time))); } } if (isset($pa_options['sendSMS']) && $pa_options['sendSMS']) { SMS::send($po_request->getUserID(), _t("[%1] Metadata import processing for begun at %2 is complete", $po_request->config->get('app_display_name'), $vs_started_on)); } return array('errors' => $va_errors, 'notices' => $va_notices, 'processing_time' => caFormatInterval($vn_elapsed_time)); }
/** * Generates standard-format inspector panels for editors * * @param View $po_view Inspector view object * @param array $pa_options 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 inspector */ function caEditorInspector($po_view, $pa_options = null) { require_once __CA_MODELS_DIR__ . '/ca_sets.php'; require_once __CA_MODELS_DIR__ . '/ca_data_exporters.php'; $t_item = $po_view->getVar('t_item'); $vs_table_name = $t_item->tableName(); if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') { $vs_priv_table_name = 'ca_lists'; } $vn_item_id = $t_item->getPrimaryKey(); $o_result_context = $po_view->getVar('result_context'); $t_ui = $po_view->getVar('t_ui'); $t_type = method_exists($t_item, "getTypeInstance") ? $t_item->getTypeInstance() : null; $vs_type_name = method_exists($t_item, "getTypeName") ? $t_item->getTypeName() : ''; if (!$vs_type_name) { $vs_type_name = $t_item->getProperty('NAME_SINGULAR'); } $va_reps = $po_view->getVar('representations'); $o_dm = Datamodel::load(); if ($t_item->isHierarchical()) { $va_ancestors = $po_view->getVar('ancestors'); $vn_parent_id = $t_item->get($t_item->getProperty('HIERARCHY_PARENT_ID_FLD')); } else { $va_ancestors = array(); $vn_parent_id = null; } // action extra to preserve currently open screen across next/previous links $vs_screen_extra = $po_view->getVar('screen') ? '/' . $po_view->getVar('screen') : ''; if ($vs_type_name == "list item") { $vs_style = "style='height:auto;'"; } if ($vn_item_id | $po_view->request->getAction() === 'Delete') { $vs_buf = '<h3 class="nextPrevious" ' . $vs_style . '>' . caEditorFindResultNavigation($po_view->request, $t_item, $o_result_context, $pa_options) . "</h3>\n"; } $vs_color = null; if ($t_type) { $vs_color = trim($t_type->get('color')); } if (!$vs_color && $t_ui) { $vs_color = trim($t_ui->get('color')); } if (!$vs_color) { $vs_color = "FFFFFF"; } $vs_buf .= "<h4><div id='caColorbox' style='border: 6px solid #{$vs_color};'>\n"; $vs_icon = null; if ($t_type) { $vs_icon = $t_type->getMediaTag('icon', 'icon'); } if (!$vs_icon && $t_ui) { $vs_icon = $t_ui->getMediaTag('icon', 'icon'); } if ($vs_icon) { $vs_buf .= "<div id='inspectoricon' style='border-right: 6px solid #{$vs_color}; border-bottom: 6px solid #{$vs_color}; -moz-border-radius-bottomright: 8px; -webkit-border-bottom-right-radius: 8px;'>\n{$vs_icon}</div>\n"; } if ($po_view->request->getAction() === 'Delete' && $po_view->request->getParameter('confirm', pInteger)) { $vs_buf .= "<strong>" . _t("Deleted %1", $vs_type_name) . "</strong>\n"; $vs_buf .= "<br style='clear: both;'/></div></h4>\n"; } else { if ($vn_item_id) { if (!$po_view->request->config->get("{$vs_priv_table_name}_inspector_disable_headline")) { if ($po_view->request->user->canDoAction("can_edit_" . $vs_priv_table_name) && sizeof($t_item->getTypeList()) > 1) { $vs_buf .= "<strong>" . _t("Editing %1", $vs_type_name) . ": </strong>\n"; } else { $vs_buf .= "<strong>" . _t("Viewing %1", $vs_type_name) . ": </strong>\n"; } } if ($t_item->hasField('is_deaccessioned') && $t_item->get('is_deaccessioned') && $t_item->get('deaccession_date', array('getDirectDate' => true)) <= caDateToHistoricTimestamp(_t('now'))) { // If currently deaccessioned then display deaccession message $vs_buf .= "<br/><div class='inspectorDeaccessioned'>" . _t('Deaccessioned %1', $t_item->get('deaccession_date')) . "</div>\n"; if ($vs_deaccession_notes = $t_item->get('deaccession_notes')) { TooltipManager::add(".inspectorDeaccessioned", $vs_deaccession_notes); } } else { if ($po_view->request->user->canDoAction('can_see_current_location_in_inspector_ca_objects')) { if ($t_ui && method_exists($t_item, "getObjectHistory") && (is_array($va_placements = $t_ui->getPlacementsForBundle('ca_objects_history')) && sizeof($va_placements) > 0)) { // // Output current "location" of object in life cycle. Configuration is taken from a ca_objects_history bundle configured for the current editor // $va_placement = array_shift($va_placements); $va_bundle_settings = $va_placement['settings']; if (is_array($va_history = $t_item->getObjectHistory($va_bundle_settings, array('limit' => 1, 'currentOnly' => true))) && sizeof($va_history) > 0) { $va_current_location = array_shift(array_shift($va_history)); if (!($vs_inspector_current_location_label = $po_view->request->config->get("ca_objects_inspector_current_location_label"))) { $vs_inspector_current_location_label = _t('Current'); } if ($va_current_location['display']) { $vs_buf .= "<div class='inspectorCurrentLocation'><strong>" . $vs_inspector_current_location_label . ':</strong><br/>' . $va_current_location['display'] . "</div>"; } } } elseif (method_exists($t_item, "getLastLocationForDisplay")) { // If no ca_objects_history bundle is configured then display the last storage location if ($vs_current_location = $t_item->getLastLocationForDisplay("<ifdef code='ca_storage_locations.parent.preferred_labels'>^ca_storage_locations.parent.preferred_labels ➜ </ifdef>^ca_storage_locations.preferred_labels.name")) { $vs_buf .= "<br/><div class='inspectorCurrentLocation'>" . _t('Location: %1', $vs_current_location) . "</div>\n"; $vs_full_location_hierarchy = $t_item->getLastLocationForDisplay("^ca_storage_locations.hierarchy.preferred_labels.name%delimiter=_➜_"); if ($vs_full_location_hierarchy !== $vs_current_location) { TooltipManager::add(".inspectorCurrentLocation", $vs_full_location_hierarchy); } } } } } // // Display flags; expressions for these are defined in app.conf in the <table_name>_inspector_display_flags directive // if (is_array($va_display_flags = $po_view->request->config->getAssoc("{$vs_table_name}_inspector_display_flags"))) { $va_display_flag_buf = array(); foreach ($va_display_flags as $vs_exp => $vs_display_flag) { $va_exp_vars = array(); foreach (ExpressionParser::getVariableList($vs_exp) as $vs_var_name) { $va_exp_vars[$vs_var_name] = $t_item->get($vs_var_name, array('returnIdno' => true)); } if (ExpressionParser::evaluate($vs_exp, $va_exp_vars)) { $va_display_flag_buf[] = $t_item->getWithTemplate("{$vs_display_flag}"); } } if (sizeof($va_display_flag_buf) > 0) { $vs_buf .= join("; ", $va_display_flag_buf); } } $vs_label = ''; $vb_dont_use_labels_for_ca_objects = (bool) $t_item->getAppConfig()->get('ca_objects_dont_use_labels'); if (!($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects)) { if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_title")) { $vs_label = caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey())); } else { $va_object_collection_collection_ancestors = $po_view->getVar('object_collection_collection_ancestors'); if ($t_item->tableName() == 'ca_objects' && $t_item->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && is_array($va_object_collection_collection_ancestors) && sizeof($va_object_collection_collection_ancestors)) { $va_collection_links = array(); foreach ($va_object_collection_collection_ancestors as $va_collection_ancestor) { $va_collection_links[] = caEditorLink($po_view->request, $va_collection_ancestor['label'], '', 'ca_collections', $va_collection_ancestor['collection_id']); } $vs_label .= join(" / ", $va_collection_links) . ' > '; } if (method_exists($t_item, 'getLabelForDisplay')) { $vn_parent_index = sizeof($va_ancestors) - 1; if ($vn_parent_id && ($vs_table_name != 'ca_places' || $vn_parent_index > 0)) { $va_parent = $va_ancestors[$vn_parent_index]; $vs_disp_fld = $t_item->getLabelDisplayField(); if ($va_parent['NODE'][$vs_disp_fld] && ($vs_editor_link = caEditorLink($po_view->request, $va_parent['NODE'][$vs_disp_fld], '', $vs_table_name, $va_parent['NODE'][$t_item->primaryKey()]))) { $vs_label .= $vs_editor_link . ' > ' . $t_item->getLabelForDisplay(); } else { $vs_label .= ($va_parent['NODE'][$vs_disp_fld] ? $va_parent['NODE'][$vs_disp_fld] . ' > ' : '') . $t_item->getLabelForDisplay(); } } else { $vs_label .= $t_item->getLabelForDisplay(); if ($vs_table_name === 'ca_editor_uis' && in_array($po_view->request->getAction(), array('EditScreen', 'DeleteScreen', 'SaveScreen'))) { $t_screen = new ca_editor_ui_screens($po_view->request->getParameter('screen_id', pInteger)); if (!($vs_screen_name = $t_screen->getLabelForDisplay())) { $vs_screen_name = _t('new screen'); } $vs_label .= " > " . $vs_screen_name; } } } else { $vs_label .= $t_item->get('name'); } } } $vb_show_idno = (bool) ($vs_idno = $t_item->get($t_item->getProperty('ID_NUMBERING_ID_FIELD'))); if (!$vs_label) { switch ($vs_table_name) { case 'ca_commerce_orders': if ($t_item->get('order_type') == 'L') { if ($vs_org = $t_item->get('billing_organization')) { $vs_label = _t('%5 #%4 on %1 to %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR'))); } else { $vs_label = _t('%4 #%3 on %1 to %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR'))); } } else { if ($vs_org = $t_item->get('billing_organization')) { $vs_label = _t('%5 #%4 on %1 from %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR'))); } else { $vs_label = _t('%4 #%3 on %1 from %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR'))); } } break; default: if ($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects) { $vs_label = $vs_idno; $vb_show_idno = false; } else { $vs_label = '[' . _t('BLANK') . ']'; } break; } } $vs_buf .= "<div class='recordTitle {$vs_table_name}' style='width:190px; overflow:hidden;'>{$vs_label}" . ($vb_show_idno ? "<a title='{$vs_idno}'>" . ($vs_idno ? " ({$vs_idno})" : '') : "") . "</a></div>"; if ($vs_table_name === 'ca_object_lots' && $t_item->getPrimaryKey()) { $vs_buf .= "<div id='inspectorLotMediaDownload'><strong>" . (($vn_num_objects = $t_item->numObjects()) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n"; } if ($po_view->request->config->get("include_custom_inspector")) { if (file_exists($po_view->request->getViewsDirectoryPath() . "/bundles/inspector_info.php")) { $vo_inspector_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/"); $vo_inspector_view->setVar('t_item', $t_item); $vs_buf .= $vo_inspector_view->render('inspector_info.php'); } } } else { $vs_parent_name = ''; if ($vn_parent_id = $po_view->request->getParameter('parent_id', pInteger)) { $t_parent = clone $t_item; $t_parent->load($vn_parent_id); $vs_parent_name = $t_parent->getLabelForDisplay(); } $vs_buf .= "<div class='creatingNew'>" . _t("Creating new %1", $vs_type_name) . " " . ($vs_parent_name ? _t("%1 > New %2", $vs_parent_name, $vs_type_name) : '') . "</div>\n"; $vs_buf .= "<br/>\n"; } // ------------------------------------------------------------------------------------- if ($t_item->getPrimaryKey()) { if (sizeof($va_reps) > 0) { $va_imgs = array(); $vs_buf .= "<div id='inspectorMedia'>"; $vn_r = $vn_primary_index = 0; foreach ($va_reps as $va_rep) { if (!($va_rep['info']['preview170']['WIDTH'] && $va_rep['info']['preview170']['HEIGHT'])) { continue; } if ($vb_is_primary = isset($va_rep['is_primary']) && (bool) $va_rep['is_primary']) { $vn_primary_index = $vn_r; } $va_imgs[] = "{url:'" . $va_rep['urls']['preview170'] . "', width: " . $va_rep['info']['preview170']['WIDTH'] . ", height: " . $va_rep['info']['preview170']['HEIGHT'] . ", link: '#', onclick: 'caMediaPanel.showPanel(\\'" . caNavUrl($po_view->request, '*', '*', 'GetMediaOverlay', array($t_item->primaryKey() => $vn_item_id, 'representation_id' => $va_rep['representation_id'])) . "\\')'}"; $vn_r++; } if (sizeof($va_reps) > 1) { $vs_buf .= "\n\t\t\t\t\t<div class='leftScroll'>\n\t\t\t\t\t\t<a href='#' onclick='inspectorInfoRepScroller.scrollToPreviousImage(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_SCROLL_LT__) . "</a>\n\t\t\t\t\t</div>\n\t\t"; } if (sizeof($va_imgs) > 0) { $vs_buf .= "\n\t\t\t\t<div id='inspectorInfoRepScrollingViewer' style='position: relative;'>\n\t\t\t\t\t<div id='inspectorInfoRepScrollingViewerContainer'>\n\t\t\t\t\t\t<div id='inspectorInfoRepScrollingViewerImageContainer'></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t"; if (sizeof($va_reps) > 1) { $vs_buf .= "\n\t\t\t\t\t<div class='rightScroll'>\n\t\t\t\t\t\t<a href='#' onclick='inspectorInfoRepScroller.scrollToNextImage(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_SCROLL_RT__) . "</a>\n\t\t\t\t\t</div>\n\t\t"; } TooltipManager::add(".leftScroll", _t('Previous')); TooltipManager::add(".rightScroll", _t('Next')); $vs_buf .= "<script type='text/javascript'>"; $vs_buf .= "\n\t\t\t\t\tvar inspectorInfoRepScroller = caUI.initImageScroller([" . join(",", $va_imgs) . "], 'inspectorInfoRepScrollingViewerImageContainer', {\n\t\t\t\t\t\t\tcontainerWidth: 170, containerHeight: 170,\n\t\t\t\t\t\t\timageCounterID: 'inspectorInfoRepScrollingViewerCounter',\n\t\t\t\t\t\t\tscrollingImageClass: 'inspectorInfoRepScrollerImage',\n\t\t\t\t\t\t\tscrollingImagePrefixID: 'inspectorInfoRep',\n\t\t\t\t\t\t\tinitialIndex: {$vn_primary_index}\n\t\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t</script>"; } $vs_buf .= "</div>\n"; if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_below_media")) { $vs_buf .= caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey())); } } $vs_buf .= "<div id='toolIcons'>"; if ($vn_item_id) { # --- watch this link $vs_watch = ""; if (in_array($vs_table_name, array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations'))) { require_once __CA_MODELS_DIR__ . '/ca_watch_list.php'; $t_watch_list = new ca_watch_list(); $vs_watch = "<div class='watchThis'><a href='#' title='" . _t('Add/remove item to/from watch list.') . "' onclick='caToggleItemWatch(); return false;' id='caWatchItemButton'>" . caNavIcon($po_view->request, $t_watch_list->isItemWatched($vn_item_id, $t_item->tableNum(), $po_view->request->user->get("user_id")) ? __CA_NAV_BUTTON_UNWATCH__ : __CA_NAV_BUTTON_WATCH__) . "</a></div>"; $vs_buf .= "\n<script type='text/javascript'>\n\t\tfunction caToggleItemWatch() {\n\t\t\tvar url = '" . caNavUrl($po_view->request, $po_view->request->getModulePath(), $po_view->request->getController(), 'toggleWatch', array($t_item->primaryKey() => $vn_item_id)) . "';\n\t\t\t\n\t\t\tjQuery.getJSON(url, {}, function(data, status) {\n\t\t\t\tif (data['status'] == 'ok') {\n\t\t\t\t\tjQuery('#caWatchItemButton').html((data['state'] == 'watched') ? '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_UNWATCH__)) . "' : '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_WATCH__)) . "');\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('Error toggling watch status for item: ' + data['errors']);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t</script>\n"; } $vs_buf .= "{$vs_watch}\n"; TooltipManager::add("#caWatchItemButton", _t('Watch/Unwatch this record')); if ($po_view->request->user->canDoAction("can_change_type_{$vs_table_name}")) { $vs_buf .= "<div id='inspectorChangeType'><div id='inspectorChangeTypeButton'><a href='#' onclick='caTypeChangePanel.showPanel(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_CHANGE__ . " Change Type", array('title' => _t('Change type'))) . "</a></div></div>\n"; $vo_change_type_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/"); $vo_change_type_view->setVar('t_item', $t_item); FooterManager::add($vo_change_type_view->render("change_type_html.php")); TooltipManager::add("#inspectorChangeType", _t('Change Record Type')); } if ($t_item->getPrimaryKey() && $po_view->request->config->get($vs_table_name . '_show_add_child_control_in_inspector')) { $vb_show_add_child_control = true; if (is_array($va_restrict_add_child_control_to_types = $po_view->request->config->getList($vs_table_name . '_restrict_child_control_in_inspector_to_types')) && sizeof($va_restrict_add_child_control_to_types)) { $t_type_instance = $t_item->getTypeInstance(); if (!in_array($t_type_instance->get('idno'), $va_restrict_add_child_control_to_types) && !in_array($t_type_instance->getPrimaryKey(), $va_restrict_add_child_control_to_types)) { $vb_show_add_child_control = false; } } if ($vb_show_add_child_control) { if ((bool) $po_view->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy')) { // strict menu $vs_type_list = $t_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $po_view->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__)); } else { // all types $vs_type_list = $t_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__)); } if ($vs_type_list) { $vs_buf .= "<div id='inspectorCreateChild'><div id='inspectorCreateChildButton'><a href='#' onclick='caCreateChildPanel.showPanel(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_CHILD__, array('title' => _t('Create Child Record'))) . "</a></div></div>\n"; $vo_create_child_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/"); $vo_create_child_view->setVar('t_item', $t_item); $vo_create_child_view->setVar('type_list', $vs_type_list); FooterManager::add($vo_create_child_view->render("create_child_html.php")); TooltipManager::add("#inspectorCreateChildButton", _t('Create a child record under this one')); } } } } if ($po_view->request->user->canDoAction('can_duplicate_' . $vs_table_name) && $t_item->getPrimaryKey()) { $vs_buf .= '<div id="caDuplicateItemButton">'; $vs_buf .= caFormTag($po_view->request, 'Edit', 'DuplicateItemForm', $po_view->request->getModulePath() . '/' . $po_view->request->getController(), 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'noTimestamp' => true)); $vs_buf .= caFormSubmitLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DUPLICATE__), '', 'DuplicateItemForm'); $vs_buf .= caHTMLHiddenInput($t_item->primaryKey(), array('value' => $t_item->getPrimaryKey())); $vs_buf .= caHTMLHiddenInput('mode', array('value' => 'dupe')); $vs_buf .= "</form>"; $vs_buf .= "</div>"; TooltipManager::add("#caDuplicateItemButton", _t('Duplicate this %1', mb_strtolower($vs_type_name, 'UTF-8'))); } // // Download media in lot ($vn_num_objects is only set for object lots) if ($vn_num_objects > 0) { $vs_buf .= "<div id='inspectorLotMediaDownloadButton'>" . caNavLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DOWNLOAD__), "button", $po_view->request->getModulePath(), $po_view->request->getController(), 'getLotMedia', array('lot_id' => $t_item->getPrimaryKey(), 'download' => 1), array()) . "</div>\n"; TooltipManager::add('#inspectorLotMediaDownloadButton', _t("Download all media associated with objects in this lot")); } // // Download media in set if ($vs_table_name == 'ca_sets' && sizeof($t_item->getItemRowIDs()) > 0) { $vs_buf .= "<div id='inspectorSetMediaDownloadButton'>" . caNavLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DOWNLOAD__), "button", $po_view->request->getModulePath(), $po_view->request->getController(), 'getSetMedia', array('set_id' => $t_item->getPrimaryKey(), 'download' => 1), array()) . "</div>\n"; TooltipManager::add('#inspectorSetMediaDownloadButton', _t("Download all media associated with records in this set")); } $vs_more_info = ''; // list of sets in which item is a member $t_set = new ca_sets(); if (is_array($va_sets = caExtractValuesByUserLocale($t_set->getSetsForItem($t_item->tableNum(), $t_item->getPrimaryKey(), array('user_id' => $po_view->request->getUserID(), 'access' => __CA_SET_READ_ACCESS__)))) && sizeof($va_sets)) { $va_links = array(); foreach ($va_sets as $vn_set_id => $va_set) { $va_links[] = "<a href='" . caEditorUrl($po_view->request, 'ca_sets', $vn_set_id) . "'>" . $va_set['name'] . "</a>"; } $vs_more_info .= "<div><strong>" . (sizeof($va_links) == 1 ? _t("In set") : _t("In sets")) . "</strong> " . join(", ", $va_links) . "</div>\n"; } // export options if ($vn_item_id && ($vs_select = $po_view->getVar('available_mappings_as_html_select'))) { $vs_more_info .= "<div class='inspectorExportControls'>" . caFormTag($po_view->request, 'exportItem', 'caExportForm', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true)); $vs_more_info .= $vs_select; $vs_more_info .= caHTMLHiddenInput($t_item->primaryKey(), array('value' => $t_item->getPrimaryKey())); $vs_more_info .= caHTMLHiddenInput('download', array('value' => 1)); $vs_more_info .= caFormSubmitLink($po_view->request, 'Export ›', 'button', 'caExportForm'); $vs_more_info .= "</form></div>"; } $va_creation = $t_item->getCreationTimestamp(); $va_last_change = $t_item->getLastChangeTimestamp(); if ($va_creation['timestamp'] || $va_last_change['timestamp']) { $vs_more_info .= "<div class='inspectorChangeDateList'>"; if ($va_creation['timestamp']) { if (!trim($vs_name = $va_creation['fname'] . ' ' . $va_creation['lname'])) { $vs_name = null; } $vs_interval = ($vn_t = time() - $va_creation['timestamp']) == 0 ? _t('Just now') : _t('%1 ago', caFormatInterval($vn_t, 2)); $vs_more_info .= "<div class='inspectorChangeDateListLine' id='caInspectorCreationDate'>" . ($vs_name ? _t('<strong>Created</strong><br/>%1 by %2', $vs_interval, $vs_name) : _t('<strong>Created</strong><br/>%1', $vs_interval)) . "</div>"; TooltipManager::add("#caInspectorCreationDate", "<h2>" . _t('Created on') . "</h2>" . _t('Created on %1', caGetLocalizedDate($va_creation['timestamp'], array('dateFormat' => 'delimited')))); } if ($va_last_change['timestamp'] && $va_creation['timestamp'] != $va_last_change['timestamp']) { if (!trim($vs_name = $va_last_change['fname'] . ' ' . $va_last_change['lname'])) { $vs_name = null; } $vs_interval = ($vn_t = time() - $va_last_change['timestamp']) == 0 ? _t('Just now') : _t('%1 ago', caFormatInterval($vn_t, 2)); $vs_more_info .= "<div class='inspectorChangeDateListLine' id='caInspectorChangeDate'>" . ($vs_name ? _t('<strong>Last changed</strong><br/>%1 by %2', $vs_interval, $vs_name) : _t('<strong>Last changed</strong><br/>%1', $vs_interval)) . "</div>"; TooltipManager::add("#caInspectorChangeDate", "<h2>" . _t('Last changed on') . "</h2>" . _t('Last changed on %1', caGetLocalizedDate($va_last_change['timestamp'], array('dateFormat' => 'delimited')))); } if (method_exists($t_item, 'getMetadataDictionaryRuleViolations') && is_array($va_violations = $t_item->getMetadataDictionaryRuleViolations()) && ($vn_num_violations = sizeof($va_violations)) > 0) { $va_violation_messages = array(); foreach ($va_violations as $vn_violation_id => $va_violation) { $vs_label = $t_item->getDisplayLabel($va_violation['bundle_name']); $va_violation_messages[] = "<li><em><u>{$vs_label}</u></em> " . $va_violation['violationMessage'] . "</li>"; } $vs_more_info .= "<div id='caInspectorViolationsList'>" . ($vs_num_violations_display = "<img src='" . $po_view->request->getThemeUrlPath() . "/graphics/icons/warning_small.gif' border='0'/> " . ($vn_num_violations > 1 ? _t('%1 problems require attention', $vn_num_violations) : _t('%1 problem requires attention', $vn_num_violations))) . "</div>\n"; TooltipManager::add("#caInspectorViolationsList", "<h2>{$vs_num_violations_display}</h2><ol>" . join("\n", $va_violation_messages)) . "</ol>\n"; } $vs_more_info .= "</div>\n"; } if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_more_info")) { $vs_more_info .= caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey())); } if ($vs_more_info) { $vs_buf .= "<div class='button info'><a href='#' id='inspectorMoreInfo'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_INFO2__) . "</a></div>\n\t\t\t<div id='inspectorInfo' >"; $vs_buf .= $vs_more_info . "</div>\n"; TooltipManager::add("#inspectorMoreInfo", _t('See more information about this record')); } $vs_buf .= "</div><!--End tooIcons-->"; } // ------------------------------------------------------------------------------------- // // Item-specific information // // // Output info for related items // if (!$t_item->getPrimaryKey()) { // only applies to new records $vs_rel_table = $po_view->request->getParameter('rel_table', pString); $vn_rel_type_id = $po_view->request->getParameter('rel_type_id', pString); $vn_rel_id = $po_view->request->getParameter('rel_id', pInteger); if ($vs_rel_table && $po_view->request->datamodel->tableExists($vs_rel_table) && $vn_rel_type_id && $vn_rel_id) { $t_rel = $po_view->request->datamodel->getTableInstance($vs_rel_table); if ($t_rel && $t_rel->load($vn_rel_id)) { $vs_buf .= '<strong>' . _t("Will be related to %1", $t_rel->getTypeName()) . '</strong>: ' . $t_rel->getLabelForDisplay(); } } } // // Output lot info for ca_objects // $vb_is_currently_part_of_lot = true; if (!($vn_lot_id = $t_item->get('lot_id'))) { $vn_lot_id = $po_view->request->getParameter('lot_id', pInteger); $vb_is_currently_part_of_lot = false; } if ($vs_table_name === 'ca_objects' && $vn_lot_id) { require_once __CA_MODELS_DIR__ . '/ca_object_lots.php'; $va_lot_lots = caGetTypeListForUser('ca_object_lots', array('access' => __CA_BUNDLE_ACCESS_READONLY__)); $t_lot = new ca_object_lots($vn_lot_id); if ($t_lot->get('deleted') == 0 && in_array($t_lot->get('type_id'), $va_lot_lots)) { if (!($vs_lot_displayname = $t_lot->get('idno_stub'))) { if (!($vs_lot_displayname = $t_lot->getLabelForDisplay())) { $vs_lot_displayname = "Lot {$vn_lot_id}"; } } if ($vs_lot_displayname) { if (!($vs_part_of_lot_msg = $po_view->request->config->get("ca_objects_inspector_part_of_lot_msg"))) { $vs_part_of_lot_msg = _t('Part of lot'); } if (!($vs_will_be_part_of_lot_msg = $po_view->request->config->get("ca_objects_inspector_will_be_part_of_lot_msg"))) { $vs_will_be_part_of_lot_msg = _t('Will be part of lot'); } $vs_buf .= "<strong>" . ($vb_is_currently_part_of_lot ? $vs_part_of_lot_msg : $vs_will_be_part_of_lot_msg) . "</strong>: " . caNavLink($po_view->request, $vs_lot_displayname, '', 'editor/object_lots', 'ObjectLotEditor', 'Edit', array('lot_id' => $vn_lot_id)); } } } $va_object_container_types = $po_view->request->config->getList('ca_objects_container_types'); $va_object_component_types = $po_view->request->config->getList('ca_objects_component_types'); $vb_can_add_component = $vs_table_name === 'ca_objects' && $t_item->getPrimaryKey() && $po_view->request->user->canDoAction('can_create_ca_objects') && $t_item->canTakeComponents(); if (method_exists($t_item, 'getComponentCount')) { if ($vn_component_count = $t_item->getComponentCount()) { if ($t_ui && ($vs_component_list_screen = $t_ui->getScreenWithBundle("ca_objects_components_list", $po_view->request)) && $vs_component_list_screen !== $po_view->request->getActionExtra()) { $vs_component_count_link = caNavLink($po_view->request, $vn_component_count == 1 ? _t('%1 component', $vn_component_count) : _t('%1 components', $vn_component_count), '', '*', '*', $po_view->request->getAction() . '/' . $vs_component_list_screen, array($t_item->primaryKey() => $t_item->getPrimaryKey())); } else { $vs_component_count_link = $vn_component_count == 1 ? _t('%1 component', $vn_component_count) : _t('%1 components', $vn_component_count); } $vs_buf .= "<br/><strong>" . _t('Has') . ":</strong> {$vs_component_count_link}"; } } if ($vb_can_add_component) { $vs_buf .= ' <a href="#" onclick=\'caObjectComponentPanel.showPanel("' . caNavUrl($po_view->request, '*', 'ObjectComponent', 'Form', array('parent_id' => $t_item->getPrimaryKey())) . '"); return false;\')>' . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . '</a>'; $vo_change_type_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/"); $vo_change_type_view->setVar('t_item', $t_item); FooterManager::add($vo_change_type_view->render("create_component_html.php")); } // // Output lot info for ca_object_lots // if ($vs_table_name === 'ca_object_lots' && $t_item->getPrimaryKey()) { $va_component_types = $po_view->request->config->getList('ca_objects_component_types'); if (is_array($va_component_types) && sizeof($va_component_types)) { $vs_buf .= "<strong>" . (($vn_num_objects = $t_item->numObjects(null, array('return' => 'objects'))) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n"; $vs_buf .= "<strong>" . (($vn_num_components = $t_item->numObjects(null, array('return' => 'components'))) == 1 ? _t('Lot contains %1 component', $vn_num_components) : _t('Lot contains %1 components', $vn_num_components)) . "</strong>\n"; } else { $vs_buf .= "<strong>" . (($vn_num_objects = $t_item->numObjects()) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n"; } if ((bool) $po_view->request->config->get('allow_automated_renumbering_of_objects_in_a_lot') && ($va_nonconforming_objects = $t_item->getObjectsWithNonConformingIdnos())) { $vs_buf .= '<br/><br/><em>' . (($vn_c = sizeof($va_nonconforming_objects)) == 1 ? _t('There is %1 object with non-conforming numbering', $vn_c) : _t('There are %1 objects with non-conforming numbering', $vn_c)) . "</em>\n"; $vs_buf .= "<a href='#' onclick='jQuery(\"#inspectorNonConformingNumberList\").toggle(250); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__); $vs_buf .= "<div id='inspectorNonConformingNumberList' class='inspectorNonConformingNumberList'><div class='inspectorNonConformingNumberListScroll'><ol>\n"; foreach ($va_nonconforming_objects as $vn_object_id => $va_object_info) { $vs_buf .= '<li>' . caEditorLink($po_view->request, $va_object_info['idno'], '', 'ca_objects', $vn_object_id) . "</li>\n"; } $vs_buf .= "</ol></div>"; $vs_buf .= caNavLink($po_view->request, _t('Re-number objects') . ' ›', 'button', $po_view->request->getModulePath(), $po_view->request->getController(), 'renumberObjects', array('lot_id' => $t_item->getPrimaryKey())); $vs_buf .= "</div>\n"; } require_once __CA_MODELS_DIR__ . '/ca_objects.php'; $t_object = new ca_objects(); $vs_buf .= "<div class='inspectorLotObjectTypeControls'><form action='#' id='caAddObjectToLotForm'>"; if ((bool) $po_view->request->config->get('ca_objects_enforce_strict_type_hierarchy')) { // strict menu $vs_buf .= _t('Add new %1 to lot', $t_object->getTypeListAsHTMLFormElement('type_id', array('id' => 'caAddObjectToLotForm_type_id'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $po_view->request->config->get('ca_objects_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__))); } else { // all types $vs_buf .= _t('Add new %1 to lot', $t_object->getTypeListAsHTMLFormElement('type_id', array('id' => 'caAddObjectToLotForm_type_id'), array('access' => __CA_BUNDLE_ACCESS_EDIT__))); } $vs_buf .= " <a href='#' onclick='caAddObjectToLotForm()'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . '</a>'; $vs_buf .= "</form></div>\n"; $vs_buf .= "<script type='text/javascript'>\n\tfunction caAddObjectToLotForm() { \n\t\twindow.location='" . caEditorUrl($po_view->request, 'ca_objects', 0, false, array('lot_id' => $t_item->getPrimaryKey(), 'rel' => 1, 'type_id' => '')) . "' + jQuery('#caAddObjectToLotForm_type_id').val();\n\t}\n\tjQuery(document).ready(function() {\n\t\tjQuery('#objectLotsNonConformingNumberList').hide();\n\t});\n</script>\n"; } if ($vs_table_name === 'ca_objects') { // // Output loan info for ca_objects // if ($po_view->request->user->canDoAction('can_manage_clients') && ($va_loan_details = $t_item->isOnLoan())) { $vs_buf .= "<div>" . caNavLink($po_view->request, _t('On loan to %1', $va_loan_details['billing_fname'] . ' ' . $va_loan_details['billing_lname']), 'inspectorOnLoan', 'client/library', 'OrderEditor', 'Edit', array('order_id' => $va_loan_details['order_id'])) . "</div>"; } // // Output checkout info for ca_objects // if ((bool) $po_view->request->config->get('enable_client_services') && ((bool) $po_view->request->config->get('enable_client_services_sales') || (bool) $po_view->request->config->get('enable_client_services_library')) && $t_item->canBeCheckedOut() && ($va_checkout_status = $t_item->getCheckoutStatus(array('returnAsArray' => true)))) { $vs_buf .= "<div class='inspectorCheckedOut'>" . $va_checkout_status['status_display']; if ($va_checkout_status['user_name']) { $vs_buf .= _t("; checked out by %1", $va_checkout_status['user_name']); } $vs_buf .= "</div>"; } } // // Output related objects for ca_object_representations // if ($vs_table_name === 'ca_object_representations') { foreach (array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations', 'ca_loans', 'ca_movements') as $vs_rel_table) { if (sizeof($va_objects = $t_item->getRelatedItems($vs_rel_table))) { $vs_buf .= "<div><strong>" . _t("Related %1", $o_dm->getTableProperty($vs_rel_table, 'NAME_PLURAL')) . "</strong>: <br/>\n"; $vs_screen = ''; if ($t_ui = ca_editor_uis::loadDefaultUI($vs_rel_table, $po_view->request, null)) { $vs_screen = $t_ui->getScreenWithBundle('ca_object_representations', $po_view->request); } foreach ($va_objects as $vn_rel_id => $va_rel_info) { if ($vs_label = array_shift($va_rel_info['labels'])) { $vs_buf .= caEditorLink($po_view->request, '← ' . $vs_label . ' (' . $va_rel_info['idno'] . ')', '', $vs_rel_table, $va_rel_info[$o_dm->getTablePrimaryKeyName($vs_rel_table)], array(), array(), array('action' => 'Edit' . ($vs_screen ? "/{$vs_screen}" : ""))) . "<br/>\n"; } } $vs_buf .= "</div>\n"; } } } // // Output related object reprsentation for ca_representation_annotation // if ($vs_table_name === 'ca_representation_annotations') { if ($vn_representation_id = $t_item->get('representation_id')) { $vs_buf .= "<div><strong>" . _t("Applied to representation") . "</strong>: <br/>\n"; $t_rep = new ca_object_representations($vn_representation_id); $vs_buf .= caNavLink($po_view->request, '← ' . $t_rep->getLabelForDisplay(), '', 'editor/object_representations', 'ObjectRepresentationEditor', 'Edit/' . $po_view->getVar('representation_editor_screen'), array('representation_id' => $vn_representation_id)) . '<br/>'; $vs_buf .= "</div>\n"; } } // // Output extra useful info for sets // if ($vs_table_name === 'ca_sets') { $vn_set_item_count = $t_item->getItemCount(array('user_id' => $po_view->request->getUserID())); if ($vn_set_item_count > 0 && $po_view->request->user->canDoAction('can_batch_edit_' . $o_dm->getTableName($t_item->get('table_num')))) { $vs_buf .= caNavButton($po_view->request, __CA_NAV_BUTTON_BATCH_EDIT__, _t('Batch edit'), 'editorBatchSetEditorLink', 'batch', 'Editor', 'Edit', array('set_id' => $t_item->getPrimaryKey()), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'no_background' => true, 'dont_show_content' => true)); } $vs_buf .= "<div><strong>" . _t("Number of items") . "</strong>: {$vn_set_item_count}<br/>\n"; if ($t_item->getPrimaryKey()) { $vn_set_table_num = $t_item->get('table_num'); $vs_set_table_name = $o_dm->getTableName($vn_set_table_num); $vs_buf .= "<strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_set_table_num) . "<br/>\n"; $vs_buf .= "</div>\n"; } else { if ($vn_set_table_num = $po_view->request->getParameter('table_num', pInteger)) { $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_set_table_num) . "<br/>\n"; $vs_buf .= "</div>\n"; } } $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID()); if ($t_user->getPrimaryKey()) { $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n"; } if ($po_view->request->user->canDoAction('can_export_' . $vs_set_table_name) && $t_item->getPrimaryKey() && sizeof(ca_data_exporters::getExporters($vn_set_table_num)) > 0) { $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; text-align: right;" id="caExportItemButton">'; $vs_buf .= _t('Export this set of records') . " "; $vs_buf .= "<a class='button' onclick='jQuery(\"#exporterFormList\").show();' style='text-align:right;' href='#'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . "</a>"; $vs_buf .= caFormTag($po_view->request, 'ExportData', 'caExportForm', 'manage/MetadataExport', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true)); $vs_buf .= "<div id='exporterFormList'>"; $vs_buf .= ca_data_exporters::getExporterListAsHTMLFormElement('exporter_id', $vn_set_table_num, array('id' => 'caExporterList'), array('width' => '135px')); $vs_buf .= caHTMLHiddenInput('set_id', array('value' => $t_item->getPrimaryKey())); $vs_buf .= caFormSubmitLink($po_view->request, _t('Export') . " ›", "button", "caExportForm"); $vs_buf .= "</div>\n"; $vs_buf .= "</form>"; $vs_buf .= "</div>"; $vs_buf .= "<script type='text/javascript'>"; $vs_buf .= "jQuery(document).ready(function() {"; $vs_buf .= "jQuery(\"#exporterFormList\").hide();"; $vs_buf .= "});"; $vs_buf .= "</script>"; } } // // Output extra useful info for set items // if ($vs_table_name === 'ca_set_items') { AssetLoadManager::register("panel"); $t_set = new ca_sets(); if ($t_set->load($vn_set_id = $t_item->get('set_id'))) { $vs_buf .= "<div><strong>" . _t("Part of set") . "</strong>: " . caEditorLink($po_view->request, $t_set->getLabelForDisplay(), '', 'ca_sets', $vn_set_id) . "<br/>\n"; $t_content_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($vn_item_table_num = $t_item->get('table_num')); if ($t_content_instance->load($vn_row_id = $t_item->get('row_id'))) { $vs_label = $t_content_instance->getLabelForDisplay(); if ($vs_id_fld = $t_content_instance->getProperty('ID_NUMBERING_ID_FIELD')) { $vs_label .= " (" . $t_content_instance->get($vs_id_fld) . ")"; } $vs_buf .= "<strong>" . _t("Is %1", caGetTableDisplayName($vn_item_table_num, false) . "</strong>: " . caEditorLink($po_view->request, $vs_label, '', $vn_item_table_num, $vn_row_id)) . "<br/>\n"; } $vs_buf .= "</div>\n"; } } // // Output extra useful info for lists // if ($vs_table_name === 'ca_lists' && $t_item->getPrimaryKey()) { $vs_buf .= "<strong>" . _t("Number of items") . "</strong>: " . $t_item->numItemsInList() . "<br/>\n"; $t_list_item = new ca_list_items(); $t_list_item->load(array('list_id' => $t_item->getPrimaryKey(), 'parent_id' => null)); $vs_type_list = $t_list_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__)); if ($vs_type_list) { $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px;">'; $vs_buf .= caFormTag($po_view->request, 'Edit', 'NewChildForm', 'administrate/setup/list_item_editor/ListItemEditor', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true)); $vs_buf .= _t('Add a %1 to this list', $vs_type_list) . caHTMLHiddenInput($t_list_item->primaryKey(), array('value' => '0')) . caHTMLHiddenInput('parent_id', array('value' => $t_list_item->getPrimaryKey())); $vs_buf .= caFormSubmitLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__), '', 'NewChildForm'); $vs_buf .= "</form></div>\n"; } } // // Output containing list for list items // if ($vs_table_name === 'ca_list_items') { if ($t_list = $po_view->getVar('t_list')) { $vn_list_id = $t_list->getPrimaryKey(); $vs_buf .= "<strong>" . _t("Part of") . "</strong>: " . caEditorLink($po_view->request, $t_list->getLabelForDisplay(), '', 'ca_lists', $vn_list_id) . "<br/>\n"; if ($t_item->get('is_default')) { $vs_buf .= "<strong>" . _t("Is default for list") . "</strong><br/>\n"; } } } // // Output containing relationship type name for relationship types // if ($vs_table_name === 'ca_relationship_types') { if (!($t_rel_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($t_item->get('table_num'), true))) { if ($vn_parent_id = $po_view->request->getParameter('parent_id', pInteger)) { $t_rel_type = new ca_relationship_types($vn_parent_id); $t_rel_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($t_rel_type->get('table_num'), true); } } if ($t_rel_instance) { $vs_buf .= "<div><strong>" . _t("Is a") . "</strong>: " . $t_rel_instance->getProperty('NAME_SINGULAR') . "<br/></div>\n"; } } // // Output extra useful info for metadata elements // if ($vs_table_name === 'ca_metadata_elements' && $t_item->getPrimaryKey()) { $vs_buf .= "<div><strong>" . _t("Element code") . "</strong>: " . $t_item->get('element_code') . "<br/></div>\n"; if (sizeof($va_uis = $t_item->getUIs()) > 0) { $vs_buf .= "<div><strong>" . _t("Referenced by user interfaces") . "</strong>:<br/>\n"; foreach ($va_uis as $vn_ui_id => $va_ui_info) { $vs_buf .= caNavLink($po_view->request, $va_ui_info['name'], '', 'administrate/setup/interface_screen_editor', 'InterfaceScreenEditor', 'Edit', array('ui_id' => $vn_ui_id, 'screen_id' => $va_ui_info['screen_id'])); $vs_buf .= " (" . $o_dm->getTableProperty($va_ui_info['editor_type'], 'NAME_PLURAL') . ")<br/>\n"; } $vs_buf .= "</div>\n"; } } // // Output related objects for ca_editor_uis and ca_editor_ui_screens // if ($vs_table_name === 'ca_editor_uis') { $vs_buf .= "<div><strong>" . _t("Number of screens") . "</strong>: " . (int) $t_item->getScreenCount() . "\n"; if ($t_item->getPrimaryKey()) { $vs_buf .= "<div><strong>" . _t("Edits") . "</strong>: " . caGetTableDisplayName($t_item->get('editor_type')) . "<br/>\n"; } else { $vs_buf .= "<div><strong>" . _t("Edits") . "</strong>: " . caGetTableDisplayName($po_view->request->getParameter('editor_type', pInteger)) . "<br/>\n"; } $vs_buf .= "</div>\n"; } // // Output related objects for ca_editor_uis and ca_editor_ui_screens // if ($vs_table_name === 'ca_editor_ui_screens') { $t_ui = new ca_editor_uis($vn_ui_id = $t_item->get('ui_id')); $vs_buf .= "<div><strong>" . _t("Part of") . "</strong>: " . caNavLink($po_view->request, $t_ui->getLabelForDisplay(), '', 'administrate/setup/interface_editor', 'InterfaceEditor', 'Edit', array('ui_id' => $vn_ui_id)) . "\n"; $vs_buf .= "</div>\n"; } // // Output extra useful info for bundle displays // if ($vs_table_name === 'ca_bundle_displays') { $vs_buf .= "<div><strong>" . _t("Number of placements") . "</strong>: " . $t_item->getPlacementCount(array('user_id' => $po_view->request->getUserID())) . "<br/>\n"; if ($t_item->getPrimaryKey()) { $vn_content_table_num = $t_item->get('table_num'); $vs_buf .= "<strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n"; $vs_buf .= "</div>\n"; } else { if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) { $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n"; $vs_buf .= "</div>\n"; } } $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID()); if ($t_user->getPrimaryKey()) { $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n"; } } // // Output extra useful info for search forms // if ($vs_table_name === 'ca_search_forms') { $vs_buf .= "<div><strong>" . _t("Number of placements") . "</strong>: " . $t_item->getPlacementCount(array('user_id' => $po_view->request->getUserID())) . "<br/>\n"; if ($t_item->getPrimaryKey()) { $vn_content_table_num = $t_item->get('table_num'); $vs_buf .= "<strong>" . _t("Searches for") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n"; $vs_buf .= "</div>\n"; } else { if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) { $vs_buf .= "<strong>" . _t("Searches for") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n"; $vs_buf .= "</div>\n"; } } $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID()); if ($t_user->getPrimaryKey()) { $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n"; } } // // Output extra useful info for tours // if ($vs_table_name === 'ca_tours' && $t_item->getPrimaryKey()) { $vs_buf .= "<br/><strong>" . _t("Number of stops") . "</strong>: " . $t_item->getStopCount() . "<br/>\n"; } // // Output containing tour for tour stops // if ($vs_table_name === 'ca_tour_stops') { $t_tour = new ca_tours($vn_tour_id = $t_item->get('tour_id')); $vs_buf .= "<strong>" . _t("Part of") . "</strong>: " . caEditorLink($po_view->request, $t_tour->getLabelForDisplay(), '', 'ca_tours', $vn_tour_id) . "<br/>\n"; } // // Output extra useful info for bundle mappings // if ($vs_table_name === 'ca_bundle_mappings') { if ($t_item->getPrimaryKey()) { $vn_content_table_num = $t_item->get('table_num'); $vs_buf .= "<br/><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "<br/>\n"; $vs_buf .= "<strong>" . _t("Type") . "</strong>: " . $t_item->getChoiceListValue('direction', $t_item->get('direction')) . "<br/>\n"; $vs_buf .= "<strong>" . _t("Target format") . "</strong>: " . $t_item->get('target') . "<br/>\n"; $va_stats = $t_item->getMappingStatistics(); $vs_buf .= "<div><strong>" . _t("Number of groups") . "</strong>: " . $va_stats['groupCount'] . "<br/>\n"; $vs_buf .= "<strong>" . _t("Number of rules") . "</strong>: " . $va_stats['ruleCount'] . "<br/>\n"; $vs_buf .= "</div>\n"; } else { if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) { $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "<br/>\n"; $vs_buf .= "<strong>" . _t("Type") . "</strong>: " . $t_item->getChoiceListValue('direction', $po_view->request->getParameter('direction', pString)) . "<br/>\n"; $vs_buf .= "<strong>" . _t("Target format") . "</strong>: " . $po_view->request->getParameter('target', pString) . "<br/>\n"; $vs_buf .= "<div><strong>" . _t("Number of groups") . "</strong>: 0<br/>\n"; $vs_buf .= "<strong>" . _t("Number of rules") . "</strong>: 0</div>\n"; $vs_buf .= "</div>\n"; } } } // // Output extra useful info for client services/commerce orders // if ($vs_table_name === 'ca_commerce_orders') { $o_client_services_config = Configuration::load($po_view->request->config->get('client_services_config')); $va_order_totals = $t_item->getOrderTotals(); if ($va_order_totals['fee'] + $va_order_totals['tax'] + $va_order_totals['shipping'] + $va_order_totals['handling'] + $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees'] != 0) { $vs_currency_symbol = $o_client_services_config->get('currency_symbol'); $vs_buf .= "<table style='margin-left: 10px;'>"; $vs_buf .= "<tr><td><strong>" . _t("Items") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['fee']) . " (" . (int) $va_order_totals['items'] . ")</td></tr>\n"; $vs_buf .= "<tr><td><strong>" . _t("S+H") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['shipping'] + $va_order_totals['handling']) . "</td></tr>\n"; $vs_buf .= "<tr><td><strong>" . _t("Tax") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['tax']) . "</td></tr>\n"; $vs_buf .= "<tr><td><strong>" . _t("Addtl fees") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees']) . "</td></tr>\n"; $vs_buf .= "<tr><td><strong>" . _t("Total") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['fee'] + $va_order_totals['tax'] + $va_order_totals['shipping'] + $va_order_totals['handling'] + $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees']) . "</td></tr>\n"; $vs_buf .= "</table>"; $vs_buf .= "<strong>" . $t_item->getFieldInfo('payment_status', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('payment_status', $t_item->get('payment_status')) . "<br/>\n"; } $vs_buf .= "<br/><strong>" . $t_item->getFieldInfo('order_status', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('order_status', $t_item->get('order_status')) . "<br/>\n"; if ($vs_shipping_date = $t_item->get('shipping_date', array('dateFormat' => 'delimited', 'timeOmit' => true))) { $vs_buf .= "<strong>" . $t_item->getFieldInfo('shipping_date', 'LABEL') . "</strong>: " . $vs_shipping_date; if ($vs_shipped_on_date = $t_item->get('shipped_on_date', array('dateFormat' => 'delimited'))) { $vs_buf .= " (" . _t('shipped %1', $vs_shipped_on_date) . ")"; } else { $vs_buf .= " (" . _t('not shipped') . ")"; } $vs_buf .= "<br/>\n"; } if (($vn_shipping_method = $t_item->get('shipping_method')) && $t_item->getChoiceListValue('shipping_method', $vn_shipping_method) != 'None') { $vs_buf .= "<strong>" . $t_item->getFieldInfo('shipping_method', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('shipping_method', $vn_shipping_method) . "<br/>\n"; } } // // Output configurable additional info from config, if set // if ($vs_additional_info = $po_view->request->config->get("{$vs_table_name}_inspector_additional_info")) { if (is_array($vs_additional_info)) { $vs_buf .= "<br/>"; foreach ($vs_additional_info as $vs_info) { $vs_buf .= caProcessTemplateForIDs($vs_info, $vs_table_name, array($t_item->getPrimaryKey()), array('requireLinkTags' => true)) . "<br/>\n"; } } else { $vs_buf .= "<br/>" . caProcessTemplateForIDs($vs_additional_info, $vs_table_name, array($t_item->getPrimaryKey()), array('requireLinkTags' => true)) . "<br/>\n"; } } // ------------------------------------------------------------------------------------- // Export if ($t_item->getPrimaryKey() && $po_view->request->config->get($vs_table_name . '_show_add_child_control_in_inspector')) { $vb_show_add_child_control = true; if (is_array($va_restrict_add_child_control_to_types = $po_view->request->config->getList($vs_table_name . '_restrict_child_control_in_inspector_to_types')) && sizeof($va_restrict_add_child_control_to_types)) { $t_type_instance = $t_item->getTypeInstance(); if (!in_array($t_type_instance->get('idno'), $va_restrict_add_child_control_to_types) && !in_array($t_type_instance->getPrimaryKey(), $va_restrict_add_child_control_to_types)) { $vb_show_add_child_control = false; } } } if ($po_view->request->user->canDoAction('can_export_' . $vs_table_name) && $t_item->getPrimaryKey() && sizeof(ca_data_exporters::getExporters($t_item->tableNum())) > 0) { $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; text-align: right;" id="caExportItemButton">'; $vs_buf .= _t('Export this %1', mb_strtolower($vs_type_name, 'UTF-8')) . " "; $vs_buf .= "<a class='button' onclick='jQuery(\"#exporterFormList\").show();' style='text-align:right;' href='#'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . "</a>"; $vs_buf .= caFormTag($po_view->request, 'ExportSingleData', 'caExportForm', 'manage/MetadataExport', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true)); $vs_buf .= "<div id='exporterFormList'>"; $vs_buf .= ca_data_exporters::getExporterListAsHTMLFormElement('exporter_id', $t_item->tableNum(), array('id' => 'caExporterList'), array('width' => '120px')); $vs_buf .= caHTMLHiddenInput('item_id', array('value' => $t_item->getPrimaryKey())); $vs_buf .= caFormSubmitLink($po_view->request, _t('Export') . " ›", "button", "caExportForm"); $vs_buf .= "</div>\n"; $vs_buf .= "</form>"; $vs_buf .= "</div>"; $vs_buf .= "<script type='text/javascript'>"; $vs_buf .= "jQuery(document).ready(function() {"; $vs_buf .= "jQuery(\"#exporterFormList\").hide();"; $vs_buf .= "});"; $vs_buf .= "</script>"; } $vs_buf .= "</div></h4>\n"; $vs_buf .= "<script type='text/javascript'>\n\t\t\tvar inspectorCookieJar = jQuery.cookieJar('caCookieJar');"; if ($t_item->getPrimaryKey()) { if ($vs_more_info) { $vs_buf .= "\t\t\t\n\t\t\tif (inspectorCookieJar.get('inspectorMoreInfoIsOpen') == undefined) {\t\t// default is to have info open\n\t\t\t\tinspectorCookieJar.set('inspectorMoreInfoIsOpen', 1);\n\t\t\t}\n\t\t\tif (inspectorCookieJar.get('inspectorMoreInfoIsOpen') == 1) {\n\t\t\t\tjQuery('#inspectorInfo').toggle(0);\n\t\t\t\tjQuery('#inspectorMoreInfo').html('" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_COLLAPSE__)) . "');\n\t\t\t}\n\t\t\n\t\t\tjQuery('#inspectorMoreInfo').click(function() {\n\t\t\t\tjQuery('#inspectorInfo').slideToggle(350, function() { \n\t\t\t\t\tinspectorCookieJar.set('inspectorMoreInfoIsOpen', (this.style.display == 'block') ? 1 : 0); \n\t\t\t\t\tjQuery('#inspectorMoreInfo').html((this.style.display == 'block') ? '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_COLLAPSE__)) . "' : '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_INFO2__)) . "');\n\t\t\t\t\tcaResizeSideNav();\n\t\t\t\t}); \n\t\t\t\treturn false;\n\t\t\t});\n\t\t"; } if (sizeof($va_reps)) { $vs_buf .= "\n\t\tif (inspectorCookieJar.get('inspectorShowMediaIsOpen') == undefined) {\t\t// default is to have media open\n\t\t\tinspectorCookieJar.set('inspectorShowMediaIsOpen', 1);\n\t\t}\n\t\t\n\t\tif (inspectorCookieJar.get('inspectorShowMediaIsOpen') == 1) {\n\t\t\tjQuery('#inspectorMedia').toggle();\n\t\t}\n\t\n\t\tjQuery('#caColorbox').on('click', function(e) {\n\t\t\tif (e.altKey) {\n\t\t\t\tjQuery('#inspectorMedia').slideToggle(200, function() { \n\t\t\t\t\tinspectorCookieJar.set('inspectorShowMediaIsOpen', (this.style.display == 'block') ? 1 : 0); \n\t\t\t\t\t\tcaResizeSideNav();\n\t\t\t\t}); \n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\t\t\t\t"; } } $vs_buf .= "</script>\n"; } $o_app_plugin_manager = new ApplicationPluginManager(); $va_hookAppend = $o_app_plugin_manager->hookAppendToEditorInspector(array("t_item" => $t_item)); if (is_string($va_hookAppend["caEditorInspectorAppend"])) { $vs_buf .= $va_hookAppend["caEditorInspectorAppend"]; } return $vs_buf; }
/** * Formats communication for display in message window in Pawtucket * * @param RequestHTTP $po_request * @param array $pa_data * @param array $pa_options * viewContentDivID = * replyButton = * * @return string */ function caClientServicesFormatMessagePawtucket($po_request, $pa_data, $pa_options = null) { $vs_buf = "<div class='caClientCommunicationsMessage'>"; if (isset($pa_options['replyButton']) && $pa_options['replyButton']) { $vs_buf .= "<div id='reply'>" . $pa_options['replyButton'] . "</div>"; } $vs_buf .= "<div class='caClientCommunicationsMessageFrom'><span class='caClientCommunicationsMessageHeading'>" . _t('From') . ":</span> " . caClientServicesGetSenderName($pa_data) . "</div>"; $vs_buf .= "<div class='caClientCommunicationsMessageDate'><span class='caClientCommunicationsMessageHeading'>" . _t("Date") . ": </span>" . caGetLocalizedDate($pa_data['created_on'], array('dateFormat' => 'delimited')) . "</div>"; $vs_buf .= "<div class='caClientCommunicationsMessageSubject'><span class='caClientCommunicationsMessageHeading'>" . _t('Subject') . ":</span> " . $pa_data['subject'] . "</div>"; $vs_buf .= "<div class='caClientCommunicationsMessageText'>" . nl2br($pa_data['message']) . "</div>"; $vs_buf .= "</div>\n"; return $vs_buf; }
<?php $vn_start = 0; ?> <page backtop="50px"> <?php if ($this->request->config->get('report_header_enabled')) { ?> <page_header> <div id='pageHeader'> <?php if (file_exists($this->request->getThemeDirectoryPath() . "/graphics/logos/" . $this->request->config->get('report_img'))) { print '<img src="' . $this->request->getThemeDirectoryPath() . '/graphics/logos/' . $this->request->config->get('report_img') . '"/>'; } if ($this->request->config->get('report_show_timestamp')) { print "<span class='headerText'>" . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "</span>"; } if ($this->request->config->get('report_show_number_results')) { print "<span class='headerText'>" . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</span>"; } if ($this->request->config->get('report_show_search_term')) { print "<span class='headerText'>" . $this->getVar('criteria_summary_truncated') . "</span>"; } print "<span class='pagingText'>" . _t("Page [%1]/[%2]", "[page_cu]", "[page_nb]") . "</span>"; ?> </div> </page_header> <table class="listtable" width="100%" border="0" cellpadding="0" cellspacing="0" align="center"> <?php
</tr> <?php } foreach ($va_orders as $vn_id => $va_order) { ?> <tr class='caClientOrderHistoryRow'> <td><?php print caNavLink($this->request, $va_order['order_number'], '', 'client/orders', 'OrderEditor', 'Edit', array('order_id' => $va_order['order_id'])); ?> </td> <td><?php print $va_order['billing_fname'] . ' ' . $va_order['billing_lname'] . " (" . $va_order['billing_email'] . ")"; ?> </td> <td><?php print caGetLocalizedDate($va_order['created_on']); ?> </td> <td><?php print $va_order['fee']; ?> </td> <td><?php print $va_order['order_status']; ?> </td> </tr> <?php } } }
/** * */ public function Get() { $ps_query = $this->request->getParameter('term', pString); $o_search = new ObjectSearch(); $qr_res = $o_search->search($ps_query); $va_object_ids = array(); while ($qr_res->nextHit()) { $va_object_ids[$qr_res->get('object_id')] = false; } if (sizeof($va_object_ids)) { // get checked out items $o_db = new Db(); $qr_checked_out_items = $o_db->query("\n\t\t\t\t\tSELECT DISTINCT i.object_id, i.loan_due_date\n\t\t\t\t\tFROM ca_commerce_order_items i\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ti.loan_return_date IS NULL and i.loan_checkout_date > 0 AND i.object_id IN (?)\n\t\t\t\t", array(array_keys($va_object_ids))); while ($qr_checked_out_items->nextRow()) { $va_object_ids[$qr_checked_out_items->get('object_id')] = $qr_checked_out_items->get('loan_due_date'); } $t_object = new ca_objects(); $qr_res = $t_object->makeSearchResult('ca_objects', array_keys($va_object_ids)); $va_items = caProcessRelationshipLookupLabel($qr_res, $t_object, array()); foreach ($va_items as $vn_object_id => $va_object) { if ((int) $va_object_ids[$vn_object_id] > 0) { $vs_due_date_for_display = caGetLocalizedDate($va_object_ids[$vn_object_id], array('format' => 'delimited', 'timeOmit' => true)); $va_items[$vn_object_id]['label'] .= ' [<em>' . _t('on loan through %1', $vs_due_date_for_display) . '</em>]'; $va_items[$vn_object_id]['due_date'] = $va_object_ids[$vn_object_id]; $va_items[$vn_object_id]['due_date_display'] = $vs_due_date_for_display; } } } if (!is_array($va_items)) { $va_items = array(); } if (!sizeof($va_items)) { // nothing found $va_items[0] = array('label' => _t('No matches found'), 'type_id' => null, 'object_id' => 0); } $this->view->setVar('object_list', $va_items); $this->view->setVar('object_id_list', $va_object_ids); return $this->render('ajax_object_list_html.php'); }
/** * */ public function getLoanReturnDates() { if (!($vn_order_id = $this->getPrimaryKey())) { return null; } $o_db = $this->getDb(); $qr_res = $o_db->query("\n\t\t\tSELECT min(loan_return_date) mindate, max(loan_return_date) maxdate\n\t\t\tFROM ca_commerce_order_items\n\t\t\tWHERE order_id = ?\n\t\t", (int) $vn_order_id); if ($qr_res->nextRow()) { $vn_min = $qr_res->get('mindate'); $vn_max = $qr_res->get('maxdate'); if (!$vn_min) { $vn_min = $vn_max; } if (!$vn_max) { $vn_max = $vn_min; } if (!$vn_min || !$vn_max) { return null; } return array('min' => caGetLocalizedDate($vn_min, array('dateFormat' => 'delimited')), 'max' => caGetLocalizedDate($vn_max, array('dateFormat' => 'delimited')), 'min_raw' => $vn_min, 'max_raw' => $vn_max, 'range' => caGetLocalizedDateRange($vn_min, $vn_max, array('timeOmit' => true))); } return null; }
break; case 'order_status': $vs_display_value = $t_order->getChoiceListValue('order_status', $va_order[$vs_column_code]); $vs_size_attr = ' width="70"'; break; case 'total': $vs_display_value = $vs_currency_symbol . sprintf("%4.2f", $va_order['order_total']); $vs_size_attr = ' width="70"'; break; case 'shipping': $vs_display_value = _t('Method: %1', $va_order['shipping_method']) . "<br/><br/>\n"; if ($va_order['shipping_date']) { $vs_display_value .= _t('Ship date: %1', caGetLocalizedDate($va_order['shipping_date'], array('timeOmit' => true, 'dateFormat' => 'delimited'))) . "<br/><br/>\n"; } if ($va_order['shipped_on_date']) { $vs_display_value .= _t('Shipped on: %1', caGetLocalizedDate($va_order['shipped_on_date'], array('timeOmit' => true, 'dateFormat' => 'delimited'))) . "<br/><br/>\n"; } $vs_size_attr = ' width="90"'; break; default: $vs_display_value = $va_order[$vs_column_code]; $vs_size_attr = ' width="70"'; break; } print "<td{$vs_size_attr}>" . (strlen($vs_display_value) > 1200 ? strip_tags(substr($vs_display_value, 0, 1197)) . "..." : $vs_display_value) . "</td>"; $vn_count++; if ($vn_count >= $vn_start + 8) { break; } } ?>
/** * * * @param string $ps_source * @param array $pa_options * @return bool */ public function nextRow() { if (!$this->opo_rows) { return false; } if ($this->opn_current_row > 0) { $this->opo_rows->next(); } $this->opn_current_row++; if (!$this->opo_rows->valid()) { return false; } if ($o_row = $this->opo_rows->current()) { $this->opa_row_buf = array(null); $o_cells = $o_row->getCellIterator(); $o_cells->setIterateOnlyExistingCells(false); $va_row = array(); $vb_val_was_set = false; $vn_col = 0; $vn_last_col_set = null; foreach ($o_cells as $o_cell) { if (PHPExcel_Shared_Date::isDateTime($o_cell)) { if (!($vs_val = caGetLocalizedDate(PHPExcel_Shared_Date::ExcelToPHP(trim((string) $o_cell->getValue()))))) { $vs_val = trim((string) $o_cell->getValue()); } $this->opa_row_buf[] = $vs_val; } else { $this->opa_row_buf[] = $vs_val = trim((string) $o_cell->getValue()); } if ($vs_val) { $vb_val_was_set = true; $vn_last_col_set = $vn_col; } $vn_col++; } if (!$vb_val_was_set) { return $this->nextRow(); } // skip completely blank rows //$this->opa_row_buf = array_slice($this->opa_row_buf, 0, $vn_last_col_set); return $o_row; } return false; }
/** * Import metadata using a mapping * * @param RequestHTTP $po_request The current request * @param string $ps_source A path to a file or directory of files to import * @param string $ps_importer The code of the importer (mapping) to use * @param string $ps_input_format The format of the source data * @param array $pa_options * progressCallback = * reportCallback = * sendMail = * dryRun = * importAllDatasets = * log = log directory path * logLevel = KLogger constant for minimum log level to record. Default is KLogger::INFO. Constants are, in descending order of shrillness: * KLogger::EMERG = Emergency messages (system is unusable) * KLogger::ALERT = Alert messages (action must be taken immediately) * KLogger::CRIT = Critical conditions * KLogger::ERR = Error conditions * KLogger::WARN = Warnings * KLogger::NOTICE = Notices (normal but significant conditions) * KLogger::INFO = Informational messages * KLogger::DEBUG = Debugging messages */ public static function importMetadata($po_request, $ps_source, $ps_importer, $ps_input_format, $pa_options = null) { $va_errors = $va_noticed = array(); $vn_start_time = time(); $o_config = Configuration::load(); if (!ca_data_importers::mappingExists($ps_importer)) { $va_errors['general'] = array('idno' => "*", 'label' => "*", 'errors' => array(_t('Importer %1 does not exist', $ps_importer)), 'status' => 'ERROR'); return false; } $vs_log_dir = caGetOption('log', $pa_options, null); $vs_log_level = caGetOption('logLevel', $pa_options, "INFO"); $vb_import_all_datasets = caGetOption('importAllDatasets', $pa_options, false); $vb_dry_run = caGetOption('dryRun', $pa_options, false); $vn_log_level = BatchProcessor::_logLevelStringToNumber($vs_log_level); if (!isURL($ps_source) && is_dir($ps_source)) { $va_sources = caGetDirectoryContentsAsList($ps_source, true, false, false, false); } else { $va_sources = array($ps_source); } $vn_file_num = 0; foreach ($va_sources as $vs_source) { $vn_file_num++; if (!ca_data_importers::importDataFromSource($vs_source, $ps_importer, array('fileNumber' => $vn_file_num, 'numberOfFiles' => sizeof($va_sources), 'logDirectory' => $o_config->get('batch_metadata_import_log_directory'), 'request' => $po_request, 'format' => $ps_input_format, 'showCLIProgressBar' => false, 'useNcurses' => false, 'progressCallback' => isset($pa_options['progressCallback']) ? $pa_options['progressCallback'] : null, 'reportCallback' => isset($pa_options['reportCallback']) ? $pa_options['reportCallback'] : null, 'logDirectory' => $vs_log_dir, 'logLevel' => $vn_log_level, 'dryRun' => $vb_dry_run, 'importAllDatasets' => $vb_import_all_datasets))) { $va_errors['general'][] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Could not import source %1", $ps_source)), 'status' => 'ERROR'); return false; } else { $va_notices['general'][] = array('idno' => "*", 'label' => "*", 'errors' => array(_t("Imported data from source %1", $ps_source)), 'status' => 'SUCCESS'); //return true; } } $vn_elapsed_time = time() - $vn_start_time; if (isset($pa_options['sendMail']) && $pa_options['sendMail']) { if ($vs_email = trim($po_request->user->get('email'))) { caSendMessageUsingView($po_request, array($vs_email => $po_request->user->get('fname') . ' ' . $po_request->user->get('lname')), __CA_ADMIN_EMAIL__, _t('[%1] Batch metadata import completed', $po_request->config->get('app_display_name')), 'batch_metadata_import_completed.tpl', array('notices' => $va_notices, 'errors' => $va_errors, 'numErrors' => sizeof($va_errors), 'numProcessed' => sizeof($va_notices), 'subjectNameSingular' => _t('row'), 'subjectNamePlural' => _t('rows'), 'startedOn' => caGetLocalizedDate($vn_start_time), 'completedOn' => caGetLocalizedDate(time()), 'elapsedTime' => caFormatInterval($vn_elapsed_time))); } } if (isset($pa_options['sendSMS']) && $pa_options['sendSMS']) { SMS::send($po_request->getUserID(), _t("[%1] Metadata import processing for begun at %2 is complete", $po_request->config->get('app_display_name'), caGetLocalizedDate($vn_start_time))); } return array('errors' => $va_errors, 'notices' => $va_notices, 'processing_time' => caFormatInterval($vn_elapsed_time)); }
* @type fragment * * ---------------------------------------------------------------------- */ $vo_result = $this->getVar('result'); $vn_num_items = (int) $vo_result->numHits(); if ($this->request->config->get('report_header_enabled')) { $vs_footer = '<table class="footerText" style="width: 100%;"><tr>'; if ($this->request->config->get('report_show_search_term')) { $vs_footer .= "<td class='footerText' style='font-family: \"Sans Light\"; font-size: 12px; text-align: center;'>" . $this->getVar('criteria_summary_truncated') . "</td>"; } if ($this->request->config->get('report_show_number_results')) { $vs_footer .= "<td class='footerText' style='font-family: \"Sans Light\"; font-size: 12px; text-align: center;'>" . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</td>"; } if ($this->request->config->get('report_show_timestamp')) { $vs_footer .= "<td class='footerText' style='font-family: \"Sans Light\"; font-size: 12px; text-align: center;'>" . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "</td>"; } $vs_footer .= "</tr></table>"; switch ($this->getVar('PDFRenderer')) { case 'domPDF': ?> <div id='footer'> <?php print $vs_footer; ?> </div> <?php break; case 'PhantomJS': ?>
_p('User'); ?> </th> <th> <?php _p('IP'); ?> </th> </tr> </thead> <tbody> <?php if (is_array($va_log) && sizeof($va_log) > 0) { foreach ($va_log as $vn_i => $va_log_entry) { print "<tr>"; print "<td>" . caGetLocalizedDate($va_log_entry['occurred_on']) . "</td>"; print "<td>" . $va_log_entry['fulfillment_method_display'] . "</td>"; print "<td>" . caEditorLink($this->request, $va_log_entry['item_label'], '', 'ca_objects', $va_log_entry['object_id']) . " (" . $va_log_entry['item_idno'] . ")" . "</td>"; print "<td>" . $va_log_entry['service_display'] . "</td>"; print "<td>" . (is_array($va_log_entry['fulfillment_details']['files']) ? sizeof($va_log_entry['fulfillment_details']['files']) : 0) . "</td>"; print "<td>" . $va_log_entry['fname'] . ' ' . $va_log_entry['lname'] . " (" . $va_log_entry['email'] . ")</td>"; print "<td>" . $va_log_entry['fulfillment_details']['ip_addr'] . "</td>"; print "</tr>"; } } else { print "<tr><td colspan='7' align='center'>" . _t('No fulfillment events') . "</td></tr>\n"; } ?> </tbody> </table> <div class="editorBottomPadding"><!-- empty --></div>
public function ItemList() { if (!$this->opt_order->getPrimaryKey()) { $this->Edit(); return; } $va_items = $this->opt_order->getItems(); foreach ($va_items as $vn_item_id => $va_item) { $va_items[$vn_item_id]['loan_checkout_date'] = $va_items[$vn_item_id]['loan_checkout_date'] ? caGetLocalizedDate($va_items[$vn_item_id]['loan_checkout_date'], array('dateFormat' => 'delimited')) : ''; $va_items[$vn_item_id]['loan_due_date'] = $va_items[$vn_item_id]['loan_due_date'] ? caGetLocalizedDate($va_items[$vn_item_id]['loan_due_date'], array('dateFormat' => 'delimited')) : ''; $va_items[$vn_item_id]['loan_return_date'] = $va_items[$vn_item_id]['loan_return_date'] ? caGetLocalizedDate($va_items[$vn_item_id]['loan_return_date'], array('dateFormat' => 'delimited')) : ''; } $this->view->setVar('order_items', $va_items); $va_service_groups = $this->opo_client_services_config->getAssoc('service_groups'); $va_default_prices = array(); foreach ($va_service_groups as $vs_group => $va_group_info) { foreach ($va_group_info['services'] as $vs_service => $va_service_info) { $va_default_prices[$vs_service] = $va_service_info; } } $this->view->setVar('default_item_prices', $va_default_prices); if (($vn_loan_period_in_days = $this->opo_client_services_config->get('default_library_loan_period')) <= 0) { $vn_loan_period_in_days = 7; } $t_order_item = new ca_commerce_order_items(); $t_order_item->set('loan_checkout_date', time(), array('SET_DIRECT_DATE' => true)); $t_order_item->set('loan_due_date', time() + $vn_loan_period_in_days * 24 * 60 * 60, array('SET_DIRECT_DATE' => true)); $va_default_values = array('loan_checkout_date' => $t_order_item->get('loan_checkout_date', array('dateFormat' => 'delimited', 'timeOmit' => true)), 'loan_due_date' => $t_order_item->get('loan_due_date', array('dateFormat' => 'delimited', 'timeOmit' => true))); $this->view->setVar('t_order_item', $t_order_item); $this->view->setVar('additional_fees', $t_order_item->getAdditionalFeesHTMLFormBundle($this->request, array('config' => $this->opo_client_services_config, 'currency_symbol' => $this->opo_client_services_config->get('currency_symbol'), 'type' => 'L'))); $this->view->setVar('additional_fees_for_new_items', $t_order_item->getAdditionalFeesHTMLFormBundle($this->request, array('config' => $this->opo_client_services_config, 'currency_symbol' => $this->opo_client_services_config->get('currency_symbol'), 'type' => 'L'))); $this->view->setVar('additional_fee_codes', $va_additional_fee_codes = $this->opo_client_services_config->getAssoc('additional_loan_fees')); foreach ($va_additional_fee_codes as $vs_code => $va_info) { $va_default_values['ADDITIONAL_FEE_' . $vs_code] = $va_info['default_cost']; } $this->view->setVar('default_values', $va_default_values); $this->render('order_item_list_html.php'); }
print $va_exporter['label']; ?> </td> <td> <?php print $va_exporter['exporter_code']; ?> </td> <td> <?php print $va_exporter['exporter_type']; ?> </td> <td> <?php print caGetLocalizedDate($va_exporter['last_modified_on'], array('dateFormat' => 'delimited')); ?> </td> <td> <?php print caNavButton($this->request, __CA_NAV_BUTTON_DELETE__, _t("Delete"), '', 'manage', 'MetadataExport', 'Delete', array('exporter_id' => $va_exporter['exporter_id']), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'use_class' => 'list-button', 'no_background' => true, 'dont_show_content' => true)); ?> <?php /*print caNavButton($this->request, __CA_NAV_BUTTON_GO__, _t("Export data"), '', 'manage', 'MetadataExport', 'Run', array('exporter_id' => $va_exporter['exporter_id']), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'use_class' => 'list-button', 'no_background' => true, 'dont_show_content' => true));*/ ?> </td> </tr> <?php } ?> </tbody>
/** * Get next row from file * * @return bool Returns true if next row can be returned, false if at end of file */ public function nextRow() { $this->opa_current_row = array(); if ($this->ops_type == 'xlsx') { // // Parse Excel // if ($this->opn_current_row > 0) { $this->opr_file->next(); } $this->opn_current_row++; if (!$this->opr_file->valid()) { return false; } if ($o_row = $this->opr_file->current()) { $this->opa_current_row = array(); $o_cells = $o_row->getCellIterator(); $o_cells->setIterateOnlyExistingCells(false); $va_row = array(); $vb_val_was_set = false; $vn_col = 0; $vn_last_col_set = null; foreach ($o_cells as $o_cell) { if (PHPExcel_Shared_Date::isDateTime($o_cell)) { if (!($vs_val = caGetLocalizedDate(PHPExcel_Shared_Date::ExcelToPHP(trim((string) $o_cell->getValue()))))) { if (!($vs_val = trim(PHPExcel_Style_NumberFormat::toFormattedString((string) $o_cell->getValue(), 'YYYY-MM-DD')))) { $vs_val = trim((string) $o_cell->getValue()); } } $this->opa_current_row[] = $vs_val; } else { $this->opa_current_row[] = $vs_val = trim((string) $o_cell->getValue()); } if (strlen($vs_val) > 0) { $vb_val_was_set = true; $vn_last_col_set = $vn_col; } $vn_col++; if ($vn_col > 255) { break; } // max 255 columns; some Excel files have *thousands* of "phantom" columns } return $this->opa_current_row; } //} } else { // // Parse text // $vn_state = 0; $vb_in_quote = false; $this->opn_current_row++; while (!feof($this->opr_file)) { $vs_line = ''; while (false !== ($lc = fgetc($this->opr_file))) { if ($lc == "\n" || $lc == "\r") { break; } $vs_line .= $lc; } // skip blank lines (with or without tabs) if (!$vb_in_quote) { if (str_replace("\t", '', $vs_line) == '') { continue; } } $vn_l = mb_strlen($vs_line); for ($vn_i = 0; $vn_i < $vn_l; $vn_i++) { if (sizeof($this->opa_current_row) > 255) { break; } $c = mb_substr($vs_line, $vn_i, 1); switch ($vn_state) { # ----------------------------------- case 0: // start of field $vn_state = 10; if ($c == $this->ops_text_marker) { $vb_in_quote = true; $vs_fld_text = ''; } else { if ($c == $this->ops_delimiter) { // empty fields $this->opa_current_row[] = $vs_fld_text; $vs_fld_text = ''; $vn_state = 0; } else { $vs_fld_text = $c; } } break; # ----------------------------------- # ----------------------------------- case 10: // in field if ($vb_in_quote) { if ($c == $this->ops_text_marker) { if (mb_substr($vs_line, $vn_i + 1, 1) != '"') { // is *not* double quote so leave quoted-ness $vb_in_quote = false; } else { // *is* double quote so treat as single quote in text $vs_fld_text .= $c; // add quote $vn_i++; // skip next quote } break; } else { $vs_fld_text .= $c; break; } } if ($c == $this->ops_delimiter) { $vn_state = 20; // fall through } else { $vs_fld_text .= $c; break; } # ----------------------------------- # ----------------------------------- case 20: // end of field $this->opa_current_row[] = $vs_fld_text; $vs_fld_text = ''; $vn_state = 0; break; # ----------------------------------- } } if ($vb_in_quote) { // add return $vs_fld_text .= "\n"; } else { // output last field if not already output if (strlen($vs_fld_text) > 0) { $this->opa_current_row[] = $vs_fld_text; } return $this->opa_current_row; } } } return false; }
print caGetLocalizedDate($va_order['created_on'], array('dateFormat' => 'delimited')); ?> </td> <td> <?php print $va_order['billing_fname'] . ' ' . $va_order['billing_lname'] . " " . ($va_order['billing_organization'] ? "(" . $va_order['billing_organization'] . ")" : ""); ?> </td> <td> <?php print $va_order['num_items'] == 1 ? _t('%1 item', $va_order['num_items']) : _t('%1 items', $va_order['num_items']); if ($va_order['shipped_on_date']) { print "\n<br/>" . _t('Shipped on %1', caGetLocalizedDate($va_order['shipped_on_date'], array('dateFormat' => 'delimited', 'timeOmit' => true))); } else { if ($va_order['shipping_date']) { print "\n<br/>" . _t('Ships on %1', caGetLocalizedDate($va_order['shipping_date'], array('dateFormat' => 'delimited', 'timeOmit' => true))); } } ?> </td> <td> <?php print $vs_currency_symbol . sprintf("%4.2f", $va_order['order_total_item_fees'] + $va_order['order_total_item_tax'] + $va_order['shipping_cost'] + $va_order['handling_cost']) . " (" . _t('total') . ")"; ?> </td> <td> <?php print $t_order->getChoiceListValue('order_status', $va_order['order_status']); ?> </td> <td>
continue; } print "<th class='displayHeader'>" . (mb_strlen($vs_column_name) > 30 ? strip_tags(mb_substr($vs_column_name, 0, 27)) . "..." : $vs_column_name) . "</th>"; $vn_count++; if ($vn_count >= $vn_start + 7) { break; } } ?> </tr> <?php $i = 0; foreach ($va_items as $vn_i => $va_item) { $vn_object_id = $va_item['object_id']; foreach ($va_date_field_list as $vs_date_field_name) { $va_item[$vs_date_field_name] = $va_item[$vs_date_field_name] ? caGetLocalizedDate($va_item[$vs_date_field_name], array('timeOmit' => true, 'dateFormat' => 'delimited')) : ''; } $i == 2 ? $i = 0 : ""; ?> <tr <?php print $i == 1 ? "class='odd'" : ""; ?> > <td width="10" align="center">☐</td> <?php $vn_count = 0; foreach ($va_display_list as $vs_column_code => $vs_column_name) { // Skip first few columns as needed if ($vn_count < $vn_start) { $vn_count++; continue;
/** * Returns history of client orders. Orders are sorted most recent first. * * @param string $ps_order_type Type of order to return history for. L=loans, O=sales orders. If set to any other value all types of orders will be returned. * @return array List of orders */ public function getClientHistory($ps_order_type) { if (!$this->getPrimaryKey()) { return null; } $vn_object_id = $this->getPrimaryKey(); $ps_order_type = strtoupper($ps_order_type); $va_options = array(); if (!in_array($ps_order_type, array('O', 'L'))) { $ps_order_type = null; } else { $va_options['type'] = $ps_order_type; } $va_orders = ca_commerce_orders::getUsageOfItemInOrders($vn_object_id, $va_options); $va_history = array(); foreach ($va_orders as $vn_id => $va_order) { $va_order['loan_checkout_date_raw'] = $va_order['loan_checkout_date']; $va_order['loan_checkout_date'] = caGetLocalizedDate($va_order['loan_checkout_date'], array('timeOmit' => true, 'dateFormat' => 'delimited')); $va_order['loan_due_date_raw'] = $va_order['loan_due_date']; $va_order['loan_due_date'] = $va_order['loan_due_date'] ? caGetLocalizedDate($va_order['loan_due_date'], array('timeOmit' => true, 'dateFormat' => 'delimited')) : ''; $va_order['loan_return_date_raw'] = $va_order['loan_return_date']; $va_order['loan_return_date'] = $va_order['loan_return_date'] ? caGetLocalizedDate($va_order['loan_return_date'], array('timeOmit' => true, 'dateFormat' => 'delimited')) : ''; $va_order['order_number'] = ca_commerce_orders::generateOrderNumber($va_order['order_id'], $va_order['created_on']); $va_history[$va_order['loan_checkout_date']] = $va_order; } ksort($va_history); return array_reverse($va_history); }
/** * */ public function getItemInfo() { $ps_search = str_replace('"', '', $this->request->getParameter('search', pString)); $va_values = array(); $t_item = new ca_commerce_order_items(); $o_search = new ObjectSearch(); $qr_res = $o_search->search("ca_objects.idno:\"{$ps_search}\""); if (!$qr_res->numHits()) { $qr_res = $o_search->search($ps_search); } $va_object_ids = array(); while ($qr_res->nextHit()) { $va_object_ids[] = (int) $qr_res->get('ca_objects.object_id'); } $va_items = array('search' => $ps_search, 'matches' => array()); if (sizeof($va_object_ids)) { $o_db = new Db(); $qr_items = $o_db->query("\n\t\t\t\t\tSELECT i.item_id, o.order_id\n\t\t\t\t\tFROM ca_commerce_order_items i\n\t\t\t\t\tINNER JOIN ca_commerce_orders AS o ON o.order_id = i.order_id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tobject_id IN (?) AND o.order_type = 'L' AND i.loan_return_date IS NULL\n\t\t\t\t", array($va_object_ids)); while ($qr_items->nextRow()) { $t_item = new ca_commerce_order_items($qr_items->get('item_id')); $t_order = $t_item->getOrder(); $va_values = $t_item->getFieldValuesArray(); $va_values['user'] = $t_order->getOrderTransactionUserName(); // get object label $t_object = $t_item->getItemObject(); $va_values['object'] = $t_object->get('ca_objects.preferred_labels.name'); $va_values['idno'] = $t_object->get('ca_objects.idno'); // generate display dates $va_values['loan_checkout_date_raw'] = $va_values['loan_checkout_date']; $va_values['loan_checkout_date'] = caGetLocalizedDate($va_values['loan_checkout_date'], array('dateFormat' => 'delimited', 'timeOmit' => true)); $va_values['loan_due_date_raw'] = $va_values['loan_due_date']; $va_values['loan_due_date'] = caGetLocalizedDate($va_values['loan_due_date'], array('dateFormat' => 'delimited', 'timeOmit' => true)); if ($va_values['loan_due_date_raw'] < time()) { $va_values['loan_due_date'] .= " (<em>" . _t("Overdue by %1", caFormatInterval(time() - $va_values['loan_due_date_raw'], 2)) . "</em>)"; } $va_values['order_number'] = $t_order->getOrderNumber(); $va_rep = $t_object->getPrimaryRepresentation(array('thumbnail')); $va_values['thumbnail_tag'] = $va_rep['tags']['thumbnail']; $va_items['matches'][] = $va_values; } } $this->view->setVar('items', $va_items); return $this->render('ajax_order_item_info_json.php'); }
/** * Get date from Excel sheet for given column and row. Convert Excel date to format acceptable by TimeExpressionParser if necessary. * @param PHPExcel_Worksheet $po_sheet The work sheet * @param int $pn_row_num row number (zero indexed) * @param string|int $pm_col either column number (zero indexed) or column letter ('A', 'BC') * @param int $pn_offset Offset to adf to the timestamp (can be used to fix timezone issues or simple to move dates around a little bit) * @return string|null the date, if a value exists */ function caPhpExcelGetDateCellContent($po_sheet, $pn_row_num, $pm_col, $pn_offset = 0) { if (!is_int($pn_offset)) { $pn_offset = 0; } if (!is_numeric($pm_col)) { $pm_col = PHPExcel_Cell::columnIndexFromString($pm_col) - 1; } $o_val = $po_sheet->getCellByColumnAndRow($pm_col, $pn_row_num); $vs_val = trim((string) $o_val); if (strlen($vs_val) > 0) { $vn_timestamp = PHPExcel_Shared_Date::ExcelToPHP(trim((string) $o_val->getValue())) + $pn_offset; if (!($vs_return = caGetLocalizedDate($vn_timestamp, array('dateFormat' => 'iso8601', 'timeOmit' => false)))) { $vs_return = $vs_val; } } else { $vs_return = null; } return $vs_return; }
/** * Return array with list of significant events in object life cycle as configured for * a ca_objects_history editor bundle. * * @param array $pa_bundle_settings The settings for a ca_objects_history editing BUNDLES * @param array $pa_options Array of options. Options include: * noCache = Don't use any cached history data. [Default is false] * currentOnly = Only return history entries dates before or on the current date. [Default is false] * limit = Only return a maximum number of history entries. [Default is null; no limit] * * @return array A list of life cycle events, indexed by historic timestamp for date of occurrrence. Each list value is an array of history entries. * * @used-by ca_objects::getObjectHistoryHTMLFormBundle */ public function getObjectHistory($pa_bundle_settings = null, $pa_options = null) { global $g_ui_locale; if (!is_array($pa_options)) { $pa_options = array(); } if (!is_array($pa_bundle_settings)) { $pa_bundle_settings = array(); } $vs_cache_key = caMakeCacheKeyFromOptions(array_merge($pa_bundle_settings, $pa_options, array('object_id' => $this->getPrimaryKey()))); $pb_no_cache = caGetOption('noCache', $pa_options, false); if (!$pb_no_cache && isset(ca_objects::$s_object_use_cache[$vs_cache_key])) { return ca_objects::$s_object_use_cache[$vs_cache_key]; } $pb_display_label_only = caGetOption('displayLabelOnly', $pa_options, false); $pb_get_current_only = caGetOption('currentOnly', $pa_options, false); $pn_limit = caGetOption('limit', $pa_options, null); $vs_display_template = caGetOption('display_template', $pa_bundle_settings, _t('No template defined')); $vs_history_template = caGetOption('history_template', $pa_bundle_settings, $vs_display_template); $vn_current_date = caDateToHistoricTimestamp(_t('now')); $o_media_coder = new MediaInfoCoder(); // // Get history // $va_history = array(); // Lots if (is_array($va_lot_types = caGetOption('ca_object_lots_showTypes', $pa_bundle_settings, null)) && ($vn_lot_id = $this->get('lot_id'))) { $t_lot = new ca_object_lots($vn_lot_id); if (!$t_lot->get('deleted')) { $va_lot_type_info = $t_lot->getTypeList(); $vn_type_id = $t_lot->get('type_id'); $vs_color = $va_lot_type_info[$vn_type_id]['color']; if (!$vs_color || $vs_color == '000000') { $vs_color = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff'); } $va_dates = array(); $va_date_elements = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null); if (!is_array($va_date_elements) && $va_date_elements) { $va_date_elements = array($va_date_elements); } if (is_array($va_date_elements) && sizeof($va_date_elements)) { foreach ($va_date_elements as $vs_date_element) { $va_dates[] = array('sortable' => $t_lot->get($vs_date_element, array('getDirectDate' => true)), 'display' => $t_lot->get($vs_date_element)); } } if (!sizeof($va_dates)) { $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($t_lot->getCreationTimestamp(null, array('timestampOnly' => true))), 'display' => caGetLocalizedDate($vn_date)); } foreach ($va_dates as $va_date) { if (!$va_date['sortable']) { continue; } if (!in_array($vn_type_id, $va_lot_types)) { continue; } if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) { continue; } $vs_default_display_template = '^ca_object_lots.preferred_labels.name (^ca_object_lots.idno_stub)'; $vs_display_template = $pb_display_label_only ? "" : caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template); $va_history[$va_date['sortable']][] = array('type' => 'ca_object_lots', 'id' => $vn_lot_id, 'display' => $t_lot->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_lot_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_lot_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_lot_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']); } } } // Loans $va_loans = $this->get('ca_loans.loan_id', array('returnAsArray' => true)); if (is_array($va_loan_types = caGetOption('ca_loans_showTypes', $pa_bundle_settings, null)) && is_array($va_loans) && sizeof($va_loans)) { $qr_loans = caMakeSearchResult('ca_loans', $va_loans); $t_loan = new ca_loans(); $va_loan_type_info = $t_loan->getTypeList(); $va_date_elements_by_type = array(); foreach ($va_loan_types as $vn_type_id) { if (!is_array($va_date_elements = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) { $va_date_elements = array($va_date_elements); } if (!$va_date_elements) { continue; } $va_date_elements_by_type[$vn_type_id] = $va_date_elements; } while ($qr_loans->nextHit()) { $vn_loan_id = $qr_loans->get('loan_id'); if ((string) $qr_loans->get('ca_loans.deleted') !== '0') { continue; } // filter out deleted $vn_type_id = $qr_loans->get('type_id'); $va_dates = array(); if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) { foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) { $va_dates[] = array('sortable' => $qr_loans->get("ca_loans.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_loans->get("ca_loans.{$vs_date_element}")); } } if (!sizeof($va_dates)) { $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_loans->get('lastModified')), 'display' => caGetLocalizedDate($vn_date)); } $vs_default_display_template = '^ca_loans.preferred_labels.name (^ca_loans.idno)'; $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template); foreach ($va_dates as $va_date) { if (!$va_date['sortable']) { continue; } if (!in_array($vn_type_id, $va_loan_types)) { continue; } if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) { continue; } $vs_color = $va_loan_type_info[$vn_type_id]['color']; if (!$vs_color || $vs_color == '000000') { $vs_color = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff'); } $va_history[$va_date['sortable']][] = array('type' => 'ca_loans', 'id' => $vn_loan_id, 'display' => $qr_loans->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_loan_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_loan_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_loan_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']); } } } // Movements $va_movements = $this->get('ca_movements.movement_id', array('returnAsArray' => true)); if (is_array($va_movement_types = caGetOption('ca_movements_showTypes', $pa_bundle_settings, null)) && is_array($va_movements) && sizeof($va_movements)) { $qr_movements = caMakeSearchResult('ca_movements', $va_movements); $t_movement = new ca_movements(); $va_movement_type_info = $t_movement->getTypeList(); $va_date_elements_by_type = array(); foreach ($va_movement_types as $vn_type_id) { if (!is_array($va_date_elements = caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) { $va_date_elements = array($va_date_elements); } if (!$va_date_elements) { continue; } $va_date_elements_by_type[$vn_type_id] = $va_date_elements; } while ($qr_movements->nextHit()) { $vn_movement_id = $qr_movements->get('movement_id'); if ((string) $qr_movements->get('ca_movements.deleted') !== '0') { continue; } // filter out deleted $vn_type_id = $qr_movements->get('type_id'); $va_dates = array(); if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) { foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) { $va_dates[] = array('sortable' => $qr_movements->get("ca_movements.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_movements->get("ca_movements.{$vs_date_element}")); } } if (!sizeof($va_dates)) { $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_movements->get('lastModified')), 'display' => caGetLocalizedDate($vn_date)); } $vs_default_display_template = '^ca_movements.preferred_labels.name (^ca_movements.idno)'; $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template); foreach ($va_dates as $va_date) { if (!$va_date['sortable']) { continue; } if (!in_array($vn_type_id, $va_movement_types)) { continue; } if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) { continue; } $vs_color = $va_movement_type_info[$vn_type_id]['color']; if (!$vs_color || $vs_color == '000000') { $vs_color = caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff'); } $va_history[$va_date['sortable']][] = array('type' => 'ca_movements', 'id' => $vn_movement_id, 'display' => $qr_movements->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_movement_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_movement_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_movement_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']); } } } // Occurrences $va_occurrences = $this->get('ca_occurrences.occurrence_id', array('returnAsArray' => true)); if (is_array($va_occurrence_types = caGetOption('ca_occurrences_showTypes', $pa_bundle_settings, null)) && is_array($va_occurrences) && sizeof($va_occurrences)) { $qr_occurrences = caMakeSearchResult('ca_occurrences', $va_occurrences); $t_occurrence = new ca_occurrences(); $va_occurrence_type_info = $t_occurrence->getTypeList(); $va_date_elements_by_type = array(); foreach ($va_occurrence_types as $vn_type_id) { if (!is_array($va_date_elements = caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) { $va_date_elements = array($va_date_elements); } if (!$va_date_elements) { continue; } $va_date_elements_by_type[$vn_type_id] = $va_date_elements; } while ($qr_occurrences->nextHit()) { $vn_occurrence_id = $qr_occurrences->get('occurrence_id'); if ((string) $qr_occurrences->get('ca_occurrences.deleted') !== '0') { continue; } // filter out deleted $vn_type_id = $qr_occurrences->get('type_id'); $va_dates = array(); if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) { foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) { $va_dates[] = array('sortable' => $qr_occurrences->get("ca_occurrences.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_occurrences->get("ca_occurrences.{$vs_date_element}")); } } if (!sizeof($va_dates)) { $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_occurrences->get('lastModified')), 'display' => caGetLocalizedDate($vn_date)); } $vs_default_display_template = '^ca_occurrences.preferred_labels.name (^ca_occurrences.idno)'; $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template); foreach ($va_dates as $va_date) { if (!$va_date['sortable']) { continue; } if (!in_array($vn_type_id, $va_occurrence_types)) { continue; } if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) { continue; } $vs_color = $va_occurrence_type_info[$vn_type_id]['color']; if (!$vs_color || $vs_color == '000000') { $vs_color = caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff'); } $va_history[$va_date['sortable']][] = array('type' => 'ca_occurrences', 'id' => $vn_occurrence_id, 'display' => $qr_occurrences->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_occurrence_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_occurrence_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_occurrence_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']); } } } // Storage locations $va_locations = $this->get('ca_objects_x_storage_locations.relation_id', array('returnAsArray' => true)); if (is_array($va_location_types = caGetOption('ca_storage_locations_showRelationshipTypes', $pa_bundle_settings, null)) && is_array($va_locations) && sizeof($va_locations)) { $t_location = new ca_storage_locations(); $va_location_type_info = $t_location->getTypeList(); $vs_name_singular = $t_location->getProperty('NAME_SINGULAR'); $vs_name_plural = $t_location->getProperty('NAME_PLURAL'); $qr_locations = caMakeSearchResult('ca_objects_x_storage_locations', $va_locations); $vs_default_display_template = '^ca_storage_locations.parent.preferred_labels.name ➜ ^ca_storage_locations.preferred_labels.name (^ca_storage_locations.idno)'; $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption('ca_storage_locations_displayTemplate', $pa_bundle_settings, $vs_default_display_template); Debug::msg($qr_locations->numHits()); while ($qr_locations->nextHit()) { $vn_location_id = $qr_locations->get('ca_objects_x_storage_locations.location_id'); if ((string) $qr_locations->get('ca_storage_locations.deleted') !== '0') { continue; } // filter out deleted $va_date = array('sortable' => $qr_locations->get("ca_objects_x_storage_locations.effective_date", array('getDirectDate' => true)), 'display' => $qr_locations->get("ca_objects_x_storage_locations.effective_date")); if (!$va_date['sortable']) { continue; } if (!in_array($vn_rel_type_id = $qr_locations->get('ca_objects_x_storage_locations.type_id'), $va_location_types)) { continue; } $vn_type_id = $qr_locations->get('ca_storage_locations.type_id'); if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) { continue; } $vs_color = $va_location_type_info[$vn_type_id]['color']; if (!$vs_color || $vs_color == '000000') { $vs_color = caGetOption("ca_storage_locations_color", $pa_bundle_settings, 'ffffff'); } $va_history[$va_date['sortable']][] = array('type' => 'ca_storage_locations', 'id' => $vn_location_id, 'relation_id' => $qr_locations->get('relation_id'), 'display' => $qr_locations->getWithTemplate("<unit relativeTo='ca_storage_locations'>{$vs_display_template}</unit>"), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_location_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_name_singular, 'typename_plural' => $vs_name_plural, 'type_id' => $vn_type_id, 'rel_type_id' => $vn_rel_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_name_singular . '</div>') . '</div></div>', 'date' => $va_date['display']); } } // Deaccession if ($this->get('is_deaccessioned') && caGetOption('showDeaccessionInformation', $pa_bundle_settings, false)) { $vs_color = caGetOption('deaccession_color', $pa_bundle_settings, 'cccccc'); $vn_date = $this->get('deaccession_date', array('getDirectDate' => true)); $vs_default_display_template = '^ca_objects.deaccession_notes'; $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption('deaccession_displayTemplate', $pa_bundle_settings, $vs_default_display_template); if (!($pb_get_current_only && $vn_date > $vn_current_date)) { $va_history[$vn_date][] = array('type' => 'ca_objects_deaccession', 'id' => $this->getPrimaryKey(), 'display' => $this->getWithTemplate("<unit>{$vs_display_template}</unit>"), 'color' => $vs_color, 'icon_url' => '', 'typename_singular' => $vs_name_singular = _t('deaccession'), 'typename_plural' => $vs_name_plural = _t('deaccessions'), 'type_id' => null, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon"><div class="caUseHistoryIconText">' . $vs_name_singular . '</div>' . '</div></div>', 'date' => $this->get('deaccession_date')); } } ksort($va_history); $va_history = array_reverse($va_history); if ($pn_limit > 0) { $va_history = array_slice($va_history, 0, $pn_limit); } if (sizeof(ca_objects::$s_object_use_cache[$vs_cache_key]) > 100) { ca_objects::$s_object_use_cache[$vs_cache_key] = array_slice(ca_objects::$s_object_use_cache[$vs_cache_key], 0, 50); } return ca_objects::$s_object_use_cache[$vs_cache_key] = $va_history; }
$vn_start = 0; while ($vn_start < sizeof($va_display_list) - 1) { ?> <page> <?php if ($this->request->config->get('report_header_enabled')) { ?> <div id='pageHeader' > <img src="<?php print $this->request->getThemeDirectoryPath() . "/graphics/logos/" . $this->request->config->get('report_img'); ?> "/> <?php if ($this->request->config->get('report_show_timestamp')) { print "<span class='headerText'>" . caGetLocalizedDate() . "</span>"; } if ($this->request->config->get('report_show_number_results')) { print "<span class='headerText'>" . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</span>"; } if ($this->request->config->get('report_show_search_term')) { print "<span class='headerText'>" . $this->getVar('criteria_summary_truncated') . "</span>"; } print "<span class='pagingText'>" . _t("Page [[page_cu]]/[[page_nb]]") . "</span>"; ?> </div> <?php } ?> <table class="listtable" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr>
table { border: 1px solid #828282; color: #000000; text-wrap: normal; font-size: 11px; margin:15px; font-family: Helvetica, sans-serif;} table td { border: 1px solid #828282; color: #000000; text-wrap: normal; width: 135px; height: 120px; padding: 5px; font-size: 11px; font-family: Helvetica, sans-serif;} tr.odd { background-color: #f2f2f2; } .pageHeader { background-color: #FFFFFF; margin: 0px 10px 20px 10px; padding: 0px 5px 20px 5px; width: 100%; height: 45px; font-family: Helvetica, sans-serif; } .pageHeader img{ vertical-align:middle; } .headerText { text-align:right; color: #000; margin: -50px 0px 10px 20px; font-family: Helvetica, sans-serif; font-size: 11px; } --> </style> </HEAD> <BODY> <div class='pageHeader'> <?php if (file_exists($this->request->getThemeDirectoryPath() . '/assets/pawtucket/graphics/ca_nav_logo300.png')) { print '<img src="' . $this->request->getThemeDirectoryPath() . '/assets/pawtucket/graphics/ca_nav_logo300.png"/>'; } print "<div class='headerText'>" . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "<br/>" . mb_substr($vs_title, 0, 30) . (mb_strlen($vs_title) > 30 ? '...' : '') . ", " . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</div>"; ?> </div> <table width="100%" cellpadding="0" cellspacing="0"> <?php $i = 0; foreach ($va_items as $va_item) { $vn_object_id = $va_item['object_id']; if ($i == 0) { print "<tr>"; } print "<td align='center'>"; print file_exists(str_replace($this->request->config->get("site_host"), $this->request->config->get("ca_base_dir"), $va_item["representation_url_thumbnail"])) ? $va_item["representation_tag_thumbnail"] : ""; print "<br/>" . $va_item["idno"] . "<br/>"; print $va_item["name"];