/** * Returns HTML form bundle (for use in a form) for non-preferred labels attached to this row * * @param HTTPRequest $po_request The current request * @param string $ps_form_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Array of options. Supported options are * noCache = If set to true then label cache is bypassed; default is true * * @return string Rendered HTML bundle */ public function getNonPreferredLabelHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null) { global $g_ui_locale; if (!($t_label = $this->_DATAMODEL->getInstanceByTableName($this->getLabelTableName(), true))) { return null; } $vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $po_request->getViewsDirectoryPath(); $o_view = new View($po_request, "{$vs_view_path}/bundles/"); if (!is_array($pa_options)) { $pa_options = array(); } if (!isset($pa_options['dontCache'])) { $pa_options['dontCache'] = true; } if (!is_array($pa_bundle_settings)) { $pa_bundle_settings = array(); } $o_view->setVar('id_prefix', $ps_form_name . '_NPref'); $o_view->setVar('placement_code', $ps_placement_code); // pass placement code $o_view->setVar('labels', $va_labels = $this->getNonPreferredLabels(null, $pa_options['dontCache'])); $o_view->setVar('t_subject', $this); $o_view->setVar('t_label', $t_label); $o_view->setVar('add_label', isset($pa_bundle_settings['add_label'][$g_ui_locale]) ? $pa_bundle_settings['add_label'][$g_ui_locale] : null); $o_view->setVar('graphicsPath', $pa_options['graphicsPath']); unset($pa_bundle_settings['label']); $o_view->setVar('settings', $pa_bundle_settings); $va_new_labels_to_force_due_to_error = array(); $va_inital_values = array(); if ($this->getPrimaryKey()) { // generate list of inital form values; the label bundle Javascript call will // use the template to generate the initial form if (sizeof($va_labels)) { foreach ($va_labels as $vn_item_id => $va_labels_by_locale) { foreach ($va_labels_by_locale as $vn_locale_id => $va_label_list) { foreach ($va_label_list as $va_label) { $va_inital_values[$va_label['label_id']] = $va_label; } } } } } else { if ($this->numErrors()) { foreach ($_REQUEST as $vs_key => $vs_value) { if (!preg_match('/' . $ps_placement_code . $ps_form_name . '_NPref' . 'locale_id_new_([\\d]+)/', $vs_key, $va_matches)) { continue; } $vn_c = intval($va_matches[1]); if ($vn_new_label_locale_id = $po_request->getParameter($ps_placement_code . $ps_form_name . '_NPref' . 'locale_id_new_' . $vn_c, pString)) { if (is_array($va_label_values = $this->getLabelUIValuesFromRequest($po_request, $ps_placement_code . $ps_form_name, 'new_' . $vn_c, true))) { $va_label_values['locale_id'] = $vn_new_label_locale_id; $va_new_labels_to_force_due_to_error[] = $va_label_values; } } } } } if (is_array($this->opa_failed_nonpreferred_label_inserts) && sizeof($this->opa_failed_nonpreferred_label_inserts)) { $va_new_labels_to_force_due_to_error = $this->opa_failed_preferred_label_inserts; } $o_view->setVar('new_labels', $va_new_labels_to_force_due_to_error); $o_view->setVar('label_initial_values', $va_inital_values); $o_view->setVar('batch', (bool) (isset($pa_options['batch']) && $pa_options['batch'])); return $o_view->render($this->getLabelTableName() . '_nonpreferred.php'); }
/** * Returns HTML form bundle (for use in a ca_object_representations editor form) for captions * * @param HTTPRequest $po_request The current request * @param string $ps_form_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Array of options. Supported options are * noCache = If set to true then label cache is bypassed; default is true * * @return string Rendered HTML bundle */ public function getCaptionHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null) { global $g_ui_locale; $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/'); if (!is_array($pa_options)) { $pa_options = array(); } $o_view->setVar('id_prefix', $ps_form_name); $o_view->setVar('placement_code', $ps_placement_code); // pass placement code $o_view->setVar('settings', $pa_bundle_settings); $o_view->setVar('t_subject', $this); $o_view->setVar('t_caption', new ca_object_representation_captions()); //$va_media_info = $this->getMediaInfo('media'); //if (!is_array($va_media_info)) { $va_media_info = array('original' => array('PROPERTIES' => array('typename' => null))); } //$o_view->setVar('representation_typename', $va_media_info['original']['PROPERTIES']['typename']); $o_view->setVar('representation_num_caption_files', $this->numCaptionFiles()); $o_view->setVar('initialValues', $this->getCaptionFileList()); return $o_view->render('ca_object_representation_captions.php'); }
/** * Returns HTML form bundle (for use in a ca_object_representations editor form) for media * * @param HTTPRequest $po_request The current request * @param string $ps_form_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Array of options. Supported options are * noCache = If set to true then label cache is bypassed; default is true * * @return string Rendered HTML bundle */ public function getCommerceOrderHistoryHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null) { global $g_ui_locale; $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/'); if (!is_array($pa_options)) { $pa_options = array(); } $o_view->setVar('id_prefix', $ps_form_name . '_commerce_order_history'); $o_view->setVar('placement_code', $ps_placement_code); // pass placement code $o_view->setVar('settings', $pa_bundle_settings); $o_view->setVar('t_subject', $this); return $o_view->render('ca_commerce_order_history.php'); }
/** * Returns HTML form bundle for component listing * * @param HTTPRequest $po_request The current request * @param string $ps_form_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Array of options. Options include: * noCache = If set to true then label cache is bypassed. [Default = true] * * @return string Rendered HTML bundle */ public function getComponentListHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null) { global $g_ui_locale; $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/'); if (!is_array($pa_options)) { $pa_options = array(); } $o_view->setVar('id_prefix', $ps_form_name); $o_view->setVar('placement_code', $ps_placement_code); // pass placement code $o_view->setVar('settings', $pa_bundle_settings); $o_view->setVar('add_label', isset($pa_bundle_settings['add_label'][$g_ui_locale]) ? $pa_bundle_settings['add_label'][$g_ui_locale] : null); $o_view->setVar('t_subject', $this); return $o_view->render('ca_objects_components_list.php'); }
/** * Returns HTML form bundle for additional fees * * @param HTTPRequest $po_request The current request * @param array $pa_options Array of options. Supported options are * noCache = If set to true then label cache is bypassed; default is true * type = "O" = order; "L" = loan; default is "O" * * @return string Rendered HTML bundle */ public function getAdditionalFeesHTMLFormBundle($po_request, $pa_options = null) { global $g_ui_locale; $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/'); if (!is_array($pa_options)) { $pa_options = array(); } $o_view->setVar('options', $pa_options); $o_view->setVar('fee_list', isset($pa_options['type']) && $pa_options['type'] == 'L' ? $this->opo_client_services_config->getAssoc('additional_loan_fees') : $this->opo_client_services_config->getAssoc('additional_order_item_fees')); $o_view->setVar('t_subject', $this); return $o_view->render('ca_commerce_order_items_additional_fees.php'); }
/** * Returns HTML form bundle for location contents * * @param HTTPRequest $po_request The current request * @param string $ps_form_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Array of options. Options include: * None yet. * * @return string Rendered HTML bundle */ public function getLocationContentsHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null) { require_once __CA_MODELS_DIR__ . "/ca_movements.php"; require_once __CA_MODELS_DIR__ . "/ca_movements_x_objects.php"; require_once __CA_MODELS_DIR__ . "/ca_objects_x_storage_locations.php"; global $g_ui_locale; $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/'); if (!is_array($pa_options)) { $pa_options = array(); } $vs_display_template = caGetOption('displayTemplate', $pa_bundle_settings, _t('No template defined')); $o_view->setVar('id_prefix', $ps_form_name); $o_view->setVar('placement_code', $ps_placement_code); // pass placement code $o_view->setVar('settings', $pa_bundle_settings); $o_view->setVar('add_label', isset($pa_bundle_settings['add_label'][$g_ui_locale]) ? $pa_bundle_settings['add_label'][$g_ui_locale] : null); $o_view->setVar('t_subject', $this); $o_view->setVar('mode', $vs_mode = caGetOption('locationTrackingMode', $pa_bundle_settings, 'ca_movements')); switch ($vs_mode) { case 'ca_storage_locations': // Get current storage locations $o_view->setVar('t_subject_rel', new ca_objects_x_storage_locations()); // Get current objects for location $va_object_ids = $this->getRelatedItems('ca_objects', array('idsOnly' => true)); if (is_array($va_object_ids) && sizeof($va_object_ids)) { // check each object for current location // ... then get the list of objects for which the *current* movement is one of ours $t_object = new ca_objects(); $va_current_locations_ids = $t_object->getRelatedItems('ca_storage_locations', array('idsOnly' => false, 'showCurrentOnly' => true, 'row_ids' => $va_object_ids)); $va_object_rels = array(); foreach ($va_current_locations_ids as $vn_relation_id => $va_location_info) { if ($va_location_info['location_id'] == $this->getPrimaryKey()) { $va_object_rels[] = $vn_relation_id; } } $o_view->setVar('qr_result', sizeof($va_object_rels) ? caMakeSearchResult('ca_objects_x_storage_locations', $va_object_rels) : null); } break; case 'ca_movements': default: // Get current movements for location $va_movement_ids = $this->getRelatedItems('ca_movements', array('idsOnly' => true)); if (is_array($va_movement_ids) && sizeof($va_movement_ids)) { // get list of objects on these movements... $t_movement = new ca_movements(); $va_object_ids = $t_movement->getRelatedItems('ca_objects', array('idsOnly' => true, 'showCurrentOnly' => true, 'row_ids' => $va_movement_ids)); // ... then get the list of objects for which the *current* movement is one of ours $t_object = new ca_objects(); $va_current_movement_ids = $t_object->getRelatedItems('ca_movements', array('idsOnly' => false, 'showCurrentOnly' => true, 'row_ids' => $va_object_ids)); $va_movement_rels = array(); foreach ($va_current_movement_ids as $vn_relation_id => $va_movement_info) { if (in_array($va_movement_info['movement_id'], $va_movement_ids)) { $va_movement_rels[] = $vn_relation_id; } } $o_view->setVar('qr_result', sizeof($va_movement_rels) ? caMakeSearchResult('ca_movements_x_objects', $va_movement_rels) : null); } $o_view->setVar('t_subject_rel', new ca_movements_x_objects()); break; } return $o_view->render('ca_storage_locations_contents.php'); }