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


PHP XMLDBField::isLoaded方法代码示例

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


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

示例1: trim

 /**
  * Load data from XML to the table
  */
 function arr2XMLDBTable($xmlarr)
 {
     global $CFG;
     $result = true;
     /// Debug the table
     /// traverse_xmlize($xmlarr);                   //Debug
     /// print_object ($GLOBALS['traverse_array']);  //Debug
     /// $GLOBALS['traverse_array']="";              //Debug
     /// Process table attributes (name, comment, previoustable and nexttable)
     if (isset($xmlarr['@']['NAME'])) {
         $this->name = trim($xmlarr['@']['NAME']);
     } else {
         $this->errormsg = 'Missing NAME attribute';
         $this->debug($this->errormsg);
         $result = false;
     }
     if (isset($xmlarr['@']['COMMENT'])) {
         $this->comment = trim($xmlarr['@']['COMMENT']);
     } else {
         if (!empty($CFG->xmldbdisablecommentchecking)) {
             $this->comment = '';
         } else {
             $this->errormsg = 'Missing COMMENT attribute';
             $this->debug($this->errormsg);
             $result = false;
         }
     }
     if (isset($xmlarr['@']['PREVIOUS'])) {
         $this->previous = trim($xmlarr['@']['PREVIOUS']);
     }
     if (isset($xmlarr['@']['NEXT'])) {
         $this->next = trim($xmlarr['@']['NEXT']);
     }
     /// Iterate over fields
     if (isset($xmlarr['#']['FIELDS']['0']['#']['FIELD'])) {
         foreach ($xmlarr['#']['FIELDS']['0']['#']['FIELD'] as $xmlfield) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmlfield['@']['NAME']);
             $field = new XMLDBField($name);
             $field->arr2XMLDBField($xmlfield);
             $this->fields[] = $field;
             if (!$field->isLoaded()) {
                 $this->errormsg = 'Problem loading field ' . $name;
                 $this->debug($this->errormsg);
                 $result = false;
             }
         }
     } else {
         $this->errormsg = 'Missing FIELDS section';
         $this->debug($this->errormsg);
         $result = false;
     }
     /// Perform some general checks over fields
     if ($result && $this->fields) {
         /// Check field names are ok (lowercase, a-z _-)
         if (!$this->checkNameValues($this->fields)) {
             $this->errormsg = 'Some FIELDS name values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Check previous & next are ok (duplicates and existing fields)
         $this->fixPrevNext($this->fields);
         if ($result && !$this->checkPreviousNextValues($this->fields)) {
             $this->errormsg = 'Some FIELDS previous/next values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         /// Order fields
         if ($result && !$this->orderFields($this->fields)) {
             $this->errormsg = 'Error ordering the fields';
             $this->debug($this->errormsg);
             $result = false;
         }
     }
     /// Iterate over keys
     if (isset($xmlarr['#']['KEYS']['0']['#']['KEY'])) {
         foreach ($xmlarr['#']['KEYS']['0']['#']['KEY'] as $xmlkey) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmlkey['@']['NAME']);
             $key = new XMLDBKey($name);
             $key->arr2XMLDBKey($xmlkey);
             $this->keys[] = $key;
             if (!$key->isLoaded()) {
                 $this->errormsg = 'Problem loading key ' . $name;
                 $this->debug($this->errormsg);
                 $result = false;
             }
         }
     } else {
         $this->errormsg = 'Missing KEYS section (at least one PK must exist)';
         $this->debug($this->errormsg);
//.........这里部分代码省略.........
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:101,代码来源:XMLDBTable.class.php


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