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


PHP xmldb_table::isLoaded方法代码示例

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


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

示例1: arr2xmldb_structure

 /**
  * Load data from XML to the structure
  * @param array $xmlarr
  * @return bool
  */
 public function arr2xmldb_structure($xmlarr)
 {
     global $CFG;
     $result = true;
     // Debug the structure
     // traverse_xmlize($xmlarr);                   //Debug
     // print_object ($GLOBALS['traverse_array']);  //Debug
     // $GLOBALS['traverse_array']="";              //Debug
     // Process structure attributes (path, comment and version)
     if (isset($xmlarr['XMLDB']['@']['PATH'])) {
         $this->path = trim($xmlarr['XMLDB']['@']['PATH']);
     } else {
         $this->errormsg = 'Missing PATH attribute';
         $this->debug($this->errormsg);
         $result = false;
     }
     if (isset($xmlarr['XMLDB']['@']['VERSION'])) {
         $this->version = trim($xmlarr['XMLDB']['@']['VERSION']);
     } else {
         $this->errormsg = 'Missing VERSION attribute';
         $this->debug($this->errormsg);
         $result = false;
     }
     if (isset($xmlarr['XMLDB']['@']['COMMENT'])) {
         $this->comment = trim($xmlarr['XMLDB']['@']['COMMENT']);
     } else {
         if (!empty($CFG->xmldbdisablecommentchecking)) {
             $this->comment = '';
         } else {
             $this->errormsg = 'Missing COMMENT attribute';
             $this->debug($this->errormsg);
             $result = false;
         }
     }
     // Iterate over tables
     if (isset($xmlarr['XMLDB']['#']['TABLES']['0']['#']['TABLE'])) {
         foreach ($xmlarr['XMLDB']['#']['TABLES']['0']['#']['TABLE'] as $xmltable) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmltable['@']['NAME']);
             $table = new xmldb_table($name);
             $table->arr2xmldb_table($xmltable);
             $this->tables[] = $table;
             if (!$table->isLoaded()) {
                 $this->errormsg = 'Problem loading table ' . $name;
                 $this->debug($this->errormsg);
                 $result = false;
             }
         }
     } else {
         $this->errormsg = 'Missing TABLES section';
         $this->debug($this->errormsg);
         $result = false;
     }
     // Perform some general checks over tables
     if ($result && $this->tables) {
         // Check tables names are ok (lowercase, a-z _-)
         if (!$this->checkNameValues($this->tables)) {
             $this->errormsg = 'Some TABLES name values are incorrect';
             $this->debug($this->errormsg);
             $result = false;
         }
         // Compute prev/next.
         $this->fixPrevNext($this->tables);
         // Order tables
         if ($result && !$this->orderTables($this->tables)) {
             $this->errormsg = 'Error ordering the tables';
             $this->debug($this->errormsg);
             $result = false;
         }
     }
     // Set some attributes
     if ($result) {
         $this->loaded = true;
     }
     $this->calculateHash();
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:85,代码来源:xmldb_structure.php


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