本文整理汇总了PHP中ca_metadata_elements::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getInstance方法的具体用法?PHP ca_metadata_elements::getInstance怎么用?PHP ca_metadata_elements::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_metadata_elements
的用法示例。
在下文中一共展示了ca_metadata_elements::getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
public function __call($ps_function, $pa_args)
{
$ps_function = strtolower($ps_function);
if (!($va_form_info = $this->_checkForm($ps_function))) {
return;
}
$this->view->setVar('t_subject', $t_subject = $this->pt_subject);
$va_tags = $this->view->getTagList($va_form_info['view']);
foreach ($va_tags as $vs_tag) {
if (in_array($vs_tag, array('form', '/form', 'submit', 'reset'))) {
continue;
}
$va_parse = caParseTagOptions($vs_tag);
$vs_tag_proc = $va_parse['tag'];
$va_opts = $va_parse['options'];
if (($vs_default_value = caGetOption('default', $va_opts, null)) || ($vs_default_value = caGetOption($vs_tag_proc, $va_default_form_values, null))) {
$va_default_form_values[$vs_tag_proc] = $vs_default_value;
unset($va_opts['default']);
}
$vs_tag_val = null;
switch (strtolower($vs_tag_proc)) {
case 'submit':
$this->view->setVar($vs_tag, "<a href='#' class='caContributeFormSubmit'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Submit')) . "</a>");
break;
case 'reset':
$this->view->setVar($vs_tag, "<a href='#' class='caContributeFormReset'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Reset')) . "</a>");
$vs_script = "<script type='text/javascript'>\n\tjQuery('.caContributeFormSubmit').bind('click', function() {\n\t\tjQuery('#caContribute').submit();\n\t\treturn false;\n\t});\n\tjQuery('.caContributeFormReset').bind('click', function() {\n\t\tjQuery('#caContribute').find('input[type!=\"hidden\"],textarea').val('');\n\t\tjQuery('#caContribute').find('select.caContributeBoolean').val('AND');\n\t\tjQuery('#caContribute').find('select').prop('selectedIndex', 0);\n\t\treturn false;\n\t});\n\tjQuery(document).ready(function() {\n\t\tvar f, defaultValues = " . json_encode($va_default_form_values) . ", defaultBooleans = " . json_encode($va_default_form_booleans) . ";\n\t\tfor (f in defaultValues) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('input[name=\"' + f_proc+ '\"], textarea[name=\"' + f_proc+ '\"], select[name=\"' + f_proc+ '\"]').each(function(k, v) {\n\t\t\t\tif (defaultValues[f][k]) { jQuery(v).val(defaultValues[f][k]); } \n\t\t\t});\n\t\t}\n\t\tfor (f in defaultBooleans) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('select[name=\"' + f_proc+ '\"].caContributeBoolean').each(function(k, v) {\n\t\t\t\tif (defaultBooleans[f][k]) { jQuery(v).val(defaultBooleans[f][k]); }\n\t\t\t});\n\t\t}\n\t});\n</script>\n";
break;
default:
if (preg_match("!^(.*):label\$!", $vs_tag_proc, $va_matches)) {
$this->view->setVar($vs_tag, $vs_tag_val = $t_subject->getDisplayLabel($va_matches[1]));
} else {
$va_opts['asArrayElement'] = true;
if ($vs_tag_val = $t_subject->htmlFormElementForSimpleForm($this->request, $vs_tag_proc, $va_opts)) {
$this->view->setVar($vs_tag, $vs_tag_val);
}
$va_tmp = explode('.', $vs_tag_proc);
if (($t_element = ca_metadata_elements::getInstance($va_tmp[1])) && $t_element->get('datatype') == 0) {
if (is_array($va_elements = $t_element->getElementsInSet())) {
foreach ($va_elements as $va_element) {
if ($va_element['datatype'] > 0) {
$va_form_elements[] = $va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code'];
}
}
}
break;
}
}
if ($vs_tag_val) {
$va_form_elements[] = $vs_tag_proc;
}
break;
}
}
$this->view->setVar("form", caFormTag($this->request, "Send", 'caContribute', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true)));
$this->view->setVar("/form", $vs_script . caHTMLHiddenInput("_contributeFormName", array("value" => $ps_function)) . caHTMLHiddenInput("_formElements", array("value" => join(';', $va_form_elements))) . caHTMLHiddenInput("_contribute", array("value" => 1)) . "</form>");
$this->render($va_form_info['view']);
}
示例2: getPlacements
/**
* Returns list of placements for the currently loaded display.
*
* @param array $pa_options Optional array of options. Supports the following options:
* noCache = if set to true then the returned list if always generated directly from the database, otherwise it is returned from the cache if possible. Set this to true if you expect the cache may be stale. Default is false.
* returnAllAvailableIfEmpty = if set to true then the list of all available bundles will be returned if the currently loaded display has no placements, or if there is no display loaded
* table = if using the returnAllAvailableIfEmpty option and you expect a list of available bundles to be returned if no display is loaded, you must specify the table the bundles are intended for use with with this option. Either the table name or number may be used.
* user_id = if specified then placements are only returned if the user has at least read access to the display
* settingsOnly = if true the settings forms are omitted and only setting values are returned; default is false
* @return array List of placements in display order. Array is keyed on bundle name. Values are arrays with the following keys:
* placement_id = primary key of ca_bundle_display_placements row - a unique id for the placement
* bundle_name = bundle name (a code - not for display)
* settings = array of placement settings. Keys are setting names.
* display = display string for bundle
*/
public function getPlacements($pa_options = null)
{
$pb_no_cache = isset($pa_options['noCache']) ? (bool) $pa_options['noCache'] : false;
$pb_settings_only = isset($pa_options['settingsOnly']) ? (bool) $pa_options['settingsOnly'] : false;
$pb_return_all_available_if_empty = isset($pa_options['returnAllAvailableIfEmpty']) && !$pb_settings_only ? (bool) $pa_options['returnAllAvailableIfEmpty'] : false;
$ps_table = isset($pa_options['table']) ? $pa_options['table'] : null;
$pn_user_id = isset($pa_options['user_id']) ? $pa_options['user_id'] : null;
if ($pn_user_id && !$this->haveAccessToDisplay($pn_user_id, __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
return array();
}
if (!($vn_display_id = $this->getPrimaryKey())) {
if ($pb_return_all_available_if_empty && $ps_table) {
return ca_bundle_displays::$s_placement_list_cache[$vn_display_id] = $this->getAvailableBundles($ps_table);
}
return array();
}
$vs_cache_key = $vn_display_id . '/' . ($pb_settings_only ? 1 : 0);
if (!$pb_no_cache && isset(ca_bundle_displays::$s_placement_list_cache[$vs_cache_key]) && ca_bundle_displays::$s_placement_list_cache[$vs_cache_key]) {
return ca_bundle_displays::$s_placement_list_cache[$vs_cache_key];
}
$o_dm = $this->getAppDatamodel();
$o_db = $this->getDb();
$t_list = new ca_lists();
if ($this->inTransaction()) {
$t_list->setTransaction($this->getTransaction());
}
$qr_res = $o_db->query("\n\t\t\tSELECT placement_id, bundle_name, settings\n\t\t\tFROM ca_bundle_display_placements\n\t\t\tWHERE\n\t\t\t\tdisplay_id = ?\n\t\t\tORDER BY rank\n\t\t", (int) $vn_display_id);
$va_available_bundles = $pb_settings_only ? array() : $this->getAvailableBundles(null, $pa_options);
$va_placements = array();
if ($qr_res->numRows() > 0) {
$vs_subject_table = $o_dm->getTableName($this->get('table_num'));
$t_subject = $o_dm->getInstanceByTableNum($this->get('table_num'), true);
$t_placement = new ca_bundle_display_placements();
if ($this->inTransaction()) {
$t_placement->setTransaction($this->getTransaction());
}
while ($qr_res->nextRow()) {
$vs_bundle_name = $qr_res->get('bundle_name');
$va_bundle_name = explode(".", $vs_bundle_name);
$va_placements[$vn_placement_id = (int) $qr_res->get('placement_id')] = $qr_res->getRow();
$va_placements[$vn_placement_id]['settings'] = $va_settings = caUnserializeForDatabase($qr_res->get('settings'));
if (!$pb_settings_only) {
$t_placement->setSettingDefinitionsForPlacement($va_available_bundles[$vs_bundle_name]['settings']);
$va_placements[$vn_placement_id]['display'] = $va_available_bundles[$vs_bundle_name]['display'];
$va_placements[$vn_placement_id]['settingsForm'] = $t_placement->getHTMLSettingForm(array('id' => $vs_bundle_name . '_' . $vn_placement_id, 'settings' => $va_settings));
} else {
$va_tmp = explode('.', $vs_bundle_name);
$t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true);
$va_placements[$vn_placement_id]['display'] = $t_instance ? $t_instance->getDisplayLabel($vs_bundle_name) : "???";
}
if ($va_bundle_name[0] == $vs_subject_table) {
// Only primary fields are inline-editable
// Check if it is one of the types of fields that is inline editable
if ($va_bundle_name[1] == 'preferred_labels') {
// Preferred labels are inline editable
$va_placements[$vn_placement_id]['allowInlineEditing'] = true;
$va_placements[$vn_placement_id]['inlineEditingType'] = DT_FIELD;
} elseif ($t_subject->hasField($va_bundle_name[1])) {
//
// Intrinsics are editable, except for type_id
//
if ($va_bundle_name[1] == $t_subject->getTypeFieldName()) {
$va_placements[$vn_placement_id]['allowInlineEditing'] = false;
$va_placements[$vn_placement_id]['inlineEditingType'] = null;
} else {
if (isset($va_bundle_name[1])) {
// check if identifier is editable
$id_editable = $t_subject->opo_idno_plugin_instance->isFormatEditable($vs_subject_table);
// Do not allow in-line editing if the intrinsic element is identifier and
// a). is not editable (editable = 0 in multipart_id_numbering.conf)
// b). consists of multiple elements
if ($va_bundle_name[1] == $t_subject->getProperty('ID_NUMBERING_ID_FIELD') && $id_editable == false) {
$va_placements[$vn_placement_id]['allowInlineEditing'] = false;
} else {
$va_placements[$vn_placement_id]['allowInlineEditing'] = true;
}
}
switch ($t_subject->getFieldInfo($va_bundle_name[1], 'DISPLAY_TYPE')) {
case 'DT_SELECT':
if (($vs_list_code = $t_subject->getFieldInfo($va_bundle_name[1], 'LIST')) || ($vs_list_code = $t_subject->getFieldInfo($va_bundle_name[1], 'LIST_CODE'))) {
$va_placements[$vn_placement_id]['inlineEditingType'] = DT_SELECT;
if (!is_array($va_list_labels = $t_list->getItemsForList($vs_list_code, array('labelsOnly' => true)))) {
$va_list_labels = array();
}
$va_placements[$vn_placement_id]['inlineEditingListValues'] = array_values($va_list_labels);
//.........这里部分代码省略.........
示例3: processMetadataElement
private function processMetadataElement($po_element, $pn_parent_id)
{
require_once __CA_MODELS_DIR__ . "/ca_metadata_elements.php";
require_once __CA_MODELS_DIR__ . "/ca_lists.php";
if (($vn_datatype = ca_metadata_elements::getAttributeTypeCode(self::getAttribute($po_element, "datatype"))) === false) {
return false;
// should not happen due to XSD restrictions, but just in case
}
$vs_element_code = self::getAttribute($po_element, "code");
$t_lists = new ca_lists();
if ($this->opb_updating) {
$t_md_element = ca_metadata_elements::getInstance($vs_element_code) ? ca_metadata_elements::getInstance($vs_element_code) : new ca_metadata_elements();
} else {
$t_md_element = new ca_metadata_elements();
}
$t_md_element->setMode(ACCESS_WRITE);
$t_md_element->set('element_code', $vs_element_code);
$t_md_element->set('parent_id', $pn_parent_id);
$t_md_element->set('documentation_url', (string) $po_element->documentationUrl);
$t_md_element->set('datatype', $vn_datatype);
$vs_list = self::getAttribute($po_element, "list");
if (isset($vs_list) && $vs_list && $t_lists->load(array('list_code' => $vs_list))) {
$vn_list_id = $t_lists->getPrimaryKey();
} else {
$vn_list_id = null;
}
$t_md_element->set('list_id', $vn_list_id);
$this->_processSettings($t_md_element, $po_element->settings);
if ($t_md_element->getPrimaryKey()) {
$t_md_element->update();
} else {
$t_md_element->insert();
}
if ($t_md_element->numErrors()) {
$this->addError("There was an error while inserting metadata element {$vs_element_code}: " . join(" ", $t_md_element->getErrors()));
return false;
}
$vn_element_id = $t_md_element->getPrimaryKey();
// add element labels
self::addLabelsFromXMLElement($t_md_element, $po_element->labels, $this->opa_locales);
if ($po_element->elements) {
foreach ($po_element->elements->children() as $vo_child) {
$this->processMetadataElement($vo_child, $vn_element_id);
}
}
return $vn_element_id;
}
示例4: getFacet
public function getFacet($pa_options = null)
{
$va_access_values = caGetUserAccessValues($this->request);
$ps_facet_name = $this->request->getParameter('facet', pString);
$this->view->setVar('only_show_group', $vs_show_group = $this->request->getParameter('show_group', pString));
$this->view->setVar('grouping', $vs_grouping = $this->request->getParameter('grouping', pString));
$this->view->setVar('id', $vm_id = $this->request->getParameter('id', pString));
$vs_cache_key = md5(join("/", array($ps_facet_name, $vs_show_group, $vs_grouping, $vm_id)));
$va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name);
if ($va_facet_info['group_mode'] != 'hierarchical' && ($vs_content = $this->opo_browse->getCachedFacetHTML($vs_cache_key))) {
$this->response->addContent($vs_content);
return;
}
// Enforce type restriction
$this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
if ($this->request->getParameter('clear', pInteger)) {
$this->opo_browse->removeAllCriteria();
$this->opo_browse->execute(array('checkAccess' => $va_access_values));
$this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
$this->opo_result_context->saveContext();
} else {
if ($this->request->getParameter('modify', pString)) {
$this->opo_browse->removeCriteria($ps_facet_name, array($vm_id));
$this->opo_browse->execute(array('checkAccess' => $va_access_values));
$this->view->setVar('modify', $vm_id);
}
}
// Using the back-button can cause requests for facets that are no longer available
// In these cases we reset the browse.
if (!($va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values)))) {
$this->opo_browse->removeAllCriteria();
$this->opo_browse->execute();
$va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values));
$va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name);
$this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
$this->opo_result_context->saveContext();
}
$this->view->setVar('browse_last_id', (int) $vm_id ? (int) $vm_id : (int) $this->opo_result_context->getParameter($ps_facet_name . '_browse_last_id'));
$this->view->setVar('facet', $va_facet);
$va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name);
if ($va_facet_info['type'] == 'attribute') {
// set table for authority element so browse can use table-specific services (Eg. entity lookups for attributes of type Entity)
if ($t_element = ca_metadata_elements::getInstance($va_facet_info['element_code'])) {
if ($t_authority = AuthorityAttributeValue::elementTypeToInstance($t_element->get('datatype'))) {
$va_facet_info['table'] = $t_authority->tableName();
}
}
}
$this->view->setVar('facet_info', $va_facet_info);
$this->view->setVar('facet_name', $ps_facet_name);
$this->view->setVar('individual_group_display', isset($va_facet_info['individual_group_display']) ? (bool) $va_facet_info['individual_group_display'] : false);
// this should be 'facet' but we don't want to render all old 'ajax_browse_facet_html' views (pawtucket themes) unusable
$this->view->setVar('grouped_facet', $this->opo_browse->getFacetWithGroups($ps_facet_name, $va_facet_info["group_mode"], $vs_grouping, array('sort' => 'name', 'checkAccess' => $va_access_values)));
// generate type menu and type value list for related authority table facet
if ($va_facet_info['type'] === 'authority') {
$t_model = $this->opo_datamodel->getTableInstance($va_facet_info['table']);
if (method_exists($t_model, "getTypeList")) {
$this->view->setVar('type_list', $t_model->getTypeList());
}
$t_rel_types = new ca_relationship_types();
$this->view->setVar('relationship_type_list', $t_rel_types->getRelationshipInfo($va_facet_info['relationship_table']));
$this->view->setVar('t_item', $t_model);
}
$this->view->setVar('t_subject', $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true));
$this->opo_result_context->saveContext();
if (isset($pa_options['view']) && $pa_options['view']) {
$vs_content = $this->render($pa_options['view']);
} else {
$vs_content = $this->render('Browse/ajax_browse_facet_html.php');
}
$this->opo_browse->setCachedFacetHTML($vs_cache_key, $vs_content);
}
示例5: advanced
/**
*
*/
public function advanced()
{
$o_config = caGetSearchConfig();
$ps_function = strtolower($this->request->getActionExtra());
if (!($va_search_info = caGetInfoForAdvancedSearchType($ps_function))) {
// invalid advanced search type – throw error
die("Invalid advanced search type");
}
$vs_class = $va_search_info['table'];
$va_types = caGetOption('restrictToTypes', $va_search_info, array(), array('castTo' => 'array'));
$this->opo_result_context = new ResultContext($this->request, $va_search_info['table'], $this->ops_find_type . '_advanced');
$this->opo_result_context->setAsLastFind();
MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search %1", $va_search_info["displayName"]));
$this->view->setVar('searchInfo', $va_search_info);
$this->view->setVar('options', caGetOption('options', $va_search_info, array(), array('castTo' => 'array')));
$va_default_form_values = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormContent_{$ps_function}");
$va_default_form_booleans = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormBooleans_{$ps_function}");
$va_tags = $this->view->getTagList($va_search_info['view']);
$t_subject = $this->request->datamodel->getInstanceByTableName($va_search_info['table'], true);
$va_form_elements = array();
$vs_script = null;
foreach ($va_tags as $vs_tag) {
$va_parse = caParseTagOptions($vs_tag);
$vs_tag_proc = $va_parse['tag'];
$va_opts = $va_parse['options'];
if (($vs_default_value = caGetOption('default', $va_opts, null)) || ($vs_default_value = caGetOption($vs_tag_proc, $va_default_form_values, null))) {
$va_default_form_values[$vs_tag_proc] = $vs_default_value;
unset($va_opts['default']);
}
$vs_tag_val = null;
switch (strtolower($vs_tag_proc)) {
case 'submit':
$this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormSubmit'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Submit')) . "</a>");
break;
case 'reset':
$this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormReset'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Reset')) . "</a>");
$vs_script = "<script type='text/javascript'>\n\tjQuery('.caAdvancedSearchFormSubmit').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').submit();\n\t\treturn false;\n\t});\n\tjQuery('.caAdvancedSearchFormReset').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').find('input[type!=\"hidden\"],textarea').val('');\n\t\tjQuery('#caAdvancedSearch').find('select.caAdvancedSearchBoolean').val('AND');\n\t\tjQuery('#caAdvancedSearch').find('select').prop('selectedIndex', 0);\n\t\treturn false;\n\t});\n\tjQuery(document).ready(function() {\n\t\tvar f, defaultValues = " . json_encode($va_default_form_values) . ", defaultBooleans = " . json_encode($va_default_form_booleans) . ";\n\t\tfor (f in defaultValues) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('input[name=\"' + f_proc+ '\"], textarea[name=\"' + f_proc+ '\"], select[name=\"' + f_proc+ '\"]').each(function(k, v) {\n\t\t\t\tif (defaultValues[f][k]) { jQuery(v).val(defaultValues[f][k]); } \n\t\t\t});\n\t\t}\n\t\tfor (f in defaultBooleans) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('select[name=\"' + f_proc+ '\"].caAdvancedSearchBoolean').each(function(k, v) {\n\t\t\t\tif (defaultBooleans[f][k]) { jQuery(v).val(defaultBooleans[f][k]); }\n\t\t\t});\n\t\t}\n\t});\n</script>\n";
break;
default:
if (preg_match("!^(.*):label\$!", $vs_tag_proc, $va_matches)) {
$this->view->setVar($vs_tag, $vs_tag_val = $t_subject->getDisplayLabel($va_matches[1]));
} elseif (preg_match("!^(.*):boolean\$!", $vs_tag_proc, $va_matches)) {
$this->view->setVar($vs_tag, caHTMLSelect($vs_tag_proc . '[]', array(_t('AND') => 'AND', _t('OR') => 'OR', 'AND NOT' => 'AND NOT'), array('class' => 'caAdvancedSearchBoolean')));
} else {
$va_opts['asArrayElement'] = true;
if (isset($va_opts['restrictToTypes']) && $va_opts['restrictToTypes'] && !is_array($va_opts['restrictToTypes'])) {
$va_opts['restrictToTypes'] = explode(";", $va_opts['restrictToTypes']);
}
if ($vs_tag_val = $t_subject->htmlFormElementForSearch($this->request, $vs_tag_proc, $va_opts)) {
$this->view->setVar($vs_tag, $vs_tag_val);
}
$va_tmp = explode('.', $vs_tag_proc);
if (($t_element = ca_metadata_elements::getInstance($va_tmp[1])) && $t_element->get('datatype') == 0) {
if (is_array($va_elements = $t_element->getElementsInSet())) {
foreach ($va_elements as $va_element) {
if ($va_element['datatype'] > 0) {
$va_form_elements[] = $va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code'];
}
}
}
break;
}
}
if ($vs_tag_val) {
$va_form_elements[] = $vs_tag_proc;
}
break;
}
}
$this->view->setVar("form", caFormTag($this->request, "{$ps_function}", 'caAdvancedSearch', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'submitOnReturn' => true)));
$this->view->setVar("/form", $vs_script . caHTMLHiddenInput("_advancedFormName", array("value" => $ps_function)) . caHTMLHiddenInput("_formElements", array("value" => join(';', $va_form_elements))) . caHTMLHiddenInput("_advanced", array("value" => 1)) . "</form>");
$this->render($va_search_info['view']);
}
示例6: _getSortKeysForElement
/**
* Get sort keys for list of hits from a given table
*
* @param string $ps_element_code
* @param int $pn_table_num
* @param array $pa_hits
* @return array|bool
*/
private function _getSortKeysForElement($ps_element_code, $pn_table_num, $pa_hits)
{
if (!($t_element = ca_metadata_elements::getInstance($ps_element_code))) {
return false;
}
// is metadata element
$vn_element_id = $t_element->getPrimaryKey();
if (!($vs_sortable_value_fld = Attribute::getSortFieldForDatatype($t_element->get('datatype')))) {
return false;
}
$vs_sql = null;
switch ($vn_datatype = (int) $t_element->get('datatype')) {
case __CA_ATTRIBUTE_VALUE_LIST__:
$vs_sql = "\n\t\t\t\t\t\t\tSELECT attr.row_id, lower(lil.name_plural) name_plural\n\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\tINNER JOIN ca_list_item_labels AS lil ON lil.item_id = attr_vals.item_id\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND\n\t\t\t\t\t\t\t\t(attr.table_num = ?) AND\n\t\t\t\t\t\t\t\t(lil.name_plural IS NOT NULL) AND\n\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t";
break;
case __CA_ATTRIBUTE_VALUE_OBJECTS__:
case __CA_ATTRIBUTE_VALUE_ENTITIES__:
case __CA_ATTRIBUTE_VALUE_PLACES__:
case __CA_ATTRIBUTE_VALUE_OCCURRENCES__:
case __CA_ATTRIBUTE_VALUE_COLLECTIONS__:
case __CA_ATTRIBUTE_VALUE_LOANS__:
case __CA_ATTRIBUTE_VALUE_MOVEMENTS__:
case __CA_ATTRIBUTE_VALUE_STORAGELOCATIONS__:
case __CA_ATTRIBUTE_VALUE_OBJECTLOTS__:
if (!($vs_sortable_value_fld = Attribute::getSortFieldForDatatype($vn_datatype))) {
break;
}
if (!($t_auth_instance = AuthorityAttributeValue::elementTypeToInstance($vn_datatype))) {
break;
}
$vs_sql = "\n\t\t\t\t\t\t\tSELECT attr.row_id, lower(lil.{$vs_sortable_value_fld}) {$vs_sortable_value_fld}\n\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\tINNER JOIN " . $t_auth_instance->getLabelTableName() . " AS lil ON lil.value_integer1 = attr_vals.item_id\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND\n\t\t\t\t\t\t\t\t(attr.table_num = ?) AND\n\t\t\t\t\t\t\t\t(lil.{$vs_sortable_value_fld} IS NOT NULL) AND\n\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t";
break;
case __CA_ATTRIBUTE_VALUE_DATERANGE__:
$vs_sortable_value_fld = 'attr_vals.' . $vs_sortable_value_fld;
$vs_sort_field = array_pop(explode('.', $vs_sortable_value_fld));
$vs_sql = "\n\t\t\t\t\t\t\tSELECT attr.row_id, {$vs_sortable_value_fld}\n\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND\n\t\t\t\t\t\t\t\t(attr.table_num = ?) AND\n\t\t\t\t\t\t\t\t(attr_vals.{$vs_sort_field} IS NOT NULL) AND\n\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t";
break;
default:
$vs_sortable_value_fld = 'attr_vals.' . $vs_sortable_value_fld;
$vs_sort_field = array_pop(explode('.', $vs_sortable_value_fld));
$vs_sql = "\n\t\t\t\t\t\t\tSELECT attr.row_id, lower({$vs_sortable_value_fld}) {$vs_sort_field}\n\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND\n\t\t\t\t\t\t\t\t(attr.table_num = ?) AND\n\t\t\t\t\t\t\t\t(attr_vals.{$vs_sort_field} IS NOT NULL) AND\n\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t";
break;
}
if (!$vs_sql) {
return false;
}
$qr_sort = $this->opo_db->query($vs_sql, array((int) $vn_element_id, (int) $pn_table_num, $pa_hits));
$va_sort_keys = array();
while ($qr_sort->nextRow()) {
$va_row = $qr_sort->getRow();
$va_sort_keys[$va_row['row_id']] = $va_row[$vs_sort_field];
}
return $va_sort_keys;
}
示例7: getElementDatatype
/**
*
*/
public static function getElementDatatype($pm_element_code_or_id)
{
if ($t_element = ca_metadata_elements::getInstance($pm_element_code_or_id)) {
return $t_element->get('datatype');
}
return null;
}
示例8: sortHits
/**
*
* @param array $pa_hits
* @param string $ps_table The table being sorted
* @param string $ps_field A semicolon-delimited string of fully qualified bundle names (Eg. ca_objects.idno;ca_objects.due_date)
* @param string $ps_key Key to use for temporary storage
* @param string $ps_direction Direction to sort
* @param array $pa_options
*
* @return array
*/
public function sortHits(&$pa_hits, $ps_table, $ps_field, $ps_direction = 'asc', $pa_options = null)
{
if (!($t_table = $this->opo_datamodel->getInstanceByTableName($ps_table, true))) {
return null;
}
// invalid table
$vs_table_pk = $t_table->primaryKey();
$vn_table_num = $t_table->tableNum();
// TODO: allow override of this with field-specific directions
// Default direction
if (!in_array(strtolower($ps_direction), array('asc', 'desc'))) {
$ps_direction = 'asc';
}
// Don't try to sort empty results
if (!is_array($pa_hits) || !sizeof($pa_hits)) {
return $pa_hits;
}
// Get field list
//$va_sort_tmp = explode('/', $ps_field); // strip any relationship type
//$ps_field = $va_sort_tmp[0];
//$vs_rel_type = (sizeof($va_sort_tmp) > 1) ? $va_sort_tmp[1] : null;
$va_bundles = explode(';', $ps_field);
// $va_sort_tmp[0]);
$va_sorted_hits = array();
$vs_sort_tmp_table = null;
$va_sort_key_values = array();
foreach ($va_bundles as $vs_bundle) {
$va_sort_tmp = explode('/', $vs_bundle);
// strip any relationship type
$vs_rel_type = sizeof($va_sort_tmp) > 1 ? $va_sort_tmp[1] : null;
$vs_bundle = $va_sort_tmp[0];
list($vs_field_table, $vs_field, $vs_subfield) = explode(".", $vs_bundle);
if (!($t_instance = $this->opo_datamodel->getInstanceByTableName($vs_field_table, true))) {
break;
}
// Transform preferred_labels
if ($vs_field == 'preferred_labels') {
$vs_field_table = $t_instance->getLabelTableName();
$vs_field = $vs_subfield ? $vs_subfield : $t_instance->getLabelDisplayField();
$vs_subfield = null;
}
if ($vs_field_table === $ps_table) {
// sort in primary table
if (!$t_table->hasField($vs_field)) {
if ($t_element = ca_metadata_elements::getInstance($vs_subfield ? $vs_subfield : $vs_field)) {
// is metadata element
$vn_element_id = $t_element->getPrimaryKey();
if (!($vs_sortable_value_fld = Attribute::getSortFieldForDatatype($t_element->get('datatype')))) {
break;
}
switch ($vn_datatype = (int) $t_element->get('datatype')) {
case __CA_ATTRIBUTE_VALUE_LIST__:
$vs_sql = "\n\t\t\t\t\t\t\t\t\t\tSELECT attr.row_id, lower(lil.name_plural) name_plural\n\t\t\t\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_list_item_labels AS lil ON lil.item_id = attr_vals.item_id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr.table_num = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(lil.name_plural IS NOT NULL) AND\n\t\t\t\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t\t\t\t";
break;
case __CA_ATTRIBUTE_VALUE_OBJECTS__:
case __CA_ATTRIBUTE_VALUE_ENTITIES__:
case __CA_ATTRIBUTE_VALUE_PLACES__:
case __CA_ATTRIBUTE_VALUE_OCCURRENCES__:
case __CA_ATTRIBUTE_VALUE_COLLECTIONS__:
case __CA_ATTRIBUTE_VALUE_LOANS__:
case __CA_ATTRIBUTE_VALUE_MOVEMENTS__:
case __CA_ATTRIBUTE_VALUE_STORAGELOCATIONS__:
case __CA_ATTRIBUTE_VALUE_OBJECTLOTS__:
if (!($vs_sortable_value_fld = Attribute::getSortFieldForDatatype($vn_datatype))) {
break;
}
if (!($t_auth_instance = AuthorityAttributeValue::elementTypeToInstance($vn_datatype))) {
break;
}
$vs_sql = "\n\t\t\t\t\t\t\t\t\t\tSELECT attr.row_id, lower(lil.{$vs_sortable_value_fld}) {$vs_sortable_value_fld}\n\t\t\t\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . $t_auth_instance->getLabelTableName() . " AS lil ON lil.value_integer1 = attr_vals.item_id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr.table_num = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(lil.{$vs_sortable_value_fld} IS NOT NULL) AND\n\t\t\t\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t\t\t\t";
break;
case __CA_ATTRIBUTE_VALUE_DATERANGE__:
$vs_sortable_value_fld = 'attr_vals.' . $vs_sortable_value_fld;
$vs_sort_field = array_pop(explode('.', $vs_sortable_value_fld));
$vs_sql = "\n\t\t\t\t\t\t\t\t\t\tSELECT attr.row_id, {$vs_sortable_value_fld}\n\t\t\t\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr.table_num = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.{$vs_sort_field} IS NOT NULL) AND\n\t\t\t\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t\t\t\t";
break;
default:
$vs_sortable_value_fld = 'attr_vals.' . $vs_sortable_value_fld;
$vs_sort_field = array_pop(explode('.', $vs_sortable_value_fld));
$vs_sql = "\n\t\t\t\t\t\t\t\t\t\tSELECT attr.row_id, lower({$vs_sortable_value_fld}) {$vs_sort_field}\n\t\t\t\t\t\t\t\t\t\tFROM ca_attributes attr\n\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attribute_values AS attr_vals ON attr_vals.attribute_id = attr.attribute_id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.element_id = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr.table_num = ?) AND \n\t\t\t\t\t\t\t\t\t\t\t(attr_vals.{$vs_sort_field} IS NOT NULL) AND\n\t\t\t\t\t\t\t\t\t\t\t(attr.row_id IN (?))\n\t\t\t\t\t\t\t\t\t";
break;
}
$qr_sort = $this->opo_db->query($vs_sql, array((int) $vn_element_id, (int) $vn_table_num, $pa_hits));
$va_sort_keys = array();
while ($qr_sort->nextRow()) {
$va_row = $qr_sort->getRow();
$va_sort_keys[$va_row['row_id']] = $va_row[$vs_sort_field];
}
$va_sort_key_values[] = $va_sort_keys;
//.........这里部分代码省略.........
示例9: __call
/**
* Generate form
*/
public function __call($ps_function, $pa_args)
{
$ps_function = strtolower($ps_function);
if (!($va_form_info = $this->_checkForm($ps_function))) {
return;
}
MetaTagManager::setWindowTitle(caGetOption('formTitle', $va_form_info, $this->request->config->get("app_display_name") . ": " . _t("Contribute")));
$this->view->setVar('t_subject', $t_subject = $this->pt_subject);
$t_subject->set('type_id', $va_form_info['type']);
$va_response_data = $this->view->getVar('response');
$va_form_data = caGetOption('formData', $va_response_data, null);
$va_tags = $this->view->getTagList($va_form_info['form_view']);
// Format to wrap field-level error messages in
$vs_error_format = caGetOption('errorFormat', $va_form_info, '<div class="error">^ERRORS</div>');
$this->view->setVar('errors', is_array($va_response_data['errors']['_general_']) ? join("; ", $va_response_data['errors']['_general_']) : "");
foreach ($va_tags as $vs_tag) {
if (in_array($vs_tag, array('form', '/form', 'submit', 'reset'))) {
continue;
}
$va_parse = caParseTagOptions($vs_tag);
$vs_tag_proc = $va_parse['tag'];
$va_opts = $va_parse['options'];
if (($vs_default_value = caGetOption('default', $va_opts, null)) || ($vs_default_value = caGetOption($vs_tag_proc, $va_default_form_values, null))) {
$va_default_form_values[$vs_tag_proc] = $vs_default_value;
unset($va_opts['default']);
}
$vs_tag_val = null;
switch (strtolower($vs_tag_proc)) {
case 'submit':
$this->view->setVar($vs_tag, "<a href='#' class='caContributeFormSubmit'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Submit')) . "</a>");
break;
case 'reset':
$this->view->setVar($vs_tag, "<a href='#' class='caContributeFormReset'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Reset')) . "</a>");
$vs_script = "<script type='text/javascript'>\n\tjQuery(document).ready(function() {\n\t\tvar f, defaultValues = " . json_encode($va_default_form_values) . ", defaultBooleans = " . json_encode($va_default_form_booleans) . ";\n\t\tfor (f in defaultValues) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('input[name=\"' + f_proc+ '\"], textarea[name=\"' + f_proc+ '\"], select[name=\"' + f_proc+ '\"]').each(function(k, v) {\n\t\t\t\tif (defaultValues[f][k]) { jQuery(v).val(defaultValues[f][k]); } \n\t\t\t});\n\t\t}\n\t\tfor (f in defaultBooleans) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('select[name=\"' + f_proc+ '\"].caContributeBoolean').each(function(k, v) {\n\t\t\t\tif (defaultBooleans[f][k]) { jQuery(v).val(defaultBooleans[f][k]); }\n\t\t\t});\n\t\t}\n\t\t\n\t\tjQuery('.caContributeFormSubmit').bind('click', function(e) {\n\t\t\tjQuery('#ContributeForm').submit();\n\t\t\treturn false;\n\t\t});\n\t\tjQuery('.caContributeFormReset').bind('click', function(e) {\n\t\t\tjQuery('#ContributeForm').find('input[type!=\"hidden\"],textarea').val('');\n\t\t\tjQuery('#ContributeForm').find('select.caContributeBoolean').val('AND');\n\t\t\tjQuery('#ContributeForm').find('select').prop('selectedIndex', 0);\n\t\t\te.preventDefault();\n\t\t\treturn false;\n\t\t});\n\t});\n</script>\n";
break;
default:
if (preg_match("!^(.*):label\$!", $vs_tag_proc, $va_matches)) {
$this->view->setVar($vs_tag, $vs_tag_val = $t_subject->getDisplayLabel($va_matches[1]));
} elseif (preg_match("!^(.*):error\$!", $vs_tag_proc, $va_matches)) {
if (is_array($va_response_data['errors'][$va_matches[1]]) && sizeof($va_response_data['errors'][$va_matches[1]])) {
$vs_error_message = join("; ", $va_response_data['errors'][$va_matches[1]]);
if ($vs_error_format) {
$vs_error_message = str_replace("^ERRORS", $vs_error_message, $vs_error_format);
}
$this->view->setVar($vs_tag, $vs_error_message);
}
} else {
if ($vs_tag_proc == 'errors') {
break;
}
// skip general errors tag
$va_opts['asArrayElement'] = true;
$va_opts['IDNumberingConfig'] = $this->config;
$va_vals = array();
$va_tmp = explode('.', $vs_tag_proc);
if (($t_element = ca_metadata_elements::getInstance($va_tmp[1])) && $t_element->get('datatype') == 0) {
if (is_array($va_elements = $t_element->getElementsInSet())) {
foreach ($va_elements as $va_element) {
if ($va_element['datatype'] > 0) {
$va_form_elements[] = $vs_subfld = $va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code'];
if (is_array($va_form_data[$va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code']])) {
$va_vals[$va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code']] = array_shift($va_form_data[$va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code']]);
}
}
}
}
} else {
if (is_array($va_form_data[$vs_tag_proc])) {
$va_vals[$vs_tag_proc] = array_shift($va_form_data[$vs_tag_proc]);
}
}
$va_opts['values'] = $va_vals;
if ($vs_tag_val = $t_subject->htmlFormElementForSimpleForm($this->request, $vs_tag_proc, $va_opts)) {
$this->view->setVar($vs_tag, $vs_tag_val);
}
}
if ($vs_tag_val) {
$va_form_elements[] = $vs_tag_proc;
}
break;
}
}
$this->view->setVar("form", caFormTag($this->request, "Send", 'ContributeForm', null, 'post', 'multipart/form-data', '_top', array('noTimestamp' => true, 'submitOnReturn' => true, 'disableUnsavedChangesWarning' => true)));
$this->view->setVar("/form", $vs_script . caHTMLHiddenInput("_contributeFormName", array("value" => $ps_function)) . caHTMLHiddenInput("_formElements", array("value" => join(';', $va_form_elements))) . caHTMLHiddenInput("_contribute", array("value" => 1)) . "</form>");
$this->view->setVar('spam_protection', caGetOption('spam_protection', $va_form_info, false) ? 1 : 0);
$this->view->setVar('terms_and_conditions', caGetOption('terms_and_conditions', $va_form_info, false));
$this->render($va_form_info['form_view']);
}
示例10: processExporterItem
//.........这里部分代码省略.........
if ($t_exporter_item->getSetting('returnIdno')) {
$va_get_options['returnIdno'] = true;
}
if ($t_exporter_item->getSetting('start_as_iso8601')) {
$va_get_options['start_as_iso8601'] = true;
}
if ($t_exporter_item->getSetting('end_as_iso8601')) {
$va_get_options['end_as_iso8601'] = true;
}
if ($t_exporter_item->getSetting('dontReturnValueIfOnSameDayAsStart')) {
$va_get_options['dontReturnValueIfOnSameDayAsStart'] = true;
}
if ($vs_date_format = $t_exporter_item->getSetting('dateFormat')) {
$va_get_options['dateFormat'] = $vs_date_format;
}
if ($vn_attribute_id) {
$o_log->logInfo(_t("Processing mapping in attribute mode for attribute_id = %1.", $vn_attribute_id));
if ($vs_source) {
// trying to find the source only makes sense if the source is set
$t_attr = new ca_attributes($vn_attribute_id);
$va_values = $t_attr->getAttributeValues();
$va_src_tmp = explode('.', $vs_source);
if (sizeof($va_src_tmp) == 2) {
$o_dm = Datamodel::load();
if ($t_attr->get('table_num') == $o_dm->getTableNum($va_src_tmp[0])) {
$vs_source = $va_src_tmp[1];
}
}
$o_log->logDebug(_t("Trying to find code %1 in value array for the current attribute.", $vs_source));
$o_log->logDebug(_t("Value array is %1.", print_r($va_values, true)));
foreach ($va_values as $vo_val) {
$va_display_val_options = array();
if ($vo_val instanceof ListAttributeValue) {
$t_element = ca_metadata_elements::getInstance($t_attr->get('element_id'));
$va_display_val_options = array('list_id' => $t_element->get('list_id'));
if ($t_exporter_item->getSetting('returnIdno')) {
$va_display_val_options['returnIdno'] = true;
}
}
$o_log->logDebug(_t("Trying to match code from array %1 and the code we're looking for %2.", $vo_val->getElementCode(), $vs_source));
if ($vo_val->getElementCode() == $vs_source) {
$o_log->logDebug(_t("Found value %1.", $vo_val->getDisplayValue($va_display_val_options)));
$va_item_info[] = array('text' => $vo_val->getDisplayValue($va_display_val_options), 'element' => $vs_element);
}
}
} else {
// no source in attribute context probably means this is some form of wrapper, e.g. a MARC field
$va_item_info[] = array('element' => $vs_element);
}
} else {
if ($vs_source) {
$o_log->logDebug(_t("Source for current mapping is %1", $vs_source));
$va_matches = array();
// CONSTANT value
if (preg_match("/^_CONSTANT_:(.*)\$/", $vs_source, $va_matches)) {
$o_log->logDebug(_t("This is a constant. Value for this mapping is '%1'", trim($va_matches[1])));
$va_item_info[] = array('text' => trim($va_matches[1]), 'element' => $vs_element);
} else {
if (in_array($vs_source, array("relationship_type_id", "relationship_type_code", "relationship_typename"))) {
if (isset($pa_options[$vs_source]) && strlen($pa_options[$vs_source]) > 0) {
$o_log->logDebug(_t("Source refers to releationship type information. Value for this mapping is '%1'", $pa_options[$vs_source]));
$va_item_info[] = array('text' => $pa_options[$vs_source], 'element' => $vs_element);
}
} else {
if (!$vb_repeat) {
$vs_get = $t_instance->get($vs_source, $va_get_options);