123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- class scormMetadata
- {
- public $lom = '';
- public $schema = '';
- public $schemaversion = '';
- public $location = '';
- public $text = '';
- public $attribs = array();
-
- public function __construct($type = 'manifest', &$element)
- {
- if (isset($element)) {
-
- switch ($type) {
- case 'db':
-
- return false;
-
- case 'manifest':
- $children = $element->childNodes;
- foreach ($children as $child) {
- switch ($child->nodeType) {
- case XML_ELEMENT_NODE:
-
- switch ($child->tagName) {
- case 'lom':
- $childchildren = $child->childNodes;
- foreach ($childchildren as $childchild) {
- $this->lom = $childchild->nodeValue;
- }
- break;
- case 'schema':
- $childchildren = $child->childNodes;
- foreach ($childchildren as $childchild) {
-
- $this->schema = $childchild->nodeValue;
- }
- break;
- case 'schemaversion':
- $childchildren = $child->childNodes;
- foreach ($childchildren as $childchild) {
-
- $this->schemaversion = $childchild->nodeValue;
- }
- break;
- case 'location':
- $childchildren = $child->childNodes;
- foreach ($childchildren as $childchild) {
-
- $this->location = $childchild->nodeValue;
- }
- break;
- }
- break;
- case XML_TEXT_NODE:
- if (trim($child->textContent) != '') {
- if (count($children == 1)) {
-
- $this->text = $child->textContent;
- } else {
- $this->text[$element->tagName] = $child->textContent;
- }
- }
- break;
- }
- }
- $attributes = $element->attributes;
-
- if (is_array($attributes)) {
- foreach ($attributes as $attrib) {
- if (trim($attrib->value) != '') {
- $this->attribs[$attrib->name] = $attrib->value;
- }
- }
- }
- return true;
-
- }
-
- }
- return false;
- }
- }
|