<?php 
    print _t('Send email to <strong>%1</strong> when done', $vs_email);
    ?>
			
				</td>
<?php 
}
if (($vs_sms = trim($this->request->user->get('sms_number'))) && (bool) $this->request->config->get('enable_sms_notifications')) {
    ?>
				<td class="caConfirmBatchExecutionPanelAlertControl">
<?php 
    $va_opts = array('id' => 'caSendSMSWhenDone', 'value' => 1);
    if (isset($va_last_settings['sendSMS']) && $va_last_settings['sendSMS']) {
        $va_opts['checked'] = 1;
    }
    print caHTMLCheckboxInput('send_sms_when_done', $va_opts);
    ?>
				</td>
				<td class="caConfirmBatchExecutionPanelAlertControl">
<?php 
    print _t('Send SMS to <strong>%1</strong> when done', $vs_sms);
    ?>
			
				</td>
<?php 
}
?>
				
					</tr>
				</table>
			</div>
<?php 
    print _t('Send email to <strong>%1</strong> when done', $vs_email);
    ?>
			
				</td>
<?php 
}
if (($vs_sms = trim($this->request->user->get('sms_number'))) && (bool) $this->request->config->get('enable_sms_notifications')) {
    ?>
				<td class="caConfirmBatchExecutionPanelAlertControl">
<?php 
    $va_opts = array('id' => 'caSendSMSWhenDone', 'value' => 1);
    if (isset($va_last_settings['sendSMS']) && $va_last_settings['sendSMS']) {
        $va_opts['checked'] = 1;
    }
    print caHTMLCheckboxInput('send_sms_when_done', array('id' => 'caSendSMSWhenDone', $va_opts));
    ?>
				</td>
				<td class="caConfirmBatchExecutionPanelAlertControl">
<?php 
    print _t('Send SMS to <strong>%1</strong> when done', $vs_sms);
    ?>
			
				</td>
<?php 
}
?>

			<div id="caTypeChangePanelControlButtons">
				<table>
					<tr>
Beispiel #3
0
<?php 
    _p('More information about standard installation profiles is available on the CollectiveAccess <a href="http://docs.collectiveaccess.org/wiki/Installation_profile" target="_blank">project wiki</a>.');
    ?>
						<br/><br/>
<?php 
    _p('Don\'t see a suitable profile? Browse our <a href="http://www.CollectiveAccess.org/configuration" target="_blank">installation profile library</a> for additional configurations developed by the CollectiveAccess user community. To install a new profile simply copy the file into the <i>install/profiles/xml</i> directory on your server and reload the installer in your web browser.');
    ?>
					</div>
				</div>
			</div><!-- end formItem -->
<?php 
    if (defined('__CA_ALLOW_INSTALLER_TO_OVERWRITE_EXISTING_INSTALLS__') && __CA_ALLOW_INSTALLER_TO_OVERWRITE_EXISTING_INSTALLS__) {
        ?>
				<div class='formItem'>
<?php 
        print caHTMLCheckboxInput('overwrite', array('value' => 1)) . " " . _p("Overwrite existing installation?");
        ?>
				</div><!-- end formItem -->
<?php 
    }
    ?>
				
				<div class="loginSubmitButton"><a href='#' onclick='jQuery("#page1form").submit();' class='form-button'><span class='form-button'><img src='<?php 
    print $vs_url_path;
    ?>
/graphics/glyphicons_206_ok_2.png' border='0' alt='<?php 
    _p('Begin installation');
    ?>
' class='form-button-left' style='padding-right: 10px;'/> <?php 
    _p('Begin installation');
    ?>
Beispiel #4
0
 /**
  * Returns HTML form element for editing of setting
  *
  * Options:
  *
  * 	'name' => sets the name of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  * 	'id' => sets the id of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  *  'value' => sets the value of the HTML form element explicitly, otherwise the current value for the setting in the loaded row is used
  *  'label_id' => sets the id of the label for the setting form element (used to link tools tips to the label); if not set then the default is to set it to  'setting_<name_of_setting>_label'
  */
 public function settingHTMLFormElement($ps_setting, $pa_options = null)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return false;
     }
     $va_available_settings = $this->getAvailableSettings();
     $va_properties = $va_available_settings[$ps_setting];
     if (isset($pa_options['name'])) {
         $vs_input_name = $pa_options['name'];
     } else {
         $vs_input_name = "setting_{$ps_setting}";
     }
     if (isset($pa_options['id'])) {
         $vs_input_id = $pa_options['id'];
     } else {
         $vs_input_id = "setting_{$ps_setting}";
     }
     if (isset($pa_options['value'])) {
         $vs_value = $pa_options['value'];
     } else {
         $vs_value = $this->getSetting(trim($ps_setting));
     }
     if (isset($pa_options['label_id'])) {
         $vs_label_id = $pa_options['label_id'];
     } else {
         $vs_label_id = "setting_{$ps_setting}_label";
     }
     $vs_return = "\n" . '<div class="formLabel" id="' . $vs_input_id . '_container">' . "\n";
     $vs_return .= '<span id="' . $vs_label_id . '"  class="' . $vs_label_id . '">' . $va_properties['label'] . '</span>';
     if ($vs_help_text = $pa_options['helpText']) {
         $vs_return .= "<a href='#' onclick='jQuery(\"#" . str_replace(".", "_", $vs_label_id) . "_help_text\").slideToggle(250); return false;' class='settingsKeyButton'>" . _t('Key') . "</a>";
     }
     $vs_return .= '<br />' . "\n";
     if ($vs_help_text) {
         $vs_return .= "\n<div id='" . str_replace(".", "_", $vs_label_id) . "_help_text' class='settingsKey'>{$vs_help_text}</div>\n";
     }
     switch ($va_properties['displayType']) {
         # --------------------------------------------
         case DT_FIELD:
             $vb_takes_locale = false;
             if (isset($va_properties['takesLocale']) && $va_properties['takesLocale']) {
                 $vb_takes_locale = true;
                 $va_locales = ca_locales::getLocaleList(array('sort_field' => '', 'sort_order' => 'asc', 'index_by_code' => true, 'available_for_cataloguing_only' => true));
             } else {
                 $va_locales = array('_generic' => array());
             }
             foreach ($va_locales as $vs_locale => $va_locale_info) {
                 if ($vb_takes_locale && sizeof($va_locales) > 1) {
                     $vs_locale_label = " (" . $va_locale_info['name'] . ")";
                     $vs_input_name_suffix = '_' . $vs_locale;
                 } else {
                     if ($vb_takes_locale) {
                         $vs_input_name_suffix = '_' . $vs_locale;
                     } else {
                         $vs_input_name_suffix = $vs_locale_label = '';
                     }
                 }
                 if ($vs_locale != '_generic' && is_array($vs_value)) {
                     // _generic means this setting doesn't take a locale
                     if (!($vs_text_value = $vs_value[$va_locale_info['locale_id']])) {
                         $vs_text_value = is_array($vs_value) && isset($vs_value[$va_locale_info['code']]) ? $vs_value[$va_locale_info['code']] : '';
                     }
                 } else {
                     $vs_text_value = $vs_value;
                 }
                 $vs_return .= caHTMLTextInput($vs_input_name . $vs_input_name_suffix, array('size' => $va_properties["width"], 'height' => $va_properties["height"], 'value' => $vs_text_value, 'id' => $vs_input_id)) . "{$vs_locale_label}<br/>\n";
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_CHECKBOXES:
             $va_attributes = array('value' => '1', 'id' => $vs_input_id);
             if ((int) $vs_value === 1) {
                 $va_attributes['checked'] = '1';
             }
             if (isset($va_properties['hideOnSelect'])) {
                 if (!is_array($va_properties['hideOnSelect'])) {
                     $va_properties['hideOnSelect'] = array($va_properties['hideOnSelect']);
                 }
                 $va_ids = array();
                 foreach ($va_properties['hideOnSelect'] as $vs_n) {
                     $va_ids[] = "#" . $pa_options['id_prefix'] . "_{$vs_n}_container";
                 }
                 $va_attributes['onchange'] = 'jQuery(this).prop("checked") ? jQuery("' . join(",", $va_ids) . '").slideUp(250).find("input, textarea").val("") : jQuery("' . join(",", $va_ids) . '").slideDown(250);';
             }
             $vs_return .= caHTMLCheckboxInput($vs_input_name, $va_attributes, array());
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_COLORPICKER:
             $va_attributes = array('value' => $vs_value, 'id' => $vs_input_id);
             $vs_return .= caHTMLHiddenInput($vs_input_name, $va_attributes, array());
             $vs_return .= "<div id='{$vs_input_id}_colorchip' class='colorpicker_chip' style='background-color: #{$vs_value}'><!-- empty --></div>";
             $vs_return .= "<script type='text/javascript'>jQuery(document).ready(function() { jQuery('#{$vs_input_name}_colorchip').ColorPicker({\n\t\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeIn(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeOut(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}').val(hex);\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}_colorchip').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcolor: jQuery('#" . $pa_options["name"] . "').val()\n\t\t\t\t\t\t\t})}); </script>\n";
             JavascriptLoadManager::register('jquery', 'colorpicker');
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_SELECT:
             include_once __CA_MODELS_DIR__ . '/ca_relationship_types.php';
             $vn_width = isset($va_properties['width']) && strlen($va_properties['width']) > 0 ? $va_properties['width'] : "100px";
             $vn_height = isset($va_properties['height']) && strlen($va_properties['height']) > 0 ? $va_properties['height'] : "50px";
             $vs_select_element = '';
             if (($vs_rel_table = $va_properties['useRelationshipTypeList']) || ($vb_locale_list = (bool) $va_properties['useLocaleList']) || ($vs_list_code = $va_properties['useList']) || ($vb_show_lists = (bool) $va_properties['showLists'] || (bool) $va_properties['showVocabularies'])) {
                 if ($vs_rel_table) {
                     $t_rel = new ca_relationship_types();
                     $va_rels = $t_rel->getRelationshipInfo($vs_rel_table);
                     $va_rel_opts = array();
                     if (isset($va_properties['allowNull']) && $va_properties['allowNull']) {
                         $va_rel_opts['-'] = null;
                     }
                     foreach ($va_rels as $vn_type_id => $va_rel_type_info) {
                         if (!$va_rel_type_info['parent_id']) {
                             continue;
                         }
                         $va_rel_opts[$va_rel_type_info['typename'] . '/' . $va_rel_type_info['typename_reverse']] = $va_rel_type_info['type_id'];
                     }
                 } else {
                     if ($vb_locale_list) {
                         include_once __CA_MODELS_DIR__ . '/ca_locales.php';
                         $va_rel_opts = array_flip(ca_locales::getLocaleList(array('return_display_values' => true)));
                     } else {
                         if ($vb_show_lists) {
                             include_once __CA_MODELS_DIR__ . '/ca_lists.php';
                             $t_list = new ca_lists();
                             $va_lists = caExtractValuesByUserLocale($t_list->getListOfLists());
                             $va_rel_opts = array();
                             foreach ($va_lists as $vn_list_id => $va_list_info) {
                                 if ($va_properties['showVocabularies'] && !$va_list_info['use_as_vocabulary']) {
                                     continue;
                                 }
                                 $va_rel_opts[$va_list_info['name'] . ' (' . $va_list_info['list_code'] . ')'] = $vn_list_id;
                             }
                         }
                     }
                 }
                 $va_attr = array();
                 if ($vn_height > 1) {
                     $va_attr['multiple'] = 1;
                     $vs_input_name .= '[]';
                 }
                 $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height);
                 if ($vn_height > 1) {
                     if ($vs_value && !is_array($vs_value)) {
                         $vs_value = array($vs_value);
                     }
                     $va_opts['values'] = $vs_value;
                 } else {
                     if (is_array($vs_value)) {
                         $va_opts['value'] = array_pop($vs_value);
                     } else {
                         if ($vs_value) {
                             $va_opts['value'] = $vs_value;
                         } else {
                             $va_opts['value'] = null;
                         }
                     }
                 }
                 if ($vs_list_code) {
                     $t_list = new ca_lists();
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = $t_list->getListAsHTMLFormElement($vs_list_code, $vs_input_name, $va_attr, $va_opts);
                 } else {
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_rel_opts, $va_attr, $va_opts);
                 }
             } else {
                 if (strlen($va_properties['showSortableBundlesFor']) > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $o_dm = Datamodel::load();
                     if (!($t_rel = $o_dm->getInstanceByTableName($va_properties['showSortableBundlesFor'], true))) {
                         break;
                     }
                     $va_elements = ca_metadata_elements::getSortableElements($va_properties['showSortableBundlesFor']);
                     $va_select_opts = array(_t('User defined sort order') => '', _t('Order created') => 'relation_id', _t('Preferred label') => $va_properties['showSortableBundlesFor'] . ".preferred_labels." . $t_rel->getLabelDisplayField());
                     foreach ($va_elements as $vn_element_id => $va_element) {
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_properties['showSortableBundlesFor'] . "." . $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showSortableElementsFor'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $t_element = new ca_metadata_elements($va_properties['showSortableElementsFor']);
                     if (!$t_element->getPrimaryKey()) {
                         return '';
                     }
                     $va_elements = $t_element->getElementsInSet();
                     $va_select_opts = array(_t('Order created') => '');
                     foreach ($va_elements as $vn_i => $va_element) {
                         if ((int) $va_element['element_id'] == (int) $va_properties['showSortableElementsFor']) {
                             continue;
                         }
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showMetadataElementsWithDataType'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $va_rep_elements = ca_metadata_elements::getElementsAsList(true, $va_properties['table'], null, true, false, true, array($va_properties['showMetadataElementsWithDataType']));
                     if (is_array($va_rep_elements)) {
                         $va_select_opts = array();
                         foreach ($va_rep_elements as $vs_element_code => $va_element_info) {
                             $va_select_opts[$va_element_info['display_label']] = $vs_element_code;
                         }
                         $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                         $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                     }
                 } else {
                     // Regular drop-down with configured options
                     if ($vn_height > 1) {
                         $va_attr['multiple'] = 1;
                         $vs_input_name .= '[]';
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_properties['options'], array(), $va_opts);
                 }
             }
             if ($vs_select_element) {
                 $vs_return .= $vs_select_element;
             } else {
                 return '';
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         default:
             break;
             # --------------------------------------------
     }
     $vs_return .= '</div>' . "\n";
     TooltipManager::add('.' . $vs_label_id, "<h3>" . $va_properties["label"] . "</h3>" . $va_properties["description"]);
     return $vs_return;
 }
    ?>
</div>
		
			<table width="100%">
<?php 
    $vn_i = 0;
    TooltipManager::setNamespaceCSSClass("{$vs_id_prefix}_media_tooltips", "resizeableTooltip");
    foreach ($t_subject->getMediaVersions('media') as $vs_version) {
        if ($t_subject->getMediaInputTypeForVersion('media', $vs_version) != 'image') {
            continue;
        }
        // skip non-image versions
        if (!$vn_i) {
            print "<tr>";
        }
        print "<td>" . caHTMLCheckboxInput($vs_id_prefix . '_set_versions[]', array('value' => $vs_version, 'checked' => '1'));
        print "<span id='{$vs_id_prefix}_media_{$vs_version}_label'>{$vs_version} (" . $t_subject->getMediaInfo('media', $vs_version, 'WIDTH') . 'x' . $t_subject->getMediaInfo('media', $vs_version, 'HEIGHT') . ")</span>";
        print "</td>";
        TooltipManager::add("#{$vs_id_prefix}_media_{$vs_version}_label", $t_subject->getMediaTag('media', $vs_version), "{$vs_id_prefix}_media_tooltips");
        $vn_i++;
        if ($vn_i > 2) {
            print "</tr>\n";
            $vn_i = 0;
        }
    }
    if ($vn_i > 0) {
        print "</tr>\n";
    }
    ?>
			</table>
			<div class="objectRepresentationMediaDisplayDerivativeHelpText" id="<?php 
Beispiel #6
0
</span>
<?php 
}
if ($vs_media = $this->getVar('display_media')) {
    ?>
						<div style="float: right; margin: 5px 10px 5px 0px;"><?php 
    print $vs_media;
    ?>
</div>
<?php 
}
//
// Generate "inherit" control for access where supported
//
if ($vs_bundle_name == 'access' && (bool) $t_instance->getAppConfig()->get($t_instance->tableName() . '_allow_access_inheritance') && $t_instance->hasField('access_inherit_from_parent') && $t_instance->get('parent_id') > 0) {
    print "<div class='inheritFromParent'>" . caHTMLCheckboxInput($vs_id_prefix . 'access_inherit_from_parent', array('value' => 1, 'id' => $vs_id_prefix . 'access_inherit_from_parent'), array()) . ' ' . _t('Inherit from parent?') . "</div>";
    ?>
						<script type="text/javascript">
							jQuery(document).ready(function() {
								jQuery('#<?php 
    print $vs_id_prefix;
    ?>
access_inherit_from_parent').bind('click', function(e) {
									jQuery('#<?php 
    print $vs_id_prefix;
    ?>
access').prop('disabled', jQuery(this).prop('checked'));
								}).prop('checked', <?php 
    print (bool) $t_instance->get('access_inherit_from_parent') ? 'true' : 'false';
    ?>
);
			</div>
		</div>
		<div class='bundleLabel'>
			<span class="formLabelText"><?php 
print _t('Testing options');
?>
</span> 
			<div class="bundleContainer">
				<div class="caLabelList" >
					<p class="formLabelPlain">
<?php 
$va_attr = array('id' => 'caDryRun', 'value' => 1);
if ($va_last_settings['dryRun'] == 1) {
    $va_attr['checked'] = 1;
}
print caHTMLCheckboxInput('dryRun', $va_attr) . " " . _t('Dry run');
?>
					</p>
					
				</div>
			</div>
		</div>
<?php 
print $this->render("metadataimport/confirm_html.php");
?>
		</form>
</div>
<?php 
print $vs_control_box;
?>
<div class="editorBottomPadding"><!-- empty --></div>
Beispiel #8
0
 /**
  * Returns HTML <select> element containing the specified list, or portion of the list.
  *
  * @param mixed $pm_list_name_or_id
  * @param string $ps_name
  * @param array $pa_attributes 
  * @param array $pa_options Array of options. Valid options include:
  * 	childrenOnlyForItemID = if set only items below item_id in the list item hierarchy are returned. Default (null) is to return all items in the list.
  * 	directChildrenOnly = if set only items with item_id=childrenOnlyForItemID as parent in the list item hierarchy are returned. Default (null) is to return all items in the list.
  *  nullOption = if set then a "null" (no value) option is available labeled with the value passed in this option
  *  additionalOptions = an optional array of options that will be passed through to caHTMLSelect; keys are display labels and values are used as option values
  *  value = if set, the <select> will have default selection set to the item whose *value* matches the option value. If none is set then the first item in the list will be selected
  *  key = ca_list_item field to be used as value for the <select> element list; can be set to either item_id or item_value; default is item_id
  *	width = the display width of the list in characters or pixels
  *  limitToItemsWithID = An optional array of list item_ids. Item_ids not in the array will be omitted from the returned list.
  *  omitItemsWithID = An optional array of list item_ids. Item_ids in the array will be omitted from the returned list.
  *  disableItemsWithID = An optional array of list item_ids. Item_ids in the array will be disabled in the returned list.	
  *
  *	limitToItemsRelatedToCollections = an array of collection_ids or collection idno's; returned items will be restricted to those attached to the specified collections
  *	limitToItemsRelatedToCollectionWithRelationshipTypes = array of collection type names or type_ids; returned items will be restricted to those attached to the specified collectionss with the specified relationship type
  *	limitToListIDs = array of list_ids to restrict returned items to when using "limitToItemsRelatedToCollections"
  *
  *  indentForHierarchy = indicate hierarchy with indentation. [Default is true]
  * 	transaction = transaction to perform database operations within. [Default is null]
  * 
  * @return string - HTML code for the <select> element; empty string if the list is empty
  */
 public static function getListAsHTMLFormElement($pm_list_name_or_id, $ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if ($o_trans = caGetOption('transaction', $pa_options, null)) {
         $t_list->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!(isset($pa_options['limitToItemsRelatedToCollection']) && is_array($pa_options['limitToItemsRelatedToCollections']))) {
         $vn_list_id = $t_list->_getListID($pm_list_name_or_id);
         $t_list->load($vn_list_id);
     }
     $vn_root_id = isset($pa_options['childrenOnlyForItemID']) && $pa_options['childrenOnlyForItemID'] ? $pa_options['childrenOnlyForItemID'] : null;
     $va_disabled_item_ids = caGetOption('disableItemsWithID', $pa_options, null);
     $vs_render_as = isset($pa_options['render']) ? $pa_options['render'] : '';
     $vn_sort_type = $t_list->get('default_sort');
     if ($vs_render_as == 'yes_no_checkboxes' && $vn_sort_type == __CA_LISTS_SORT_BY_LABEL__) {
         $vn_sort_type = __CA_LISTS_SORT_BY_IDENTIFIER__;
         // never allow sort-by-label when rendering as yes/no checkbox
     }
     if (!in_array($vs_render_as, array('lookup', 'horiz_hierbrowser', 'vert_hierbrowser'))) {
         if (isset($pa_options['limitToItemsRelatedToCollections']) && is_array($pa_options['limitToItemsRelatedToCollections'])) {
             $t_collection = new ca_collections();
             $va_collection_ids = array();
             foreach ($pa_options['limitToItemsRelatedToCollections'] as $vn_collection_id) {
                 if ($vn_collection_id && !is_numeric($vn_collection_id)) {
                     if ($vn_collection_id = $t_collection->load(array('idno' => $vn_collection_id))) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 } else {
                     if ($vn_collection_id) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 }
             }
             if (sizeof($va_collection_ids)) {
                 $qr_collections = $t_list->makeSearchResult('ca_collections', $va_collection_ids, array('restrictToRelationshipTypes' => isset($pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes']) ? $pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes'] : null));
                 $va_item_ids = array();
                 while ($qr_collections->nextHit()) {
                     $va_list_items = $qr_collections->get('ca_list_items', array('returnAsArray' => true));
                     foreach ($va_list_items as $vn_rel_id => $va_list_item) {
                         $va_item_ids[$vn_rel_id] = $va_list_item['item_id'];
                     }
                 }
                 if ($va_limit_to_listIDs = isset($pa_options['limitToListIDs']) && is_array($pa_options['limitToListIDs']) ? $pa_options['limitToListIDs'] : null) {
                     // for some reason the option comes back as array(0 => null) if no list is selected in UI
                     // -> have to make sure to catch this case here
                     if (sizeof($va_limit_to_listIDs) == 1 && empty($va_limit_to_listIDs[0])) {
                         $va_limit_to_listIDs = null;
                     }
                 }
                 if (is_array($va_limit_to_listIDs) && sizeof($va_item_ids)) {
                     // filter out items from tables we don't want
                     $qr_list_items = $t_list->makeSearchResult("ca_list_items", array_values($va_item_ids));
                     while ($qr_list_items->nextHit()) {
                         if (!in_array($qr_list_items->get('ca_list_items.list_id'), $va_limit_to_listIDs)) {
                             if (is_array($va_k = array_keys($va_item_ids, $qr_list_items->get('ca_list_items.item_id')))) {
                                 foreach ($va_k as $vs_k) {
                                     unset($va_list_items[$vs_k]);
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $va_list_items = $t_list->getItemsForList($pm_list_name_or_id, array_merge($pa_options, array('returnHierarchyLevels' => caGetOption('indentForHierarchy', $pa_options, true), 'item_id' => $vn_root_id, 'extractValuesByUserLocale' => true, 'sort' => $vn_sort_type)));
         }
     }
     if (!is_array($va_list_items)) {
         $va_list_items = array();
     }
     $va_options = array();
     $va_disabled_options = array();
     if (!isset($pa_options['value'])) {
         $pa_options['value'] = null;
     }
     if (!isset($pa_options['key'])) {
         $pa_options['key'] = 'item_id';
     }
     if (!in_array($pa_options['key'], array('item_id', 'item_value'))) {
         $pa_options['key'] = 'item_id';
     }
     if (!isset($pa_options['limitToItemsWithID']) || !is_array($pa_options['limitToItemsWithID']) || !sizeof($pa_options['limitToItemsWithID'])) {
         $pa_options['limitToItemsWithID'] = null;
     }
     if (!isset($pa_options['omitItemsWithID']) || !is_array($pa_options['omitItemsWithID']) || !sizeof($pa_options['omitItemsWithID'])) {
         $pa_options['omitItemsWithID'] = null;
     }
     if (isset($pa_options['nullOption']) && $pa_options['nullOption'] && $vs_render_as != 'checklist') {
         $va_options[''] = $pa_options['nullOption'];
     }
     $va_colors = array();
     $vn_default_val = null;
     foreach ($va_list_items as $vn_item_id => $va_item) {
         if (is_array($pa_options['limitToItemsWithID']) && !in_array($vn_item_id, $pa_options['limitToItemsWithID'])) {
             continue;
         }
         if (is_array($pa_options['omitItemsWithID']) && in_array($vn_item_id, $pa_options['omitItemsWithID'])) {
             continue;
         }
         $va_options[$va_item[$pa_options['key']]] = str_repeat('&nbsp;', intval($va_item['LEVEL']) * 3) . ' ' . $va_item['name_singular'];
         if (!$va_item['is_enabled'] || is_array($va_disabled_item_ids) && in_array($vn_item_id, $va_disabled_item_ids)) {
             $va_disabled_options[$va_item[$pa_options['key']]] = true;
         }
         $va_colors[$vn_item_id] = $va_item['color'];
         if ($va_item['is_default']) {
             $vn_default_val = $va_item[$pa_options['key']];
         }
         // get default value
         if ($va_item['is_default'] && !isset($pa_options['nullOption'])) {
             // set default if needed, but only if there's not a null option set
             if (!is_array($pa_options['value']) && (!isset($pa_options['value']) || !strlen($pa_options['value']))) {
                 $pa_options['value'] = $vn_default_val;
             } else {
                 if (is_array($pa_options['value']) && !sizeof($pa_options['value'])) {
                     $pa_options['value'] = array(0 => $vn_default_val);
                 }
             }
         }
     }
     if (isset($pa_options['additionalOptions']) && is_array($pa_options['additionalOptions'])) {
         $va_options = array_merge($va_options, array_flip($pa_options['additionalOptions']));
     }
     $pa_options['disabledOptions'] = $va_disabled_options;
     switch ($vs_render_as) {
         case 'radio_buttons':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vn_i = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 $va_attributes['value'] = $vm_value;
                 $va_attributes['id'] = $ps_name . '_' . $vn_i;
                 if ($pa_options['value'] == $vm_value) {
                     $va_attributes['checked'] = '1';
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 $vs_buf .= "<td>" . caHTMLRadioButtonInput($ps_name, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
                 $vn_i++;
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'yes_no_checkboxes':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vb_is_checked = false;
             if (!$pa_options['value']) {
                 $pa_options['value'] = (string) $vn_default_val;
             }
             foreach ($va_options as $vm_value => $vs_label) {
                 if (strlen($vm_value) == 0) {
                     continue;
                 }
                 // don't count null values when calculating the first value for the yes/no
                 switch ($vn_c) {
                     case 0:
                         if ($pa_options['value'] === (string) $vm_value) {
                             $vb_is_checked = true;
                         }
                         $pa_attributes['value'] = $pa_options['value'] = $vm_value;
                         $pa_options['label'] = $vs_label;
                         break;
                     case 1:
                         $pa_options['returnValueIfUnchecked'] = $vm_value;
                         break;
                     default:
                         // exit
                         break 2;
                 }
                 $vn_c++;
             }
             if ($vb_is_checked) {
                 $pa_attributes['checked'] = 1;
             }
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLCheckboxInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'checklist':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (is_array($pa_options['value']) && in_array($vm_value, $pa_options['value'])) {
                     $va_attributes['checked'] = '1';
                 }
                 $vs_buf .= "<td>" . caHTMLCheckboxInput($ps_name . '_' . $vm_value, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'lookup':
             $vs_value = $vs_hidden_value = "";
             if (caGetOption('forSearch', $pa_options)) {
                 if ($vs_val_id = caGetOption('value', $pa_options)) {
                     $vs_value = $t_list->getItemFromListForDisplayByItemID($pm_list_name_or_id, $vs_val_id);
                     $vs_hidden_value = $vs_val_id;
                 }
             } else {
                 $vs_value = "{" . $pa_options['element_id'] . "_label}";
                 $vs_hidden_value = "{" . $pa_options['element_id'] . "}";
             }
             $vs_buf = caHTMLTextInput($ps_name . '_autocomplete', array('width' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : 300, 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => $vs_value, 'maxlength' => 512, 'id' => $ps_name . "_autocomplete", 'class' => 'lookupBg')) . caHTMLHiddenInput($ps_name, array('value' => $vs_hidden_value, 'id' => $ps_name));
             if ($pa_options['request']) {
                 $vs_url = caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noInline' => 1, 'noSymbols' => 1, 'max' => 100));
             } else {
                 // hardcoded default for testing.
                 $vs_url = '/index.php/lookup/ListItem/Get';
             }
             $vs_buf .= '</div>';
             $vs_buf .= "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').autocomplete({\n\t\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (parseInt(ui.item.id) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').val('');\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val('');\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
             return $vs_buf;
             break;
         case 'horiz_hierbrowser':
         case 'horiz_hierbrowser_with_search':
         case 'vert_hierbrowser':
             $va_width = caParseFormElementDimension($pa_options['width'] ? $pa_options['width'] : $pa_options['width']);
             if ($va_width['type'] != 'pixels' && $va_width['dimension'] < 250) {
                 $va_width['dimension'] = 500;
             }
             $vn_width = $va_width['dimension'] . 'px';
             $va_height = caParseFormElementDimension($pa_options['height']);
             if ($va_height['type'] != 'pixels' && $va_height['dimension'] < 100) {
                 $va_height['dimension'] = 200;
             }
             $vn_height = $va_height['dimension'] . 'px';
             $t_root_item = new ca_list_items();
             $t_root_item->load(array('list_id' => $vn_list_id, 'parent_id' => null));
             JavascriptLoadManager::register("hierBrowser");
             $vs_buf = "<div style='width: {$vn_width}; height: {$vn_height};'><div id='{$ps_name}_hierarchyBrowser{n}' style='width: 100%; height: 100%;' class='" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserVertical' : 'hierarchyBrowser') . "'>\n\t\t\t\t\t<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->\n\t\t\t\t</div><!-- end hierarchyBrowser -->\t</div>";
             $vs_buf .= "\t<script type='text/javascript'>\n\t\tjQuery(document).ready(function() { \n\t\t\tvar oHierBrowser = caUI.initHierBrowser('{$ps_name}_hierarchyBrowser{n}', {\n\t\t\t\tuiStyle: '" . ($vs_render_as == 'vert_hierbrowser' ? 'vertical' : 'horizontal') . "',\n\t\t\t\tlevelDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyLevel', array('noSymbols' => 1)) . "',\n\t\t\t\tinitDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyAncestorList') . "',\n\t\t\t\t\n\t\t\t\tselectOnLoad : true,\n\t\t\t\tbrowserWidth: " . (int) $va_width['dimension'] . ",\n\t\t\t\t\n\t\t\t\tclassName: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserLevelVertical' : 'hierarchyBrowserLevel') . "',\n\t\t\t\tclassNameContainer: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserContainerVertical' : 'hierarchyBrowserContainer') . "',\n\t\t\t\t\n\t\t\t\teditButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_RIGHT_ARROW__) . "\",\n\t\t\t\tdisabledButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOT__) . "\",\n\t\t\t\tinitItemID: '{" . $pa_options['element_id'] . "}',\n\t\t\t\tdefaultItemID: '" . $t_list->getDefaultItemID() . "',\n\t\t\t\tuseAsRootID: '" . $t_root_item->getPrimaryKey() . "',\n\t\t\t\tindicatorUrl: '" . $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif',\n\t\t\t\t\n\t\t\t\tcurrentSelectionDisplayID: '{$ps_name}_browseCurrentSelectionText{n}',\n\t\t\t\tonSelection: function(item_id, parent_id, name, display) {\n\t\t\t\t\tjQuery('#{$ps_name}').val(item_id);\n\t\t\t\t}\n\t\t\t});";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "jQuery('#{$ps_name}_hierarchyBrowserSearch{n}').autocomplete(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noSymbols' => 1)) . "', \n\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\toHierBrowser.setUpHierarchy(ui.item.id);\t// jump browser to selected item\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);";
             }
             $vs_buf .= "});\n\t</script>";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "<div class='hierarchyBrowserSearchBar'>" . _t('Search') . ": <input type='text' id='{$ps_name}_hierarchyBrowserSearch{n}' class='hierarchyBrowserSearchBar' name='search' value='' size='20'/></div>";
             }
             if ($vs_render_as != 'vert_hierbrowser') {
                 $vs_buf .= "<div id='{$ps_name}_browseCurrentSelection{n}' class='hierarchyBrowserCurrentSelection'>" . _t("Current selection") . ": <span id='{$ps_name}_browseCurrentSelectionText{n}' class='hierarchyBrowserCurrentSelectionText'>?</span></div>";
             }
             $vs_buf .= caHTMLHiddenInput($ps_name, array('value' => "{" . $pa_options['element_id'] . "}", 'id' => $ps_name));
             return $vs_buf;
             break;
         case 'text':
             return caHTMLTextInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'options':
             return $va_options;
             break;
         default:
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLSelect($ps_name, $va_options, $pa_attributes, array_merge($pa_options, array('contentArrayUsesKeysForValues' => true, 'colors' => $va_colors, 'height' => null)));
             break;
     }
 }
 /**
  * Returns HTML search form input widget for bundle specified by standard "get" bundle code (eg. <table_name>.<bundle_name> format)
  * This method handles generation of search form widgets for (1) related tables (eg. ca_places),  preferred and non-preferred labels for both the 
  * primary and related tables, and all other types of elements for related tables. If this method can't handle the bundle it will pass the request to the 
  * superclass implementation of htmlFormElementForSearch()
  *
  * @param $po_request HTTPRequest
  * @param $ps_field string
  * @param $pa_options array
  * @return string HTML text of form element. Will return null (from superclass) if it is not possible to generate an HTML form widget for the bundle.
  * 
  */
 public function htmlFormElementForSearch($po_request, $ps_field, $pa_options = null)
 {
     $vb_as_array_element = (bool) caGetOption('asArrayElement', $pa_options, false);
     $va_tmp = explode('.', $ps_field);
     switch ($va_tmp[0]) {
         case '_fulltext':
             if (!isset($pa_options['width'])) {
                 $pa_options['width'] = 30;
             }
             if (!isset($pa_options['height'])) {
                 $pa_options['height'] = 30;
             }
             if (!isset($pa_options['values'])) {
                 $pa_options['values'] = array();
             }
             if (!isset($pa_options['values']['_fulltext'])) {
                 $pa_options['values'][$ps_field] = '';
             }
             return caHTMLTextInput("_fulltext" . ($vb_as_array_element ? "[]" : ""), array('value' => $pa_options['values']['_fulltext'], 'size' => $pa_options['width'], 'class' => $pa_options['class']), $pa_options);
             break;
         case '_fieldlist':
             if (!isset($pa_options['width'])) {
                 $pa_options['width'] = 30;
             }
             if (!isset($pa_options['height'])) {
                 $pa_options['height'] = 30;
             }
             if (!isset($pa_options['values'])) {
                 $pa_options['values'] = array();
             }
             $va_filter = $va_alt_names = $va_relationship_restricted_searches = null;
             if (is_array($va_fields = preg_split("![;,]+!", caGetOption('fields', $pa_options, null))) && sizeof($va_fields)) {
                 $va_filter = $va_alt_names = $va_relationship_restricted_searches = array();
                 foreach ($va_fields as $vs_field_raw) {
                     $va_tmp = explode(':', $vs_field_raw);
                     $va_tmp2 = explode('/', $va_tmp[0]);
                     // If there's a "/" separator then this is a relationship type-restricted search (Eg. ca_entities.preferred_labels.displayname/artist:"Isamu Noguchi")
                     if (sizeof($va_tmp2) > 1) {
                         $va_relationship_restricted_searches[$va_tmp2[0]][] = $va_tmp[0];
                     } else {
                         $va_filter[] = $va_tmp2[0];
                     }
                     if (isset($va_tmp[1]) && $va_tmp[1]) {
                         $va_alt_names[$va_tmp[0]] = $va_tmp[1];
                     }
                 }
             }
             $va_options = caGetBundlesAvailableForSearch($this->tableName(), array('forSelect' => true, 'filter' => $va_filter));
             // We need to add any relationship-restricted searh qualifiers here since they're not free-standing bundles but
             // rather variants on an unqualified relationship bundle
             foreach ($va_relationship_restricted_searches as $vs_without_rel_restriction => $va_with_rel_restrictions) {
                 foreach ($va_with_rel_restrictions as $vs_with_rel_restriction) {
                     $vs_label = isset($va_alt_names[$vs_with_rel_restriction]) ? $va_alt_names[$vs_with_rel_restriction] : $vs_with_rel_restriction;
                     $va_options[$vs_label] = $vs_with_rel_restriction;
                 }
             }
             if (is_array($va_alt_names)) {
                 foreach ($va_options as $vs_l => $vs_fld) {
                     if (isset($va_alt_names[$vs_fld])) {
                         unset($va_options[$vs_l]);
                         $va_options[$va_alt_names[$vs_fld]] = $vs_fld;
                     }
                 }
             }
             if (is_array($va_filter) && sizeof($va_filter)) {
                 // reorder options to keep field list order (sigh)
                 $va_options_tmp = array();
                 foreach ($va_filter as $vs_filter) {
                     if (($vs_k = array_search($vs_filter, $va_options)) !== false) {
                         $va_options_tmp[$vs_k] = $va_options[$vs_k];
                     }
                 }
                 $va_options = $va_options_tmp;
             }
             return caHTMLSelect("_fieldlist_field" . ($vb_as_array_element ? "[]" : ""), $va_options, array('size' => $pa_options['fieldListWidth'], 'class' => $pa_options['class']), array_merge($pa_options, array('value' => $pa_options['values']['_fieldlist_field'][0]))) . caHTMLTextInput("_fieldlist_value" . ($vb_as_array_element ? "[]" : ""), array('value' => $pa_options['values']['_fieldlist_value'], 'size' => $pa_options['width'], 'class' => $pa_options['class']), $pa_options);
             break;
     }
     if ($vs_rel_types = join(";", caGetOption('restrictToRelationshipTypes', $pa_options, array()))) {
         $vs_rel_types = "/{$vs_rel_types}";
     }
     if (!in_array($va_tmp[0], array('created', 'modified'))) {
         switch (sizeof($va_tmp)) {
             # -------------------------------------
             case 1:
                 // table_name
                 if ($va_tmp[0] != $this->tableName()) {
                     if (!is_array($pa_options)) {
                         $pa_options = array();
                     }
                     if (!isset($pa_options['width'])) {
                         $pa_options['width'] = 30;
                     }
                     if (!isset($pa_options['values'])) {
                         $pa_options['values'] = array();
                     }
                     if (!isset($pa_options['values'][$ps_field])) {
                         $pa_options['values'][$ps_field] = '';
                     }
                     return caHTMLTextInput($ps_field . $vs_rel_types . ($vb_as_array_element ? "[]" : ""), array('value' => $pa_options['values'][$ps_field], 'size' => $pa_options['width'], 'class' => $pa_options['class'], 'id' => str_replace('.', '_', $ps_field)));
                 }
                 break;
                 # -------------------------------------
             # -------------------------------------
             case 2:
                 // table_name.field_name
             // table_name.field_name
             case 3:
                 // table_name.field_name.sub_element
                 if (!($t_instance = $this->_DATAMODEL->getInstanceByTableName($va_tmp[0], true))) {
                     return null;
                 }
                 if ($va_tmp[0] != $this->tableName()) {
                     switch (sizeof($va_tmp)) {
                         case 1:
                             return caHTMLTextInput($ps_field . ($vb_as_array_element ? "[]" : ""), array('value' => $pa_options['values'][$ps_field], 'size' => $pa_options['width'], 'class' => $pa_options['class'], 'id' => str_replace('.', '_', $ps_field)));
                         case 2:
                         case 3:
                             if ($ps_render = caGetOption('render', $pa_options, null)) {
                                 switch ($ps_render) {
                                     case 'is_set':
                                         return caHTMLCheckboxInput($ps_field . $vs_rel_types, array('value' => '[SET]'));
                                         break;
                                 }
                             }
                             if (caGetOption('select', $pa_options, false)) {
                                 $va_access = caGetOption('checkAccess', $pa_options, null);
                                 if (!($t_instance = $this->_DATAMODEL->getInstanceByTableName($va_tmp[0], true))) {
                                     return null;
                                 }
                                 $vs_label_display_field = $t_instance->getLabelDisplayField();
                                 $va_find_params = array('parent_id' => null);
                                 switch ($va_tmp[0]) {
                                     case 'ca_list_items':
                                         if ($vs_list = caGetOption('list', $pa_options, null)) {
                                             if ($vn_list_id = caGetListID($vs_list)) {
                                                 $va_find_params = array('list_id' => $vn_list_id);
                                             }
                                         }
                                         break;
                                 }
                                 $qr_res = call_user_func_array($va_tmp[0] . '::find', array($va_find_params, array('sort' => caGetOption('sort', $pa_options, $t_instance->getLabelTableName() . '.' . $vs_label_display_field), 'returnAs' => 'searchResult')));
                                 $vs_pk = $t_instance->primaryKey();
                                 $va_opts = array('-' => '');
                                 $va_in_use_list = $vs_rel_pk = null;
                                 if (caGetOption('inUse', $pa_options, false)) {
                                     if (is_array($va_path = $this->_DATAMODEL->getPath($this->tableName(), $va_tmp[0]))) {
                                         $va_path = array_keys($va_path);
                                         if (sizeof($va_path) == 3) {
                                             if ($t_rel = $this->_DATAMODEL->getInstanceByTableName($va_tmp[0], true)) {
                                                 $vs_table = $this->tableName();
                                                 $vs_pk = $this->primaryKey();
                                                 $va_sql_wheres = array();
                                                 $va_sql_params = array();
                                                 if ($this->hasField('deleted')) {
                                                     $va_sql_wheres[] = "(t.deleted = 0)";
                                                 }
                                                 if ($this->hasField('access') && is_array($va_access) && sizeof($va_access)) {
                                                     $va_sql_wheres[] = "(t.access IN (?))";
                                                     $va_sql_params[] = $va_access;
                                                 }
                                                 $vs_rel_pk = $t_rel->primaryKey();
                                                 $qr_in_use = $this->getDb()->query("\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT DISTINCT l.{$vs_rel_pk}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$va_path[1]} l\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN {$vs_table} AS t ON t.{$vs_pk} = l.{$vs_pk}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . (sizeof($va_sql_wheres) > 0 ? "WHERE " . join(" AND ", $va_sql_wheres) : "") . "\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t", $va_sql_params);
                                                 $va_in_use_list = $qr_in_use->getAllFieldValues($vs_rel_pk);
                                             }
                                         }
                                     }
                                 }
                                 while ($qr_res->nextHit()) {
                                     if ($va_tmp[0] == 'ca_list_items' && !$qr_res->get('parent_id')) {
                                         continue;
                                     }
                                     if (is_array($va_access) && sizeof($va_access) && !in_array($qr_res->get($va_tmp[0] . '.access'), $va_access)) {
                                         continue;
                                     }
                                     if (is_array($va_in_use_list) && !in_array($vn_item_id = $qr_res->get($vs_rel_pk), $va_in_use_list)) {
                                         continue;
                                     }
                                     $va_opts[$qr_res->get($va_tmp[0] . ".preferred_labels.{$vs_label_display_field}")] = $qr_res->get($ps_field);
                                 }
                                 uksort($va_opts, "strnatcasecmp");
                                 return caHTMLSelect($ps_field . $vs_rel_types . ($vb_as_array_element ? "[]" : ""), $va_opts, array('value' => $pa_options['values'][$ps_field], 'class' => $pa_options['class'], 'id' => str_replace('.', '_', $ps_field)));
                             } else {
                                 return $t_instance->htmlFormElementForSearch($po_request, $ps_field, $pa_options);
                             }
                             break;
                     }
                 }
                 break;
                 # -------------------------------------
         }
     }
     return parent::htmlFormElementForSearch($po_request, $ps_field, $pa_options);
 }
 /**
  * Returns HTML form element for editing of setting
  */
 public function settingHTMLFormElement($ps_setting, $pa_options = null)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return false;
     }
     $va_available_settings = $this->getAvailableSettings();
     $va_properties = $va_available_settings[$ps_setting];
     if ((int) $this->get('parent_id') > 0 && isset($va_properties['validForRootOnly']) && $va_properties['validForRootOnly']) {
         return false;
     }
     $vs_input_name = "setting_{$ps_setting}";
     if (isset($pa_options['label_id'])) {
         $vs_label_id = $pa_options['label_id'];
     } else {
         $vs_label_id = "setting_{$ps_setting}_label";
     }
     $vs_return = "\n" . '<div class="formLabel">' . "\n";
     $vs_return .= '<span class="' . $vs_label_id . '">' . $va_properties['label'] . '</span><br />' . "\n";
     switch ($va_properties['displayType']) {
         # --------------------------------------------
         case DT_FIELD:
             if ($va_properties["height"] == 1) {
                 $vs_return .= '<input name="' . $vs_input_name . '" type="text" size="' . $va_properties["width"] . '" value="' . $this->getSetting($ps_setting) . '" />' . "\n";
             } else {
                 if ($va_properties["height"] > 1) {
                     $vs_return .= '<textarea name="' . $vs_input_name . '" cols="' . $va_properties["width"] . '" rows="' . $va_properties["height"] . '">' . $this->getSetting($ps_setting) . '</textarea>' . "\n";
                 }
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_PASSWORD:
             $vs_return .= '<input name="' . $vs_input_name . '" type="password" size="' . $va_properties["width"] . '" value="' . $this->getSetting($ps_setting) . '" />' . "\n";
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_CHECKBOXES:
             $va_attributes = array('value' => '1');
             if (trim($this->getSetting($ps_setting))) {
                 $va_attributes['checked'] = '1';
             }
             $vs_return .= caHTMLCheckboxInput($vs_input_name, $va_attributes);
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_SELECT:
             $vn_width = isset($va_properties['width']) && strlen($va_properties['width']) > 0 ? $va_properties['width'] : "100px";
             $vn_height = isset($va_properties['height']) && strlen($va_properties['height']) > 0 ? $va_properties['height'] : "50px";
             if (!$vs_input_id) {
                 $vs_input_id = $vs_input_name;
             }
             if ($vn_height > 1) {
                 $va_attr['multiple'] = 1;
                 $vs_input_name .= '[]';
             }
             $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height);
             $vm_value = $this->getSetting($ps_setting);
             if (is_array($vm_value)) {
                 $va_opts['values'] = $vm_value;
             } else {
                 $va_opts['value'] = $vm_value;
                 if (!isset($va_opts['value'])) {
                     $va_opts['value'] = -1;
                 }
                 // make sure default list item is never selected
             }
             // reload settings form when value for this element changes
             if (isset($va_properties['refreshOnChange']) && (bool) $va_properties['refreshOnChange']) {
                 $va_attr['onchange'] = "caSetElementsSettingsForm({ {$vs_input_id} : jQuery(this).val() }); return false;";
             }
             $vs_return .= caHTMLSelect($vs_input_name, $va_properties['options'], $va_attr, $va_opts);
             break;
             # --------------------------------------------
         # --------------------------------------------
         default:
             break;
             # --------------------------------------------
     }
     $vs_return .= '</div>' . "\n";
     TooltipManager::add('.' . $vs_label_id, "<h3>" . $va_properties["label"] . "</h3>" . $va_properties["description"]);
     return $vs_return;
 }
print caHTMLTextInput('skip_file_list', array('value' => $va_last_settings['skipFileList'], 'id' => "caSkipFilesList"), array('width' => '700px', 'height' => '100px'));
?>
							</p>
						</div>
					</div>
			</div>
			<div class='bundleLabel'>
				<span class="formLabelText"><?php 
print _t('Miscellaneous');
?>
</span>
					<div class="bundleContainer">
						<div class="caLabelList" >
							<p class='formLabel'>
	<?php 
print caHTMLCheckboxInput('allow_duplicate_media', array('value' => 1, 'id' => 'caAllowDuplicateMedia', 'checked' => $va_last_settings['allowDuplicateMedia']), array());
print " " . _t('Allow duplicate media?');
?>
							</p>
							<p class='formLabel'>
	<?php 
print _t('Log level') . '<br/>';
print caHTMLSelect('log_level', caGetLogLevels(), array('id' => 'caLogLevel'), array('value' => $va_last_settings['logLevel']));
?>
							</p>
						</div>
					</div>
			</div>
		</div>

<?php 
Beispiel #12
0
?>
	<textarea class='caItemTemplate' style='display: none;'>
		<div id="<?php 
print $vs_id_prefix;
?>
Item_{n}" class="labelInfo">
			<span class="formLabelError">{error}</span>
			<table class="objectRepresentationListItem" width="90%"><?php 
$vn_c = 0;
if (sizeof($va_set_options)) {
    foreach ($va_set_options as $vn_set_id => $vs_set_name) {
        if ($vn_c == 0) {
            print "<tr>";
        }
        print "<td width='33%'><div class='formLabel'>\n";
        print caHTMLCheckboxInput('{fieldNamePrefix}' . $vn_set_id . '_0_{n}', array('value' => $vn_set_id, 'id' => '{fieldNamePrefix}' . $vn_set_id . '_0_{n}'), array()) . " {$vs_set_name}";
        print "</div></td>";
        $vn_c++;
        if ($vn_c == 3) {
            print "</tr>\n";
            $vn_c = 0;
        }
    }
    if ($vn_c > 0) {
        print "</tr>\n";
    }
} else {
    print "<tr><td>" . _t('No sets are available') . "</td></tr>\n";
}
?>
			</table>
    }
    // will return null if group name is not a table name; true if it's an enabled table and false if it's a disabled table
    $vs_check_all_link = '<a href="#" onclick="jQuery(\'.role_action_group_' . $vs_group . '\').attr(\'checked\', true); return false;" class="roleCheckAllNoneButton">' . _t('All') . '</a>';
    $vs_check_none_link = '<a href="#" onclick="jQuery(\'.role_action_group_' . $vs_group . '\').attr(\'checked\', false); return false;" class="roleCheckAllNoneButton">' . _t('None') . '</a>';
    print "<tr><td colspan='" . $vn_num_cols * 2 . "' class='formLabel roleCheckGroupHeading'><span id='group_label_" . $vs_group . "'>" . $va_group_info['label'] . "</span> <span class='roleCheckAllNoneButtons'>{$vs_check_all_link}/{$vs_check_none_link}</span></td></tr>\n";
    TooltipManager::add('#group_label_' . $vs_group, "<h3>" . $va_group_info['label'] . "</h3>" . $va_group_info['description']);
    foreach ($va_group_info['actions'] as $vs_action => $va_action_info) {
        if ($vn_c == 0) {
            print "<tr valign='top'>";
        }
        $va_attributes = array('value' => 1);
        if (in_array($vs_action, $va_current_actions)) {
            $va_attributes['checked'] = 1;
        }
        $va_attributes['class'] = 'role_action_group_' . $vs_group;
        print "<td>" . caHTMLCheckboxInput($vs_action, $va_attributes) . "</td><td width='120'><span id='role_label_" . $vs_action . "'>" . $va_action_info['label'] . "</span></td>";
        TooltipManager::add('#role_label_' . $vs_action, "<h3>" . $va_action_info['label'] . "</h3>" . $va_action_info['description']);
        $vn_c++;
        if ($vn_c >= $vn_num_cols) {
            $vn_c = 0;
            print "</tr>\n";
        }
    }
    if ($vn_c > 0) {
        print "</tr>\n";
    }
    $vn_c = 0;
}
?>
			</table>
		</div>
Beispiel #14
0
            print " (<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, '', 'Sets', 'SelectRepresentations', array('object_id' => $va_item['row_id'], 'item_id' => $va_item['item_id'])) . "\", function() { jQuery(\"#selectRepsCount{$vn_item_id}\").load(\"" . caNavUrl($this->request, '', 'Sets', 'GetSelectedRepresentationCount', array('item_id' => $vn_item_id)) . "\"); }); return false;' >" . _t("change") . "</a>)" . "</div>";
            # --- output special halep text if there are any audio or video reps associated with this object
            $t_order_objects->load($va_item['row_id']);
            if ($t_order_objects->numberOfRepresentationsOfClass("audio") || $t_order_objects->numberOfRepresentationsOfClass("video")) {
                print "<p>This record contains audio and/or video materials.  If this is what you are interested in purchasing please add your inquiry in the messaging system on the right of the screen.</p>";
            }
            print "<div class='setItemServicesForm'><form action='#' id='setItemServices<?php print {$vn_item_id}; ?>'>";
            $va_service_list = $t_order_item->getFieldInfo('service', 'BOUNDS_CHOICE_LIST');
            foreach ($t_order_item->getServiceGroups() as $vs_group_code => $va_group_info) {
                print "<br style='clear: both;'/><div style='margin-top: 10px;'><strong>" . $va_group_info['label'] . "</strong> " . (mb_strtolower($va_group_info['label']) == "usage" ? "&nbsp;<a href='" . caNavUrl($this->request, "", "About", "faq") . "#usage'>" . _t("Why do I need usage?") . "</a>" : "") . "</div>\n";
                foreach ($va_group_info['services'] as $vs_service_code => $va_service_info) {
                    $va_opts = array('value' => $vn_item_id . '|' . $vs_service_code);
                    if (in_array($vs_service_code, $va_item['selected_services'])) {
                        $va_opts['checked'] = 1;
                    }
                    print "<div class='serviceItem'><div style='float: left;'>" . caHTMLCheckboxInput('setItemServices_' . $vn_item_id, $va_opts) . "</div><div>" . $va_service_info['label'] . "</div></div>";
                }
            }
            print "</form></div>";
            ?>
						</div><!-- end setItemInfo -->
					</div>
					<div style="clear:both; height:1px;"><!-- empty --></div>
				</li>
<?php 
        }
    }
    ?>
		</ul>
	</div><!-- end setItems -->
</div><!-- leftCol -->
    ?>
">
<?php 
    foreach ($va_reps as $va_rep) {
        $va_attributes = array('value' => $va_rep['representation_id']);
        if (in_array($va_rep['representation_id'], $va_selected_rep_ids)) {
            $va_attributes['checked'] = 1;
        }
        ?>
		<div class="caObjectRepresentationChooserRepresentation">
			<?php 
        print $va_rep['tags']['preview170'];
        ?>
			<?php 
        if (!$vb_read_only) {
            print caHTMLCheckboxInput("{$vs_id_prefix}[]", $va_attributes);
        }
        ?>
		</div>
<?php 
    }
    ?>
		<br class="clear"/>
	</div>
<?php 
} else {
    ?>
	<div class="caObjectRepresentationChooserContainer" id="<?php 
    print $vs_id_prefix;
    ?>
">
<?php 
print caHTMLTextInput('set_name', array('id' => 'caCreateSetFromResultsInput', 'class' => 'searchSetsTextInput', 'value' => $o_result_context->getSearchExpression()), array('width' => '150px'));
print " ";
print caHTMLSelect('set_create_mode', array(_t('from results') => 'from_results', _t('from checked') => 'from_checked'), array('id' => 'caCreateSetFromResultsMode', 'class' => 'searchSetsSelect'), array('value' => null, 'width' => '140px'));
if ($t_list->getAppConfig()->get('enable_set_type_controls')) {
    print $t_list->getListAsHTMLFormElement('set_types', 'set_type', array('id' => 'caCreateSetTypeID', 'class' => 'searchSetsSelect'), array('value' => null, 'width' => '140px'));
}
print caBusyIndicatorIcon($this->request, array('id' => 'caCreateSetFromResultsIndicator')) . "\n";
?>
			<a href='#' onclick="caCreateSetFromResults(); return false;" class="button"><?php 
print _t('Create');
?>
 &rsaquo;</a>
<?php 
if ($this->request->user->canDoAction('can_batch_edit_' . $t_subject->tableName())) {
    print '<div class="searchSetsBatchEdit">' . caHTMLCheckboxInput('batch_edit', array('id' => 'caCreateSetBatchEdit', 'value' => 1)) . " " . _t('Open set for batch editing') . "</div>\n";
}
?>
		</form>
	</div>


		<a href='#' id='hideSets' onclick='caHideSearchSetTools(); $(".setTools").slideDown(250); '><?php 
print caNavIcon($this->request, __CA_NAV_BUTTON_COLLAPSE__);
?>
</a>
		<div style='clear:both;height:1px;'>&nbsp;</div>
</div><!-- end searchSetTools -->

<script type="text/javascript">
	function caShowSearchSetTools() {
Beispiel #17
0
 /**
  * Returns HTML form element for editing of setting
  *
  * Options:
  *
  * 	'name' => sets the name of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  *  'value' => sets the value of the HTML form element explicitly, otherwise the current value for the setting in the loaded row is used
  */
 public function settingHTMLFormElement($ps_widget_id, $ps_setting, $pa_options = null)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return false;
     }
     $va_available_settings = $this->getAvailableSettings();
     $va_properties = $va_available_settings[$ps_setting];
     if (isset($pa_options['name'])) {
         $vs_input_name = $pa_options['name'];
     } else {
         $vs_input_name = "setting_{$ps_setting}";
     }
     if (isset($pa_options['value']) && !is_null($pa_options['value'])) {
         $vs_value = $pa_options['value'];
     } else {
         $vs_value = $this->getSetting(trim($ps_setting));
     }
     $vs_element = '';
     switch ($va_properties['displayType']) {
         # --------------------------------------------
         case DT_FIELD:
             $vb_takes_locale = false;
             if (isset($va_properties['takesLocale']) && $va_properties['takesLocale']) {
                 $vb_takes_locale = true;
                 $va_locales = ca_locales::getLocaleList(array('sort_field' => '', 'sort_order' => 'asc', 'index_by_code' => true));
             } else {
                 $va_locales = array('_generic' => array());
             }
             foreach ($va_locales as $vs_locale => $va_locale_info) {
                 if ($vb_takes_locale) {
                     $vs_locale_label = " (" . $va_locale_info['name'] . ")";
                     $vs_input_name_suffix = '_' . $vs_locale;
                 } else {
                     $vs_input_name_suffix = $vs_locale_label = '';
                 }
                 $vs_element .= caHTMLTextInput($vs_input_name . $vs_input_name_suffix, array('size' => $va_properties["width"], 'height' => $va_properties["height"], 'value' => $vs_value, 'id' => $vs_input_name . $vs_input_name_suffix)) . "{$vs_locale_label}";
                 // focus code is needed by Firefox for some reason
                 $vs_element .= "<script type='text/javascript'>jQuery('#" . $vs_input_name . $vs_input_name_suffix . "').click(function() { this.focus(); });</script>";
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_CHECKBOXES:
             $va_attributes = array('value' => '1');
             if ($vs_value) {
                 $va_attributes['checked'] = '1';
             }
             $vs_element .= caHTMLCheckboxInput($vs_input_name, $va_attributes);
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_SELECT:
             if (!is_array($va_properties['options'])) {
                 $va_properties['options'] = array();
             }
             $vs_element .= caHTMLSelect($vs_input_name, $va_properties['options'], array(), array('value' => $vs_value));
             break;
             # --------------------------------------------
         # --------------------------------------------
         default:
             break;
             # --------------------------------------------
     }
     $vs_label = $va_properties['label'];
     $vb_element_is_part_of_label = false;
     if (strpos($vs_label, '^ELEMENT') !== false) {
         $vs_label = str_replace('^ELEMENT', $vs_element, $vs_label);
         $vb_element_is_part_of_label = true;
     }
     $vs_return = "\n" . '<div class="formLabel" id="_widget_setting_' . $ps_setting . '_' . $ps_widget_id . '"><span>' . $vs_label . '</span>';
     if (!$vb_element_is_part_of_label) {
         $vs_return .= '<br />' . $vs_element;
     }
     $vs_return .= '</div>' . "\n";
     TooltipManager::add('#_widget_setting_' . $ps_setting . '_' . $ps_widget_id, "<h3>" . str_replace('^ELEMENT', 'X', $va_properties["label"]) . "</h3>" . $va_properties["description"]);
     return $vs_return;
 }
foreach (array('ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections') as $vs_rel_table) {
    if ($o_config->get("{$vs_rel_table}_disable")) {
        continue;
    }
    if (!($t_rel_table = $t_object->getAppDatamodel()->getInstanceByTableName($vs_rel_table))) {
        continue;
    }
    $t_rel = ca_relationship_types::getRelationshipTypeInstance('ca_objects', $vs_rel_table);
    if (!$t_rel) {
        continue;
    }
    ?>
								<tr>
									<td class='formLabel'>
<?php 
    print caHTMLCheckboxInput('create_relationship_for[]', array('value' => $vs_rel_table, 'id' => "caCreateRelationshipForMedia{$vs_rel_table}", 'onclick' => "jQuery('#caRelationshipTypeIdFor{$vs_rel_table}').prop('disabled', !jQuery('#caCreateRelationshipForMedia{$vs_rel_table}').prop('checked'))"), array('dontConvertAttributeQuotesToEntities' => true));
    print ' ' . _t("to %1 with relationship type", $t_rel_table->getProperty('NAME_SINGULAR'));
    ?>
									
									</td>
									<td class='formLabel'>
<?php 
    print $t_rel->getRelationshipTypesAsHTMLSelect('ltor', null, null, array('name' => "relationship_type_id_for_{$vs_rel_table}", 'id' => "caRelationshipTypeIdFor{$vs_rel_table}", 'disabled' => 1));
    ?>
							
									</td>								
								</tr>
<?php 
}
?>
							</table>