123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?php
- class scormOrganization
- {
- public $identifier = '';
- public $structure = '';
- public $title = '';
- public $items = array();
- public $metadata;
-
- public function __construct($type = 'manifest', &$element, $scorm_charset = 'UTF-8')
- {
- if (isset($element)) {
-
- switch ($type) {
- case 'db':
-
- return false;
- case 'manifest':
- default:
-
- $children = $element->childNodes;
- foreach ($children as $child) {
- switch ($child->nodeType) {
- case XML_ELEMENT_NODE:
- switch ($child->tagName) {
- case 'item':
- $oItem = new scormItem('manifest', $child);
- if ($oItem->identifier != '') {
- $this->items[$oItem->identifier] = $oItem;
- }
- break;
- case 'metadata':
- $this->metadata = new scormMetadata('manifest', $child);
- break;
- case 'title':
- $tmp_children = $child->childNodes;
- if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
- $this->title = api_utf8_decode(api_html_entity_decode($child->firstChild->nodeValue, ENT_QUOTES, 'UTF-8'));
- }
- break;
- }
- break;
- case XML_TEXT_NODE:
- break;
- }
- }
- if ($element->hasAttributes()) {
- $attributes = $element->attributes;
-
- foreach ($attributes as $attrib) {
- switch ($attrib->name) {
- case 'identifier':
- $this->identifier = $attrib->value;
- break;
- case 'structure':
- $this->structure = $attrib->value;
- break;
- }
- }
- }
- return true;
- }
-
- }
- return false;
- }
-
- public function get_flat_items_list()
- {
- $list = array();
- $i = 1;
- foreach ($this->items as $id => $dummy) {
- $abs_order = 0;
-
- $this->items[$id]->get_flat_list($list,$abs_order, $i, 0);
- $i++;
- }
- return $list;
- }
-
- public function get_name()
- {
- if (!empty($this->title)) {
- return Database::escape_string($this->title);
- } else {
- return '';
- }
- }
-
- public function get_ref()
- {
- if (!empty($this->identifier)) {
- return Database::escape_string($this->identifier);
- } else {
- return '';
- }
- }
-
- public function set_name($title)
- {
- if (!empty($title)) {
- $this->title = Database::escape_string($title);
- }
- }
- }
|