123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- class scormResource
- {
- public $identifier = '';
- public $type = 'webcontent';
-
- public $scormtype = 'sco';
- public $base = '';
- public $href = '';
- public $metadata;
-
-
- public $files = array();
- public $dependencies = array();
-
- public function __construct($type = 'manifest', &$element)
- {
- if (isset($element)) {
-
- switch ($type) {
- case 'db':
-
- return false;
- case 'manifest':
- default:
-
- $children = $element->childNodes;
- if (is_array($children)) {
- foreach ($children as $child) {
- switch ($child->nodeType) {
- case XML_ELEMENT_NODE:
- switch ($child->tagName) {
- case 'file':
-
- $this->files[] = $child->getAttribute('href');
- break;
- case 'metadata':
-
- $this->metadata = new scormMetadata('manifest', $child);
- break;
- case 'dependency':
-
-
- $this->dependencies[] = $child->getAttribute('identifierref');
- break;
- }
- break;
- }
- }
- }
-
- if ($element->hasAttributes()){
-
- $attributes = $element->attributes;
- foreach ($attributes as $attrib) {
- switch ($attrib->name) {
- case 'identifier':
- $this->identifier = $attrib->value;
- break;
- case 'type':
- if (!empty($attrib->value)) {
- $this->type = $attrib->value;
- }
- break;
- case 'scormtype':
- if (!empty($attrib->value)) {
- $this->scormtype = $attrib->value;
- }
- break;
- case 'base':
- $this->base = $attrib->value;
- break;
- case 'href':
- $this->href = $attrib->value;
- break;
- }
- }
- }
- return true;
- }
-
- }
- return false;
- }
-
- public function get_path()
- {
- if (!empty($this->href)) {
- return Database::escape_string($this->href);
- } else {
- return '';
- }
- }
-
- public function get_scorm_type()
- {
- if (!empty($this->scormtype)) {
- return Database::escape_string($this->scormtype);
- } else {
- return '';
- }
- }
- }
|