/**
  * @param string $ps_bundle_name
  * @param string $ps_placement_code
  * @param array $pa_bundle_settings
  * @param array $pa_options Supported options are:
  *		config
  *		viewPath
  *		graphicsPath
  *		request
  */
 public function getBundleFormHTML($ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options, &$ps_bundle_label = null)
 {
     global $g_ui_locale;
     $vb_batch = isset($pa_options['batch']) && $pa_options['batch'] ? true : false;
     // Check if user has access to this bundle
     if ($pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_NONE__) {
         return;
     }
     // Check if user has access to this type
     if ((bool) $this->getAppConfig()->get('perform_type_access_checking')) {
         $vn_type_access = $pa_options['request']->user->getTypeAccessLevel($this->tableName(), $this->getTypeID());
         if ($vn_type_access == __CA_BUNDLE_ACCESS_NONE__) {
             return;
         }
         if ($vn_type_access == __CA_BUNDLE_ACCESS_READONLY__) {
             $pa_bundle_settings['readonly'] = true;
         }
     }
     if ((bool) $this->getAppConfig()->get('perform_item_level_access_checking') && $this->getPrimaryKey()) {
         $vn_item_access = $this->checkACLAccessForUser($pa_options['request']->user);
         if ($vn_item_access == __CA_ACL_NO_ACCESS__) {
             return;
         }
         if ($vn_item_access == __CA_ACL_READONLY_ACCESS__) {
             $pa_bundle_settings['readonly'] = true;
         }
     }
     $va_info = $this->getBundleInfo($ps_bundle_name);
     if (!($vs_type = $va_info['type'])) {
         return null;
     }
     if (isset($pa_options['config']) && is_object($pa_options['config'])) {
         $o_config = $pa_options['config'];
     } else {
         $o_config = $this->getAppConfig();
     }
     if (!($vs_required_marker = $o_config->get('required_field_marker'))) {
         $vs_required_marker = '[' . _t('REQUIRED') . ']';
     }
     $vs_label = $vs_label_text = null;
     // is label for this bundle forced in bundle settings?
     if (isset($pa_bundle_settings['label']) && isset($pa_bundle_settings['label'][$g_ui_locale]) && $pa_bundle_settings['label'][$g_ui_locale]) {
         $vs_label = $vs_label_text = $pa_bundle_settings['label'][$g_ui_locale];
     }
     $vs_element = '';
     $va_errors = array();
     switch ($vs_type) {
         # -------------------------------------------------
         case 'preferred_label':
         case 'nonpreferred_label':
             if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name)) && sizeof($va_error_objects)) {
                 $vs_display_format = $o_config->get('bundle_element_error_display_format');
                 foreach ($va_error_objects as $o_e) {
                     $va_errors[] = $o_e->getErrorDescription();
                 }
             } else {
                 $vs_display_format = $o_config->get('bundle_element_display_format');
             }
             $pa_options['dontCache'] = true;
             // we *don't* want to cache labels here
             $vs_element = $vs_type === 'preferred_label' ? $this->getPreferredLabelHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options) : $this->getNonPreferredLabelHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options);
             if (!$vs_label_text) {
                 $vs_label_text = $va_info['label'];
             }
             $vs_label = '<span class="formLabelText" id="' . $pa_options['formName'] . '_' . $ps_placement_code . '">' . $vs_label_text . '</span>';
             if ($vs_type == 'preferred_label' && $o_config->get('show_required_field_marker') && $o_config->get('require_preferred_label_for_' . $this->tableName())) {
                 $vs_label .= ' ' . $vs_required_marker;
             }
             $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) ? $pa_bundle_settings['description'][$g_ui_locale] : null;
             if ($vs_label_text && $vs_description) {
                 TooltipManager::add('#' . $pa_options['formName'] . '_' . $ps_placement_code, "<h3>{$vs_label}</h3>{$vs_description}");
             }
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'intrinsic':
             if (isset($pa_bundle_settings['label'][$g_ui_locale]) && $pa_bundle_settings['label'][$g_ui_locale]) {
                 $pa_options['label'] = $pa_bundle_settings['label'][$g_ui_locale];
             }
             if (!$pa_options['label']) {
                 $pa_options['label'] = $this->getFieldInfo($ps_bundle_name, 'LABEL');
             }
             $vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $pa_options['request']->getViewsDirectoryPath();
             $o_view = new View($pa_options['request'], "{$vs_view_path}/bundles/");
             $va_lookup_url_info = caJSONLookupServiceUrl($pa_options['request'], $this->tableName());
             if ($this->getFieldInfo($ps_bundle_name, 'IDENTITY')) {
                 $o_view->setVar('form_element', ($vn_id = (int) $this->get($ps_bundle_name)) ? $vn_id : "&lt;" . _t('Not yet issued') . "&gt;");
             } else {
                 $vb_read_only = $pa_bundle_settings['readonly'] || $pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_READONLY__ ? true : false;
                 $o_view->setVar('form_element', $this->htmlFormElement($ps_bundle_name, $this->getProperty('ID_NUMBERING_ID_FIELD') == $ps_bundle_name ? $o_config->get('idno_element_display_format_without_label') : $o_config->get('bundle_element_display_format_without_label'), array_merge(array('readonly' => $vb_read_only, 'error_icon' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/warning_small.gif", 'progress_indicator' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif", 'lookup_url' => $va_lookup_url_info['intrinsic']), $pa_options)));
             }
             $o_view->setVar('errors', $pa_options['request']->getActionErrors($ps_bundle_name));
             if (method_exists($this, "getDefaultMediaPreviewVersion")) {
                 $o_view->setVar('display_media', $this->getMediaTag($ps_bundle_name, $this->getDefaultMediaPreviewVersion($ps_bundle_name)));
             }
             $vs_field_id = 'ca_intrinsic_' . $pa_options['formName'] . '_' . $ps_placement_code;
             $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $pa_options['label'] . '</span>';
             if ($o_config->get('show_required_field_marker')) {
                 if ($this->getFieldInfo($ps_bundle_name, 'FIELD_TYPE') == FT_TEXT && is_array($va_bounds = $this->getFieldInfo($ps_bundle_name, 'BOUNDS_LENGTH')) && $va_bounds[0] > 0) {
                     $vs_label .= ' ' . $vs_required_marker;
                 } else {
                     if (in_array($this->getFieldInfo($ps_bundle_name, 'FIELD_TYPE'), array(FT_NUMBER, FT_HISTORIC_DATERANGE, FT_DATERANGE)) && !$this->getFieldInfo($ps_bundle_name, 'IS_NULL')) {
                         $vs_label .= ' ' . $vs_required_marker;
                     }
                 }
             }
             $o_view->setVar('bundle_name', $ps_bundle_name);
             $o_view->setVar('settings', $pa_bundle_settings);
             $o_view->setVar('t_instance', $this);
             $o_view->setVar('batch', (bool) (isset($pa_options['batch']) && $pa_options['batch']));
             $vs_element = $o_view->render('intrinsic.php', true);
             $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : $this->getFieldInfo($ps_bundle_name, 'DESCRIPTION');
             if ($pa_options['label'] && $vs_description) {
                 TooltipManager::add('#' . $vs_field_id, "<h3>" . $pa_options['label'] . "</h3>{$vs_description}");
             }
             if (isset($pa_bundle_settings['forACLAccessScreen']) && $pa_bundle_settings['forACLAccessScreen']) {
                 $vs_display_format = '^ELEMENT';
             } else {
                 $vs_display_format = $o_config->get('bundle_element_display_format');
             }
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'attribute':
             // bundle names for attributes are simply element codes prefixed with 'ca_attribute_'
             // since getAttributeHTMLFormBundle() takes a straight element code we have to strip the prefix here
             $vs_attr_element_code = str_replace('ca_attribute_', '', $ps_bundle_name);
             $vs_display_format = $o_config->get('bundle_element_display_format');
             $vs_element = $this->getAttributeHTMLFormBundle($pa_options['request'], $pa_options['formName'], $vs_attr_element_code, $ps_placement_code, $pa_bundle_settings, $pa_options);
             $vs_field_id = 'ca_attribute_' . $pa_options['formName'] . '_' . $vs_attr_element_code;
             if (!$vs_label_text) {
                 $vs_label_text = $this->getAttributeLabel($vs_attr_element_code);
             }
             if ($vb_batch) {
                 $t_element = $this->_getElementInstance($vs_attr_element_code);
                 $va_type_restrictions = $t_element->getTypeRestrictionsForDisplay($this->tableNum());
                 if (sizeof($va_type_restrictions)) {
                     $vs_restriction_list = join("; ", $va_type_restrictions);
                     $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span> <span class="formLabelSubtext" id="subtext_' . $vs_field_id . '">(' . caTruncateStringWithEllipsis($vs_restriction_list, 75) . ')</span>';
                     TooltipManager::add("#subtext_{$vs_field_id}", "<h3>" . _t("Restricted to types") . "</h3>" . join("<br/>", $va_type_restrictions));
                 } else {
                     $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span>';
                 }
             } else {
                 $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span>';
             }
             $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : $this->getAttributeDescription($vs_attr_element_code);
             $vs_documentation_url = trim(isset($pa_bundle_settings['documentation_url']) && $pa_bundle_settings['documentation_url'] ? $pa_bundle_settings['documentation_url'] : ($vs_documentation_url = $this->getAttributeDocumentationUrl($vs_attr_element_code)));
             if ($t_element = $this->_getElementInstance($vs_attr_element_code)) {
                 if ($o_config->get('show_required_field_marker') && ($t_element->getSetting('minChars') > 0 || (bool) $t_element->getSetting('mustNotBeBlank') || (bool) $t_element->getSetting('requireValue'))) {
                     $vs_label .= ' ' . $vs_required_marker;
                 }
             }
             if ($vs_label_text && $vs_description) {
                 TooltipManager::add('#' . $vs_field_id, "<h3>{$vs_label_text}</h3>{$vs_description}");
             }
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'related_table':
             if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name, 'general')) && sizeof($va_error_objects)) {
                 $vs_display_format = $o_config->get('bundle_element_error_display_format');
                 foreach ($va_error_objects as $o_e) {
                     $va_errors[] = $o_e->getErrorDescription();
                 }
             } else {
                 $vs_display_format = $o_config->get('bundle_element_display_format');
             }
             switch ($ps_bundle_name) {
                 # -------------------------------
                 case 'ca_object_representations':
                 case 'ca_entities':
                 case 'ca_places':
                 case 'ca_occurrences':
                 case 'ca_objects':
                 case 'ca_collections':
                 case 'ca_list_items':
                 case 'ca_storage_locations':
                 case 'ca_loans':
                 case 'ca_movements':
                 case 'ca_tour_stops':
                     if ($ps_bundle_name != 'ca_object_representations' && $this->_CONFIG->get($ps_bundle_name . '_disable')) {
                         return '';
                     }
                     // don't display if master "disable" switch is set
                     $vs_element = $this->getRelatedHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                 # -------------------------------
                 case 'ca_object_lots':
                     if ($this->_CONFIG->get($ps_bundle_name . '_disable')) {
                         break;
                     }
                     // don't display if master "disable" switch is set
                     $pa_lot_options = array('batch' => $vb_batch);
                     if ($this->tableName() != 'ca_object_lots' && ($vn_lot_id = $pa_options['request']->getParameter('lot_id', pInteger))) {
                         $pa_lot_options['force'][] = $vn_lot_id;
                     }
                     $vs_element = $this->getRelatedHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_lot_options);
                     break;
                     # -------------------------------
                 # -------------------------------
                 case 'ca_representation_annotations':
                     //if (!method_exists($this, "getAnnotationType") || !$this->getAnnotationType()) { continue; }	// don't show bundle if this representation doesn't support annotations
                     //if (!method_exists($this, "useBundleBasedAnnotationEditor") || !$this->useBundleBasedAnnotationEditor()) { continue; }	// don't show bundle if this representation doesn't use bundles to edit annotations
                     $pa_options['fields'] = array('ca_representation_annotations.status', 'ca_representation_annotations.access', 'ca_representation_annotations.props', 'ca_representation_annotations.representation_id');
                     $vs_element = $this->getRepresentationAnnotationHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                 # -------------------------------
                 default:
                     $vs_element = "'{$ps_bundle_name}' is not a valid related-table bundle name";
                     break;
                     # -------------------------------
             }
             if (!$vs_label_text) {
                 $vs_label_text = $va_info['label'];
             }
             $vs_label = '<span class="formLabelText" id="' . $pa_options['formName'] . '_' . $ps_placement_code . '">' . $vs_label_text . '</span>';
             $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : null;
             if ($vs_label_text && $vs_description) {
                 TooltipManager::add('#' . $pa_options['formName'] . '_' . $ps_placement_code, "<h3>{$vs_label}</h3>{$vs_description}");
             }
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'special':
             if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name, 'general')) && sizeof($va_error_objects)) {
                 $vs_display_format = $o_config->get('bundle_element_error_display_format');
                 foreach ($va_error_objects as $o_e) {
                     $va_errors[] = $o_e->getErrorDescription();
                 }
             } else {
                 $vs_display_format = $o_config->get('bundle_element_display_format');
             }
             $vb_read_only = $pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_READONLY__ ? true : false;
             if (!$pa_bundle_settings['readonly']) {
                 $pa_bundle_settings['readonly'] = !isset($pa_bundle_settings['readonly']) || !$pa_bundle_settings['readonly'] ? $vb_read_only : true;
             }
             switch ($ps_bundle_name) {
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_representation_annotations
                 case 'ca_representation_annotation_properties':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     foreach ($this->getPropertyList() as $vs_property) {
                         $vs_element .= $this->getPropertyHTMLFormBundle($pa_options['request'], $vs_property, $pa_options);
                     }
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_sets
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_sets
                 case 'ca_set_items':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getSetItemHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available for types which support set membership
                 # -------------------------------
                 // This bundle is only available for types which support set membership
                 case 'ca_sets':
                     require_once __CA_MODELS_DIR__ . "/ca_sets.php";
                     // need to include here to avoid dependency errors on parse/compile
                     $t_set = new ca_sets();
                     $vs_element .= $t_set->getItemSetMembershipHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_editor_uis
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_editor_uis
                 case 'ca_editor_ui_screens':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getScreenHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_editor_uis
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_editor_uis
                 case 'ca_editor_ui_type_restrictions':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     if (($t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->get('editor_type'), true)) && is_subclass_of($t_instance, 'BaseRelationshipModel')) {
                         return null;
                     }
                     // interstitial forms don't support UI type restrictions
                     $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_editor_ui_screens
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_editor_ui_screens
                 case 'ca_editor_ui_screen_type_restrictions':
                     $t_editor = new ca_editor_uis($this->get('ui_id'));
                     if ($t_editor && ($t_instance = $this->getAppDatamodel()->getInstanceByTableNum($t_editor->get('editor_type'), true)) && is_subclass_of($t_instance, 'BaseRelationshipModel')) {
                         return null;
                     }
                     // interstitial forms don't support UI type restrictions
                     $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_editor_ui_screens
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_editor_ui_screens
                 case 'ca_editor_ui_bundle_placements':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getPlacementsHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_tours
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_tours
                 case 'ca_tour_stops_list':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getTourStopHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // Hierarchy navigation bar for hierarchical tables
                 # -------------------------------
                 // Hierarchy navigation bar for hierarchical tables
                 case 'hierarchy_navigation':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     if ($this->isHierarchical()) {
                         $vs_element .= $this->getHierarchyNavigationHTMLFormBundle($pa_options['request'], $pa_options['formName'], array(), $pa_bundle_settings, $pa_options);
                     }
                     break;
                     # -------------------------------
                     // Hierarchical item location control
                 # -------------------------------
                 // Hierarchical item location control
                 case 'hierarchy_location':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     if ($this->isHierarchical()) {
                         $vs_element .= $this->getHierarchyLocationHTMLFormBundle($pa_options['request'], $pa_options['formName'], array(), $pa_bundle_settings, $pa_options);
                     }
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_search_forms
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_search_forms
                 case 'ca_search_form_placements':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     //if (!$this->getPrimaryKey()) { return ''; }
                     $vs_element .= $this->getSearchFormHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_bundle_displays
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_bundle_displays
                 case 'ca_bundle_display_placements':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     //if (!$this->getPrimaryKey()) { return ''; }
                     $vs_element .= $this->getBundleDisplayHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_bundle_displays
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_bundle_displays
                 case 'ca_bundle_display_type_restrictions':
                     $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     //
                 # -------------------------------
                 //
                 case 'ca_users':
                     if (!$pa_options['request']->user->canDoAction('is_administrator') && $pa_options['request']->getUserID() != $this->get('user_id')) {
                         return '';
                     }
                     // don't allow setting of per-user access if user is not owner
                     $vs_element .= $this->getUserHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_options);
                     break;
                     # -------------------------------
                     //
                 # -------------------------------
                 //
                 case 'ca_user_groups':
                     if (!$pa_options['request']->user->canDoAction('is_administrator') && $pa_options['request']->getUserID() != $this->get('user_id')) {
                         return '';
                     }
                     // don't allow setting of group access if user is not owner
                     $vs_element .= $this->getUserGroupHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_options);
                     break;
                     # -------------------------------
                 # -------------------------------
                 case 'settings':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getHTMLSettingFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_object_representations
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_object_representations
                 case 'ca_object_representations_media_display':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getMediaDisplayHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available when editing objects of type ca_object_representations
                 # -------------------------------
                 // This bundle is only available when editing objects of type ca_object_representations
                 case 'ca_object_representation_captions':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     if (!$this->representationIsOfClass("video")) {
                         return '';
                     }
                     $vs_element .= $this->getCaptionHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available for objects
                 # -------------------------------
                 // This bundle is only available for objects
                 case 'ca_commerce_order_history':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     if (!$pa_options['request']->user->canDoAction('can_manage_clients')) {
                         break;
                     }
                     $vs_label_text = $pa_bundle_settings['order_type'][0] == 'O' ? _t('Order history') : _t('Loan history');
                     $vs_element .= $this->getCommerceOrderHistoryHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                     // This bundle is only available for relationships that include an object on one end
                 # -------------------------------
                 // This bundle is only available for relationships that include an object on one end
                 case 'ca_object_representation_chooser':
                     if ($vb_batch) {
                         return null;
                     }
                     // not supported in batch mode
                     $vs_element .= $this->getRepresentationChooserHTMLFormBundle($pa_options['request'], $pa_options['formName'] . '_' . $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options);
                     break;
                     # -------------------------------
                 # -------------------------------
                 default:
                     $vs_element = "'{$ps_bundle_name}' is not a valid bundle name";
                     break;
                     # -------------------------------
             }
             if (!$vs_label_text) {
                 $vs_label_text = $va_info['label'];
             }
             $vs_label = '<span class="formLabelText" id="' . $pa_options['formName'] . '_' . $ps_placement_code . '">' . $vs_label_text . '</span>';
             $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : null;
             if ($vs_label_text && $vs_description) {
                 TooltipManager::add('#' . $pa_options['formName'] . '_' . $ps_placement_code, "<h3>{$vs_label}</h3>{$vs_description}");
             }
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         default:
             return "'{$ps_bundle_name}' is not a valid bundle name";
             break;
             # -------------------------------------------------
     }
     if ($vs_documentation_url) {
         // catch doc URL without protocol aka starting with letters but not http/https
         if (preg_match("!^[a-z]!", $vs_documentation_url) && !preg_match("!^http[s]?://!", $vs_documentation_url)) {
             $vs_documentation_url = "http://" . $vs_documentation_url;
         }
         $vs_documentation_link = "<a class='bundleDocumentationLink' href='{$vs_documentation_url}' target='_blank'>documentation</a>";
     }
     $vs_output = str_replace("^ELEMENT", $vs_element, $vs_display_format);
     $vs_output = str_replace("^ERRORS", join('; ', $va_errors), $vs_output);
     $vs_output = str_replace("^LABEL", $vs_label, $vs_output);
     $vs_output = str_replace("^DOCUMENTATIONLINK", $vs_documentation_link, $vs_output);
     $ps_bundle_label = $vs_label_text;
     return $vs_output;
 }
Ejemplo n.º 2
0
 /** 
  *
  */
 public function getTableNum()
 {
     if (!($vn_ui_id = $this->get('ui_id'))) {
         return null;
     }
     if (isset(ca_editor_ui_screens::$s_table_num_cache[$vn_ui_id])) {
         return ca_editor_ui_screens::$s_table_num_cache[$vn_ui_id];
     }
     $t_ui = new ca_editor_uis($vn_ui_id);
     return ca_editor_ui_screens::$s_table_num_cache[$vn_ui_id] = $t_ui->get('editor_type');
 }
Ejemplo n.º 3
0
 public function getAvailableSettings($pa_element_info = null)
 {
     global $_ca_attribute_settings, $g_request;
     $va_element_settings = $_ca_attribute_settings['ListAttributeValue'];
     /*
      * For the dependent field visibility feature we need to add a select-able list of all applicable
      * UI bundle placements here ... for each item in that list!
      */
     if (Configuration::load()->get('enable_dependent_field_visibility') && is_array($pa_element_info) && isset($pa_element_info['list_id']) && (!$pa_element_info['settings']['render'] || in_array($pa_element_info['settings']['render'], array('select', 'radio_buttons', 'yes_no_checkboxes'))) && $g_request && $g_request instanceof RequestHTTP) {
         $va_options_for_settings = array();
         $t_mde = new ca_metadata_elements($pa_element_info['element_id']);
         $va_restrictions = $t_mde->getTypeRestrictions();
         $va_tables = array();
         if (is_array($va_restrictions) && sizeof($va_restrictions)) {
             foreach ($va_restrictions as $va_restriction) {
                 $va_tables[] = $va_restriction['table_num'];
             }
         }
         $t_ui = new ca_editor_uis();
         foreach (array_unique($va_tables) as $vn_table_num) {
             // get UIs
             $va_ui_list = ca_editor_uis::getAvailableUIs($vn_table_num, $g_request);
             foreach ($va_ui_list as $vn_ui_id => $vs_ui_name) {
                 $t_ui->load($vn_ui_id);
                 // get screens
                 foreach ($t_ui->getScreens() as $va_screen) {
                     // get placements
                     foreach ($t_ui->getScreenBundlePlacements($va_screen['screen_id']) as $va_placement) {
                         $va_options_for_settings[$t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code']] = $t_ui->get('editor_code') . '/' . $va_screen['idno'] . '/' . $va_placement['placement_code'];
                     }
                 }
             }
         }
         $t_list = new ca_lists();
         foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) {
             foreach ($va_items_by_locale as $vn_locale_id => $va_item) {
                 $va_element_settings['hideIfSelected_' . $va_item['idno']] = array('formatType' => FT_TEXT, 'displayType' => DT_SELECT, 'options' => $va_options_for_settings, 'takesLocale' => false, 'default' => '', 'width' => "400px", 'height' => 10, 'label' => _t('Hide bundles if "%1" is selected', $va_item['name_singular']), 'description' => _t('Select bundles from the list below'));
             }
         }
     } elseif (defined('__CollectiveAccess_Installer__') && Configuration::load()->get('enable_dependent_field_visibility')) {
         // when installing, UIs, screens and placements are not yet available when we process elementSets, so
         // we just add the hideIfSelected_* as available settings (without actual settings) so that the validation doesn't fail
         $t_list = new ca_lists();
         foreach ($t_list->getItemsForList($pa_element_info['list_id']) as $va_items_by_locale) {
             foreach ($va_items_by_locale as $vn_locale_id => $va_item) {
                 $va_element_settings['hideIfSelected_' . $va_item['idno']] = true;
             }
         }
     }
     return $va_element_settings;
 }