public function parseOrganizationsNode(\DOMDocument $dom)
    {
        $organizationsList = $dom->getElementsByTagName('organizations');
        $resources = $dom->getElementsByTagName('resource');

        if ($organizationsList->length > 0) {
            $organizations = $organizationsList->item(0);
            $organization = $organizations->firstChild;

            if (!is_null($organizations->attributes)
                && !is_null($organizations->attributes->getNamedItem('default'))) {
                $defaultOrganization = $organizations->attributes->getNamedItem('default')->nodeValue;
            } else {
                $defaultOrganization = null;
            }
            // No default organization is defined
            if (is_null($defaultOrganization)) {
                while (!is_null($organization)
                    && 'organization' !== $organization->nodeName) {
                    $organization = $organization->nextSibling;
                }

                if (is_null($organization)) {
                    return $this->parseResourceNodes($resources);
                }
            }
            // A default organization is defined
            // Look for it
            else {
                while (!is_null($organization)
                    && ('organization' !== $organization->nodeName
                        || is_null($organization->attributes->getNamedItem('identifier'))
                        || $organization->attributes->getNamedItem('identifier')->nodeValue !== $defaultOrganization)) {
                    $organization = $organization->nextSibling;
                }

                if (is_null($organization)) {
                    throw new InvalidScormArchiveException('default_organization_not_found_message');
                }
            }

            return $this->parseItemNodes($organization, $resources);
        } else {
            throw new InvalidScormArchiveException('no_organization_found_message');
        }
    }
public function parseOrganizationsNode(\DOMDocument $dom)
    {
        $organizationsList = $dom->getElementsByTagName('organizations');
        $resources = $dom->getElementsByTagName('resource');

        if ($organizationsList->length > 0) {
            $organizations = $organizationsList->item(0);
            $organization = $organizations->firstChild;

            if (!is_null($organizations->attributes)
                && !is_null($organizations->attributes->getNamedItem('default'))) {
                $defaultOrganization = $organizations->attributes->getNamedItem('default')->nodeValue;
            } else {
                $defaultOrganization = null;
            }
            // No default organization is defined
            if (is_null($defaultOrganization)) {
                while (!is_null($organization)
                    && 'organization' !== $organization->nodeName) {
                    $organization = $organization->nextSibling;
                }

                if (is_null($organization)) {
                    return $this->parseResourceNodes($resources);
                }
            }
            // A default organization is defined
            // Look for it
            else {
                while (!is_null($organization)
                    && ('organization' !== $organization->nodeName
                        || is_null($organization->attributes->getNamedItem('identifier'))
                        || $organization->attributes->getNamedItem('identifier')->nodeValue !== $defaultOrganization)) {
                    $organization = $organization->nextSibling;
                }

                if (is_null($organization)) {
                    throw new InvalidScormArchiveException('default_organization_not_found_message');
                }
            }

            return $this->parseItemNodes($organization, $resources);
        } else {
            throw new InvalidScormArchiveException('no_organization_found_message');
        }
    }
public function parseOrganizationsNode ( \ DOMDocument $ dom ) { $ organizationsList = $ dom -> getElementsByTagName ( 'organizations' ) ; $ resources = $ dom -> getElementsByTagName ( 'resource' ) ; if ( $ organizationsList -> length > 0 ) { $ organizations = $ organizationsList -> item ( 0 ) ; $ organization = $ organizations -> firstChild ; if ( ! is_null ( $ organizations -> attributes ) && ! is_null ( $ organizations -> attributes -> getNamedItem ( 'default' ) ) ) { $ defaultOrganization = $ organizations -> attributes -> getNamedItem ( 'default' ) -> nodeValue ; } else { $ defaultOrganization = null ; } // No default organization is defined if ( is_null ( $ defaultOrganization ) ) { while ( ! is_null ( $ organization ) && 'organization' !== $ organization -> nodeName ) { $ organization = $ organization -> nextSibling ; } if ( is_null ( $ organization ) ) { return $ this -> parseResourceNodes ( $ resources ) ; } } // A default organization is defined // Look for it else { while ( ! is_null ( $ organization ) && ( 'organization' !== $ organization -> nodeName || is_null ( $ organization -> attributes -> getNamedItem ( 'identifier' ) ) || $ organization -> attributes -> getNamedItem ( 'identifier' ) -> nodeValue !== $ defaultOrganization ) ) { $ organization = $ organization -> nextSibling ; } if ( is_null ( $ organization ) ) { throw new InvalidScormArchiveException ( 'default_organization_not_found_message' ) ; } } return $ this -> parseItemNodes ( $ organization , $ resources ) ; } else { throw new InvalidScormArchiveException ( 'no_organization_found_message' ) ; } }
Looks for the organization to use.

@param \DOMDocument $dom

@return array of Sco

@throws InvalidScormArchiveException If a default organization
is defined and not found
Looks for the organization to use .