/**
  * Returns a list of HTML fragments implementing all bundles in an HTML form for the specified screen
  * $pm_screen can be a screen tag (eg. "Screen5") or a screen_id (eg. 5) 
  *
  * @param mixed $pm_screen screen_id or code in default UI to return bundles for
  * @param array $pa_options Array of options. Supports and option getBundleFormHTML() supports plus:
  *		request = the current request object; used to apply user privs to bundle generation
  *		force = list of bundles to force onto form if they are not included in the UI; forced bundles will be included at the bottom of the form
  *		forceHidden = list of *intrinsic* fields to force onto form as hidden <input> elements if they are not included in the UI; NOTE: only intrinsic fields may be specified
  *		omit = list of bundles to omit from form in the event they are included in the UI
  *		restrictToTypes = 
  *	@return array List of bundle HTML to display in form, keyed on placement code
  */
 public function getBundleFormHTMLForScreen($pm_screen, $pa_options, &$pa_placements = null)
 {
     $va_omit_bundles = isset($pa_options['omit']) && is_array($pa_options['omit']) ? $pa_options['omit'] : array();
     $vs_table_name = $this->tableName();
     if (isset($pa_options['ui_instance']) && $pa_options['ui_instance']) {
         $t_ui = $pa_options['ui_instance'];
     } else {
         $t_ui = ca_editor_uis::loadDefaultUI($vs_table_name, $pa_options['request'], $this->getTypeID());
     }
     if (!$t_ui) {
         return false;
     }
     if (isset($pa_options['bundles']) && is_array($pa_options['bundles'])) {
         $va_bundles = $pa_options['bundles'];
     } else {
         $va_bundles = $t_ui->getScreenBundlePlacements($pm_screen);
     }
     $vs_form_name = caGetOption('formName', $pa_options, '');
     $va_bundle_html = array();
     $vn_pk_id = $this->getPrimaryKey();
     $va_bundles_present = array();
     if (is_array($va_bundles)) {
         $o_dm = $this->getAppDatamodel();
         $va_definition_bundle_names = array();
         foreach ($va_bundles as $va_bundle) {
             if ($va_bundle['bundle_name'] === $vs_type_id_fld) {
                 continue;
             }
             // skip type_id
             if (!$vn_pk_id && $va_bundle['bundle_name'] === $vs_hier_parent_id_fld) {
                 continue;
             }
             if (in_array($va_bundle['bundle_name'], $va_omit_bundles)) {
                 continue;
             }
             $va_definition_bundle_names[(!$o_dm->tableExists($va_bundle['bundle_name']) ? "{$vs_table_name}." : "") . str_replace("ca_attribute_", "", $va_bundle['bundle_name'])] = 1;
         }
         ca_metadata_dictionary_entries::preloadDefinitions(array_keys($va_definition_bundle_names));
         if (is_subclass_of($this, 'BaseRelationshipModel')) {
             $vs_type_id_fld = $this->getTypeFieldName();
             if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
                 $va_valid_element_codes = $this->getApplicableElementCodesForTypes(caMakeRelationshipTypeIDList($vs_table_name, $pa_options['restrictToTypes']));
             } else {
                 $va_valid_element_codes = null;
             }
         } else {
             $vs_type_id_fld = isset($this->ATTRIBUTE_TYPE_ID_FLD) ? $this->ATTRIBUTE_TYPE_ID_FLD : null;
             $vs_hier_parent_id_fld = isset($this->HIERARCHY_PARENT_ID_FLD) ? $this->HIERARCHY_PARENT_ID_FLD : null;
             if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
                 $va_valid_element_codes = $this->getApplicableElementCodesForTypes(caMakeTypeIDList($vs_table_name, $pa_options['restrictToTypes']));
             } else {
                 $va_valid_element_codes = null;
             }
         }
         $vn_c = 0;
         foreach ($va_bundles as $va_bundle) {
             if ($va_bundle['bundle_name'] === $vs_type_id_fld) {
                 continue;
             }
             // skip type_id
             if (!$vn_pk_id && $va_bundle['bundle_name'] === $vs_hier_parent_id_fld) {
                 continue;
             }
             if (in_array($va_bundle['bundle_name'], $va_omit_bundles)) {
                 continue;
             }
             if ($va_valid_element_codes && substr($va_bundle['bundle_name'], 0, 13) == 'ca_attribute_') {
                 if (!in_array(substr($va_bundle['bundle_name'], 13), $va_valid_element_codes)) {
                     continue;
                 }
             }
             // Test for user action restrictions on intrinsic fields
             $vb_output_bundle = true;
             if ($this->hasField($va_bundle['bundle_name'])) {
                 if (is_array($va_requires = $this->getFieldInfo($va_bundle['bundle_name'], 'REQUIRES'))) {
                     foreach ($va_requires as $vs_required_action) {
                         if (!$pa_options['request']->user->canDoAction($vs_required_action)) {
                             $vb_output_bundle = false;
                             break;
                         }
                     }
                 }
             }
             if (!$vb_output_bundle) {
                 continue;
             }
             $va_bundle['settings']['placement_id'] = $va_bundle['placement_id'];
             if ($vs_bundle_form_html = $this->getBundleFormHTML($va_bundle['bundle_name'], 'P' . $va_bundle['placement_id'], $va_bundle['settings'], $pa_options, $vs_bundle_display_name)) {
                 $va_bundle_html[$va_bundle['placement_code']] = "<a name=\"{$pm_screen}_{$vn_c}\"></a>{$vs_bundle_form_html}";
                 $va_bundles_present[$va_bundle['bundle_name']] = true;
                 $pa_placements["{$pm_screen}_{$vn_c}"] = array('name' => $vs_bundle_display_name ? $vs_bundle_display_name : $this->getDisplayLabel($vs_table_name . "." . $va_bundle['bundle_name']), 'placement_id' => $va_bundle['placement_id'], 'bundle' => $va_bundle['bundle_name'], 'id' => 'P' . $va_bundle['placement_id'] . caGetOption('formName', $pa_options, ''));
             }
             $vn_c++;
         }
     }
     // is this a form to create a new item?
     if (!$vn_pk_id) {
         // auto-add mandatory fields if this is a new object
         $va_mandatory_fields = $this->getMandatoryFields();
         foreach ($va_mandatory_fields as $vs_field) {
             if (!isset($va_bundles_present[$vs_field]) || !$va_bundles_present[$vs_field]) {
                 $va_bundle_html[$vs_field] = $this->getBundleFormHTML($vs_field, 'mandatory_' . $vs_field, array(), $pa_options);
             }
         }
         // add type_id
         if (isset($this->ATTRIBUTE_TYPE_ID_FLD) && $this->ATTRIBUTE_TYPE_ID_FLD && !in_array('type_id', $va_omit_bundles)) {
             $va_bundle_html[$this->ATTRIBUTE_TYPE_ID_FLD] = caHTMLHiddenInput($this->ATTRIBUTE_TYPE_ID_FLD, array('value' => $pa_options['request']->getParameter($this->ATTRIBUTE_TYPE_ID_FLD, pString)));
         }
         // add parent_id
         if (isset($this->HIERARCHY_PARENT_ID_FLD) && $this->HIERARCHY_PARENT_ID_FLD && !in_array('parent_id', $va_omit_bundles)) {
             $va_bundle_html[$this->HIERARCHY_PARENT_ID_FLD] = caHTMLHiddenInput($this->HIERARCHY_PARENT_ID_FLD, array('value' => $pa_options['request']->getParameter($this->HIERARCHY_PARENT_ID_FLD, pInteger)));
         }
         // add forced bundles
         if (isset($pa_options['force']) && $pa_options['force']) {
             if (!is_array($pa_options['force'])) {
                 $pa_options['force'] = array($pa_options['force']);
             }
             foreach ($pa_options['force'] as $vn_x => $vs_bundle) {
                 if (!isset($va_bundles_present[$vs_bundle]) || !$va_bundles_present[$vs_bundle]) {
                     $va_bundle_html['_force_' . $vs_bundle] = $this->getBundleFormHTML($vs_bundle, 'force_' . $vs_field, array(), $pa_options);
                 }
             }
         }
         // add forced hidden intrinsic fields
         if (isset($pa_options['forceHidden']) && $pa_options['forceHidden']) {
             if (!is_array($pa_options['forceHidden'])) {
                 $pa_options['forceHidden'] = array($pa_options['forceHidden']);
             }
             foreach ($pa_options['forceHidden'] as $vn_x => $vs_field) {
                 if (!isset($va_bundles_present[$vs_field]) || !$va_bundles_present[$vs_field]) {
                     $va_bundle_html['_force_hidden_' . $vs_field] = caHTMLHiddenInput($vs_field, array('value' => $pa_options['request']->getParameter($vs_field, pString)));
                 }
             }
         }
     }
     return $va_bundle_html;
 }
Ejemplo n.º 2
0
 public function processMetadataDictionary()
 {
     require_once __CA_MODELS_DIR__ . '/ca_metadata_dictionary_entries.php';
     if (!$this->opo_profile->metadataDictionary) {
         return true;
     }
     // no dict specified. it's optional, so don't barf
     // dictionary entries don't have a code or any other attribute that could be used for
     // identification so we won't support setting them in a base profile, for now ...
     foreach ($this->opo_profile->metadataDictionary->children() as $vo_entry) {
         $vs_field = self::getAttribute($vo_entry, "bundle");
         if (strlen($vs_field) < 1) {
             $this->addError("No bundle specified in a metadata dictionary entry. Skipping row.");
             continue;
         }
         // insert dictionary entry
         $t_entry = new ca_metadata_dictionary_entries();
         $t_entry->setMode(ACCESS_WRITE);
         $t_entry->set('bundle_name', $vs_field);
         $this->_processSettings($t_entry, $vo_entry->settings);
         $t_entry->insert();
         if ($t_entry->numErrors() > 0 || !($t_entry->getPrimaryKey() > 0)) {
             $this->addError("There were errors while adding dictionary entry: " . join(';', $t_entry->getErrors()));
             return false;
         }
         if ($vo_entry->rules) {
             foreach ($vo_entry->rules->children() as $vo_rule) {
                 $vs_code = self::getAttribute($vo_rule, "code");
                 $vs_level = self::getAttribute($vo_rule, "level");
                 $t_rule = new ca_metadata_dictionary_rules();
                 $t_rule->setMode(ACCESS_WRITE);
                 $t_rule->set('entry_id', $t_entry->getPrimaryKey());
                 $t_rule->set('rule_code', $vs_code);
                 $t_rule->set('rule_level', $vs_level);
                 $t_rule->set('expression', (string) $vo_rule->expression);
                 $this->_processSettings($t_rule, $vo_rule->settings);
                 $t_rule->insert();
                 if ($t_rule->numErrors()) {
                     $this->addError("There were errors while adding dictionary rule: " . join(';', $t_rule->getErrors()));
                     continue;
                 }
             }
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Load metadata dictionary
  */
 public static function load_metadata_dictionary_from_excel_file($po_opts = null)
 {
     require_once __CA_LIB_DIR__ . '/core/Parsers/PHPExcel/PHPExcel.php';
     require_once __CA_LIB_DIR__ . '/core/Parsers/PHPExcel/PHPExcel/IOFactory.php';
     require_once __CA_MODELS_DIR__ . '/ca_metadata_dictionary_entries.php';
     $t_entry = new ca_metadata_dictionary_entries();
     $o_db = $t_entry->getDb();
     $qr_res = $o_db->query("DELETE FROM ca_metadata_dictionary_rule_violations");
     $qr_res = $o_db->query("DELETE FROM ca_metadata_dictionary_rules");
     $qr_res = $o_db->query("DELETE FROM ca_metadata_dictionary_entries");
     if (!($ps_source = (string) $po_opts->getOption('file'))) {
         CLIUtils::addError(_t("You must specify a file"));
         return false;
     }
     if (!file_exists($ps_source) || !is_readable($ps_source)) {
         CLIUtils::addError(_t("You must specify a valid file"));
         return false;
     }
     try {
         $o_file = PHPExcel_IOFactory::load($ps_source);
     } catch (Exception $e) {
         CLIUtils::addError(_t("You must specify a valid Excel .xls or .xlsx file: %1", $e->getMessage()));
         return false;
     }
     $o_sheet = $o_file->getActiveSheet();
     $o_rows = $o_sheet->getRowIterator();
     $vn_add_count = 0;
     $vn_rule_count = 0;
     $o_rows->next();
     // skip first line
     while ($o_rows->valid() && ($o_row = $o_rows->current())) {
         $o_cells = $o_row->getCellIterator();
         $o_cells->setIterateOnlyExistingCells(false);
         $vn_c = 0;
         $va_data = array();
         foreach ($o_cells as $o_cell) {
             $vm_val = $o_cell->getValue();
             if ($vm_val instanceof PHPExcel_RichText) {
                 $vs_val = '';
                 foreach ($vm_val->getRichTextElements() as $vn_x => $o_item) {
                     $o_font = $o_item->getFont();
                     $vs_text = $o_item->getText();
                     if ($o_font && $o_font->getBold()) {
                         $vs_val .= "<strong>{$vs_text}</strong>";
                     } elseif ($o_font && $o_font->getItalic()) {
                         $vs_val .= "<em>{$vs_text}</em>";
                     } else {
                         $vs_val .= $vs_text;
                     }
                 }
             } else {
                 $vs_val = trim((string) $vm_val);
             }
             $va_data[$vn_c] = nl2br(preg_replace("![\n\r]{1}!", "\n\n", $vs_val));
             $vn_c++;
             if ($vn_c > 5) {
                 break;
             }
         }
         $o_rows->next();
         // Insert entries
         $t_entry = new ca_metadata_dictionary_entries();
         $t_entry->set('bundle_name', $va_data[0]);
         $vn_add_count++;
         $t_entry->setMode(ACCESS_WRITE);
         $t_entry->setSetting('label', '');
         $t_entry->setSetting('definition', $va_data[2]);
         $t_entry->setSetting('mandatory', (bool) $va_data[1] ? 1 : 0);
         $va_types = preg_split("![;,\\|]{1}!", $va_data[3]);
         if (!is_array($va_types)) {
             $va_types = array();
         }
         $va_types = array_filter($va_types, 'strlen');
         $va_relationship_types = preg_split("![;,\\|]{1}!", $va_data[4]);
         if (!is_array($va_relationship_types)) {
             $va_relationship_types = array();
         }
         $va_relationship_types = array_filter($va_relationship_types, 'strlen');
         $t_entry->setSetting('restrict_to_types', $va_types);
         $t_entry->setSetting('restrict_to_relationship_types', $va_relationship_types);
         $vn_rc = $t_entry->getPrimaryKey() > 0 ? $t_entry->update() : $t_entry->insert();
         if ($t_entry->numErrors()) {
             CLIUtils::addError(_t("Error while adding definition for %1: %2", $va_data[0], join("; ", $t_entry->getErrors())));
         }
         // Add rules
         if ($va_data[5]) {
             if (!is_array($va_rules = json_decode($va_data[5], true))) {
                 CLIUtils::addError(_t('Could not decode rules for %1', $va_data[5]));
                 continue;
             }
             foreach ($va_rules as $va_rule) {
                 $t_rule = new ca_metadata_dictionary_rules();
                 $t_rule->setMode(ACCESS_WRITE);
                 $t_rule->set('entry_id', $t_entry->getPrimaryKey());
                 $t_rule->set('rule_code', (string) $va_rule['ruleCode']);
                 $t_rule->set('rule_level', (string) $va_rule['ruleLevel']);
                 $t_rule->set('expression', (string) $va_rule['expression']);
                 $t_rule->setSetting('label', (string) $va_rule['label']);
                 $t_rule->setSetting('description', (string) $va_rule['description']);
                 $t_rule->setSetting('violationMessage', (string) $va_rule['violationMessage']);
                 $t_rule->insert();
                 if ($t_rule->numErrors()) {
                     CLIUtils::addError(_t("Error while adding rule for %1: %2", $va_data[0], join("; ", $t_rule->getErrors())));
                 } else {
                     $vn_rule_count++;
                 }
             }
         }
     }
     CLIUtils::addMessage(_t('Added %1 entries and %2 rules', $vn_add_count, $vn_rule_count), array('color' => 'bold_green'));
     return true;
 }
 /**
  * @return DOMElement|null
  */
 public function getMetadataDictionaryAsDOM()
 {
     $vo_dict = $this->opo_dom->createElement("metadataDictionary");
     $qr_entries = $this->opo_db->query("SELECT entry_id FROM ca_metadata_dictionary_entries ORDER BY entry_id");
     if ($qr_entries->numRows() < 1) {
         return null;
     }
     while ($qr_entries->nextRow()) {
         $t_entry = new ca_metadata_dictionary_entries($qr_entries->get('entry_id'));
         $vo_entry = $this->opo_dom->createElement("entry");
         $vo_dict->appendChild($vo_entry);
         $vo_entry->setAttribute('bundle', $t_entry->get('bundle_name'));
         if (is_array($t_entry->getSettings())) {
             $va_settings = array();
             // bring array settings and key=>val settings in unified format: key=>array_of_vals or key=>locale=>val
             foreach ($t_entry->getSettings() as $vs_setting => $va_value) {
                 if (is_array($va_value)) {
                     foreach ($va_value as $vs_key => $vs_value) {
                         if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vs_key)) {
                             // locale
                             $va_settings[$vs_setting][$vs_key] = $vs_value;
                             continue;
                         }
                         $va_settings[$vs_setting][] = $vs_value;
                     }
                 } else {
                     $va_settings[$vs_setting][] = $va_value;
                 }
             }
             // append settings to XML tree
             if (sizeof($va_settings) > 0) {
                 $vo_settings = $this->opo_dom->createElement("settings");
                 $vo_entry->appendChild($vo_settings);
                 foreach ($va_settings as $vs_setting => $va_values) {
                     foreach ($va_values as $vs_key => $vs_value) {
                         if ($vs_value != caEscapeForXML($vs_value)) {
                             // if something is escaped in caEscapeForXML(), wrap in CDATA
                             $vo_setting = $this->opo_dom->createElement('setting');
                             $vo_setting->appendChild(new DOMCdataSection($vs_value));
                         } else {
                             $vo_setting = $this->opo_dom->createElement("setting", $vs_value);
                         }
                         if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vs_key)) {
                             // locale
                             $vo_setting->setAttribute("locale", $vs_key);
                         }
                         $vo_setting->setAttribute("name", $vs_setting);
                         $vo_settings->appendChild($vo_setting);
                     }
                 }
             }
         }
         // rules for this dictionary
         $va_rules = $t_entry->getRules();
         if (is_array($va_rules) && sizeof($va_rules) > 0) {
             $vo_rules = $this->opo_dom->createElement("rules");
             $vo_entry->appendChild($vo_rules);
             foreach ($va_rules as $va_rule) {
                 $vo_rule = $this->opo_dom->createElement("rule");
                 $vo_rules->appendChild($vo_rule);
                 $vo_rule->setAttribute('code', $va_rule['rule_code']);
                 $vo_rule->setAttribute('level', $va_rule['rule_level']);
                 // expression
                 if (isset($va_rule['expression']) && sizeof($va_rule['expression']) > 0) {
                     $vo_expression = $this->opo_dom->createElement('expression');
                     $vo_expression->appendChild(new DOMCdataSection($va_rule['expression']));
                     $vo_rule->appendChild($vo_expression);
                 }
                 // rule settings
                 if (isset($va_rule['settings']) && is_array($va_rule['settings'])) {
                     $va_settings = array();
                     // bring array settings and key=>val settings in unified format: key=>array_of_vals
                     foreach ($va_rule['settings'] as $vs_setting => $va_value) {
                         if (is_array($va_value)) {
                             foreach ($va_value as $vs_key => $vs_value) {
                                 if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vs_key)) {
                                     // locale
                                     $va_settings[$vs_setting][$vs_key] = $vs_value;
                                     continue;
                                 }
                                 $va_settings[$vs_setting][] = $vs_value;
                             }
                         } else {
                             $va_settings[$vs_setting][] = $va_value;
                         }
                     }
                     // append settings to XML tree
                     if (sizeof($va_settings) > 0) {
                         $vo_settings = $this->opo_dom->createElement("settings");
                         $vo_rule->appendChild($vo_settings);
                         foreach ($va_settings as $vs_setting => $va_values) {
                             foreach ($va_values as $vs_key => $vs_value) {
                                 if ($vs_value != caEscapeForXML($vs_value)) {
                                     // if something is escaped in caEscapeForXML(), wrap in CDATA
                                     $vo_setting = $this->opo_dom->createElement('setting');
                                     $vo_setting->appendChild(new DOMCdataSection($vs_value));
                                 } else {
                                     $vo_setting = $this->opo_dom->createElement("setting", $vs_value);
                                 }
                                 if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vs_key)) {
                                     // locale
                                     $vo_setting->setAttribute("locale", $vs_key);
                                 }
                                 $vo_setting->setAttribute("name", $vs_setting);
                                 $vo_settings->appendChild($vo_setting);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $vo_dict;
 }
 /**
  * Get a dictionary entry for a bundle. Entries are matched first on bundle name, and then filtered on any restrict_to_types
  * and restrict_to_relationship_types settings in the $pa_settings parameter. This allows you to have different dictionary entries
  * for the same bundle name subject to type restrictions set in the user interface. For example, if you have a ca_entities bundle (related
  * entities) you can have different dictionary entries return when ca_entities is restricted to authors vs. publishers.
  *
  * @param string $ps_bundle_name The bundle name to find a dictionary entry for. 
  * @param array $pa_settings Bundle settings to use when matching definitions. The bundle settings restrict_to_types and restrict_to_relationship_types will be used, when present, to find type-restricted dictionary entries.
  * @param array $pa_options Options include:
  *		noCache = Bypass cache (typically loaded using ca_metadata_dictionary_entries::preloadDefinitions()) and check entry directly. [Default=false]
  *
  * @return array An array with entry data. Keys are entry field names. The 'settings' key contains the label, definition text and any type restrictions. Returns null if no entry is defined.
  */
 public static function getEntry($ps_bundle_name, $pa_settings = null, $pa_options = null)
 {
     if (caGetOption('noCache', $pa_options, false)) {
         ca_metadata_dictionary_entries::preloadDefinitions(array($ps_bundle_name));
     }
     if (!is_array($va_types = caGetOption('restrict_to_types', $pa_settings, null)) && $va_types) {
         $va_types = array($va_types);
     }
     if (!is_array($va_types)) {
         $va_types = array();
     }
     if (sizeof($va_types = array_filter($va_types, 'strlen'))) {
         $va_types = ca_lists::itemIDsToIDNOs($va_types);
     }
     if (!is_array($va_relationship_types = caGetOption('restrict_to_relationship_types', $pa_settings, null)) && $va_relationship_types) {
         $va_relationship_types = array($va_relationship_types);
     }
     if (!is_array($va_relationship_types)) {
         $va_relationship_types = array();
     }
     if (sizeof($va_relationship_types = array_filter($va_relationship_types, 'strlen'))) {
         $va_relationship_types = ca_relationship_types::relationshipTypeIDsToTypeCodes($va_relationship_types);
     }
     if ($va_entry_list = ca_metadata_dictionary_entries::entryExists($ps_bundle_name)) {
         $vn_entry_id = null;
         if (sizeof($va_types) || sizeof($va_relationship_types)) {
             foreach (array_keys($va_entry_list) as $vn_id) {
                 $va_entry = ca_metadata_dictionary_entries::$s_definition_cache[$vn_id];
                 if (sizeof($va_relationship_types)) {
                     if (is_array($va_entry_types = $va_entry['settings']['restrict_to_relationship_types'])) {
                         if (sizeof(array_intersect($va_relationship_types, $va_entry_types))) {
                             $vn_entry_id = $vn_id;
                         } else {
                             $vn_entry_id = null;
                             continue;
                         }
                     }
                 }
                 if (sizeof($va_types)) {
                     if (is_array($va_entry_types = $va_entry['settings']['restrict_to_types'])) {
                         if (sizeof(array_intersect($va_types, $va_entry_types))) {
                             $vn_entry_id = $vn_id;
                         } else {
                             $vn_entry_id = null;
                             continue;
                         }
                     }
                 }
                 if ($vn_entry_id) {
                     break;
                 }
             }
         }
         if (!$vn_entry_id) {
             $vn_entry_id = array_pop(array_keys($va_entry_list));
         }
         return ca_metadata_dictionary_entries::$s_definition_cache[$vn_entry_id];
     }
     return null;
 }