当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_metadata_elements::getAvailableSettings方法代码示例

本文整理汇总了PHP中ca_metadata_elements::getAvailableSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getAvailableSettings方法的具体用法?PHP ca_metadata_elements::getAvailableSettings怎么用?PHP ca_metadata_elements::getAvailableSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_metadata_elements的用法示例。


在下文中一共展示了ca_metadata_elements::getAvailableSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getElementsAsDOM

 public function getElementsAsDOM()
 {
     $t_list = new ca_lists();
     $vo_elements = $this->opo_dom->createElement("elementSets");
     $qr_elements = $this->opo_db->query("SELECT * FROM ca_metadata_elements WHERE parent_id IS NULL ORDER BY element_id");
     $t_element = new ca_metadata_elements();
     while ($qr_elements->nextRow()) {
         $vo_element = $this->opo_dom->createElement("metadataElement");
         $vo_element->setAttribute("code", $this->makeIDNO($qr_elements->get("element_code")));
         $vo_element->setAttribute("datatype", ca_metadata_elements::getAttributeNameForTypeCode($qr_elements->get("datatype")));
         if ($qr_elements->get("list_id")) {
             $t_list->load($qr_elements->get("list_id"));
             $vo_element->setAttribute("list", $t_list->get("list_code"));
         }
         $vo_labels = $this->opo_dom->createElement("labels");
         $qr_element_labels = $this->opo_db->query("SELECT * FROM ca_metadata_element_labels WHERE element_id=?", $qr_elements->get("element_id"));
         while ($qr_element_labels->nextRow()) {
             $vo_label = $this->opo_dom->createElement("label");
             $vo_label->setAttribute("locale", $this->opt_locale->localeIDToCode($qr_element_labels->get("locale_id")));
             $vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($qr_element_labels->get("name"))));
             if (strlen(trim($qr_element_labels->get("description"))) > 0) {
                 $vo_label->appendChild($this->opo_dom->createElement("description", caEscapeForXML($qr_element_labels->get("description"))));
             }
             $vo_labels->appendChild($vo_label);
         }
         $vo_element->appendChild($vo_labels);
         $t_element->load($qr_elements->get("element_id"));
         $va_settings = $t_element->getSettings();
         $va_available_settings = $t_element->getAvailableSettings();
         if (is_array($va_settings)) {
             $vo_settings = $this->opo_dom->createElement("settings");
             $vb_append_settings_element = false;
             foreach ($t_element->getSettings() as $vs_setting => $vs_value) {
                 if ($t_element->isValidSetting($vs_setting) && $vs_value != $va_available_settings[$vs_setting]["default"]) {
                     $vo_setting = $this->opo_dom->createElement("setting", $vs_value);
                     $vo_setting->setAttribute("name", $vs_setting);
                     $vo_settings->appendChild($vo_setting);
                     $vb_append_settings_element = true;
                 }
             }
             if ($vb_append_settings_element) {
                 $vo_element->appendChild($vo_settings);
             }
         }
         $vo_sub_elements = $this->getElementAsDOM($qr_elements->get("element_id"));
         if ($vo_sub_elements) {
             $vo_element->appendChild($vo_sub_elements);
         }
         $vo_restrictions = $this->opo_dom->createElement("typeRestrictions");
         foreach ($t_element->getTypeRestrictions() as $va_restriction) {
             /** @var ca_metadata_type_restrictions $t_restriction */
             $t_restriction = new ca_metadata_type_restrictions($va_restriction["restriction_id"]);
             $vs_table_name = $this->opo_dm->getTableName($t_restriction->get("table_num"));
             if (!(strlen($vs_table_name) > 0)) {
                 continue;
             }
             // there could be lingering restrictions for tables that have since been removed. don't export those.
             $vo_restriction = $this->opo_dom->createElement("restriction");
             $vo_table = $this->opo_dom->createElement("table", $vs_table_name);
             $vo_restriction->appendChild($vo_table);
             if ($t_restriction->get("type_id")) {
                 /** @var BaseRelationshipModel $t_instance */
                 $t_instance = $this->opo_dm->getInstanceByTableNum($t_restriction->get("table_num"));
                 $vs_type_code = $t_instance->getTypeListCode();
                 $va_item = $t_list->getItemFromListByItemID($vs_type_code, $t_restriction->get("type_id"));
                 $vo_type = $this->opo_dom->createElement("type", $va_item["idno"]);
                 $vo_restriction->appendChild($vo_type);
             }
             if (isset($va_restriction['include_subtypes']) && (bool) $va_restriction['include_subtypes']) {
                 $vo_include_subtypes = $this->opo_dom->createElement('includeSubtypes', '1');
                 $vo_restriction->appendChild($vo_include_subtypes);
             }
             if (is_array($va_restriction_settings = $t_restriction->getSettings())) {
                 $vo_settings = $this->opo_dom->createElement("settings");
                 foreach ($va_restriction_settings as $vs_setting => $vs_value) {
                     $vo_setting = $this->opo_dom->createElement("setting", $vs_value);
                     $vo_setting->setAttribute("name", $vs_setting);
                     $vo_settings->appendChild($vo_setting);
                 }
                 $vo_restriction->appendChild($vo_settings);
             }
             $vo_restrictions->appendChild($vo_restriction);
         }
         $vo_element->appendChild($vo_restrictions);
         $vo_elements->appendChild($vo_element);
     }
     return $vo_elements;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:88,代码来源:ConfigurationExporter.php


注:本文中的ca_metadata_elements::getAvailableSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。