|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00023 require_once 'gral_lib/cssparser.php'; 00024 require_once 'xmlbase.php'; 00025 00026 class general_cc_file extends XMLGenericDocument { 00032 protected $root = null; 00033 protected $rootns = null; 00034 protected $rootname = null; 00035 protected $ccnamespaces = array(); 00036 protected $ccnsnames = array(); 00037 00038 public function __construct() { 00039 parent::__construct(); 00040 00041 foreach ($this->ccnamespaces as $key => $value){ 00042 $this->registerNS($key,$value); 00043 } 00044 } 00045 00046 00047 protected function on_create() { 00048 $rootel = $this->append_new_element_ns($this->doc, 00049 $this->ccnamespaces[$this->rootns], 00050 $this->rootname); 00051 //add all namespaces 00052 foreach ($this->ccnamespaces as $key => $value) { 00053 $dummy_attr = "{$key}:dummy"; 00054 $this->doc->createAttributeNS($value,$dummy_attr); 00055 } 00056 00057 // add location of schemas 00058 $schemaLocation=''; 00059 foreach ($this->ccnsnames as $key => $value) { 00060 $vt = empty($schemaLocation) ? '' : ' '; 00061 $schemaLocation .= $vt.$this->ccnamespaces[$key].' '.$value; 00062 } 00063 00064 if (!empty($schemaLocation) && isset($this->ccnamespaces['xsi'])) { 00065 $this->append_new_attribute_ns($rootel, 00066 $this->ccnamespaces['xsi'], 00067 'xsi:schemaLocation', 00068 $schemaLocation); 00069 } 00070 00071 $this->root = $rootel; 00072 } 00073 00074 }