|
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/>. 00016 00024 require_once 'cc_organization.php'; 00025 00026 00031 abstract class cc_version_base { 00032 protected $_generator = null; 00033 protected $ccnamespaces = array(); 00034 protected $isrootmanifest = false; 00035 protected $manifestID = null; 00036 protected $organizationid = null; 00037 public $resources = null; 00038 protected $metadata = null; 00039 public $organizations = null; 00040 protected $base = null; 00041 public $ccversion = null; 00042 public $camversion = null; 00043 00044 00045 abstract protected function on_create(DOMDocument &$doc,$rootmanifestnode=null,$nmanifestID=null); 00046 00047 abstract protected function create_metadata_manifest (cc_i_metadata_manifest $met,DOMDocument &$doc,$xmlnode=null); 00048 00049 abstract protected function create_metadata_resource (cc_i_metadata_resource $met,DOMDocument &$doc,$xmlnode=null); 00050 00051 abstract protected function create_metadata_file (cc_i_metadata_file $met,DOMDocument &$doc,$xmlnode=null); 00052 00053 abstract protected function create_resource(cc_i_resource &$res, DOMDocument &$doc, $xmlnode=null); 00054 00055 abstract protected function create_organization(cc_i_organization &$org, DOMDocument &$doc, $xmlnode=null); 00056 00057 public function get_cc_namespaces(){ 00058 return $this->ccnamespaces; 00059 } 00060 00061 public function create_manifest(DOMDocument &$doc,$rootmanifestnode=null){ 00062 return $this->on_create($doc,$rootmanifestnode); 00063 } 00064 00065 public function create_resource_node(cc_i_resource &$res, DOMDocument &$doc, $xmlnode = null) { 00066 return $this->create_resource($res,$doc,$xmlnode); 00067 } 00068 00069 00070 public function create_metadata_node (&$met, DOMDocument &$doc, $xmlnode = null){ 00071 return $this->create_metadata_manifest($met,$doc,$xmlnode); 00072 } 00073 00074 public function create_metadata_resource_node (&$met, DOMDocument &$doc, $xmlnode = null){ 00075 return $this->create_metadata_resource($met,$doc,$xmlnode); 00076 } 00077 00078 public function create_metadata_file_node (&$met, DOMDocument &$doc, $xmlnode = null){ 00079 return $this->create_metadata_file($met,$doc,$xmlnode); 00080 } 00081 00082 public function create_organization_node(cc_i_organization &$org, DOMDocument &$doc, $xmlnode = null) { 00083 return $this->create_organization($org,$doc,$xmlnode); 00084 } 00085 00086 public function manifestID(){ 00087 return $this->manifestID; 00088 } 00089 00090 public function set_manifestID($id){ 00091 $this->manifestID = $id; 00092 } 00093 00094 public function get_base(){ 00095 return $this->base; 00096 } 00097 00098 public function set_base($baseval){ 00099 $this->base = $baseval; 00100 } 00101 00102 public function import_resources(DOMElement &$node, cc_i_manifest &$doc) { 00103 if (is_null($this->resources)){ 00104 $this->resources = array(); 00105 } 00106 $nlist = $node->getElementsByTagNameNS($this->ccnamespaces['imscc'],'resource'); 00107 if (is_object($nlist)) { 00108 foreach ($nlist as $nd) { 00109 $sc = new cc_resource($doc,$nd); 00110 $this->resources[$sc->identifier]=$sc; 00111 } 00112 } 00113 } 00114 00115 public function import_organization_items(DOMElement &$node, cc_i_manifest &$doc) { 00116 if (is_null($this->organizations)) { 00117 $this->organizations = array(); 00118 } 00119 $nlist = $node->getElementsByTagNameNS($this->ccnamespaces['imscc'],'organization'); 00120 if (is_object($nlist)) { 00121 foreach ($nlist as $nd) { 00122 $sc = new cc_organization($nd,$doc); 00123 $this->organizations[$sc->identifier]=$sc; 00124 } 00125 } 00126 } 00127 00128 public function set_generator($value) { 00129 $this->_generator = $value; 00130 } 00131 }