當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLDBTable::isLoaded方法代碼示例

本文整理匯總了PHP中XMLDBTable::isLoaded方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDBTable::isLoaded方法的具體用法?PHP XMLDBTable::isLoaded怎麽用?PHP XMLDBTable::isLoaded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLDBTable的用法示例。


在下文中一共展示了XMLDBTable::isLoaded方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: trim

 /**
  * Load data from XML to the structure
  */
 function arr2XMLDBStructure($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';
         xmldb_dbg($this->errormsg);
         $result = false;
     }
     if (isset($xmlarr['XMLDB']['@']['VERSION'])) {
         $this->version = trim($xmlarr['XMLDB']['@']['VERSION']);
     } else {
         $this->errormsg = 'Missing VERSION attribute';
         xmldb_dbg($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';
             xmldb_dbg($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 XMLDBTable($name);
             $table->arr2XMLDBTable($xmltable);
             $this->tables[] = $table;
             if (!$table->isLoaded()) {
                 $this->errormsg = 'Problem loading table ' . $name;
                 xmldb_dbg($this->errormsg);
                 $result = false;
             }
         }
     } else {
         $this->errormsg = 'Missing TABLES section';
         xmldb_dbg($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';
             xmldb_dbg($this->errormsg);
             $result = false;
         }
         /// Check previous & next are ok (duplicates and existing tables)
         if ($result && !$this->checkPreviousNextValues($this->tables)) {
             $this->errormsg = 'Some TABLES previous/next values are incorrect';
             xmldb_dbg($this->errormsg);
             $result = false;
         }
         /// Order tables
         if ($result && !$this->orderTables($this->tables)) {
             $this->errormsg = 'Error ordering the tables';
             xmldb_dbg($this->errormsg);
             $result = false;
         }
     }
     /// Iterate over statements
     if (isset($xmlarr['XMLDB']['#']['STATEMENTS']['0']['#']['STATEMENT'])) {
         foreach ($xmlarr['XMLDB']['#']['STATEMENTS']['0']['#']['STATEMENT'] as $xmlstatement) {
             if (!$result) {
                 //Skip on error
                 continue;
             }
             $name = trim($xmlstatement['@']['NAME']);
             $statement = new XMLDBStatement($name);
             $statement->arr2XMLDBStatement($xmlstatement);
             $this->statements[] = $statement;
             if (!$statement->isLoaded()) {
                 $this->errormsg = 'Problem loading statement ' . $name;
                 xmldb_dbg($this->errormsg);
                 $result = false;
             }
         }
     }
     /// Perform some general checks over statements
     if ($result && $this->statements) {
//.........這裏部分代碼省略.........
開發者ID:janaece,項目名稱:globalclassroom4_clean,代碼行數:101,代碼來源:XMLDBStructure.class.php


注:本文中的XMLDBTable::isLoaded方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。