public static function getResourcesFromManifest( SimpleXMLElement $source)
    {
        $returnValue = array();

		//check of the root tag
		if($source->getName() != 'manifest'){
			throw new ParsingException("incorrect manifest root tag");
		}
			
		$resourceNodes = $source->xpath("//*[name(.)='resource']");
		foreach($resourceNodes as $resourceNode){
            
			$type = (string) $resourceNode['type'];
			if(Resource::isAssessmentItem($type)){
					
				$id = (string) $resourceNode['identifier'];
				$href = (isset($resourceNode['href'])) ? (string) $resourceNode['href'] : '';
					
				$auxFiles = array();
                
                //parse for auxiliary files
				foreach($resourceNode->file as $fileNode){
					$fileHref = (string) $fileNode['href'];
                    if($href != $fileHref){
                        $auxFiles[] = $fileHref;
                    }
				}
				
                //include dependency files in item
                foreach($resourceNode->dependency as $dependencyNode){
                    $ref = (string) $dependencyNode['identifierref'];
                    //find referenced files within the current manifest:
                    $refResourceNodes = $source->xpath("//*[name(.)='resource' and @identifier='".$ref."']");
                    foreach($refResourceNodes as $refResourceNode){
                        if(isset($refResourceNode['href'])){
                            $auxFiles[] = (string) $refResourceNode['href'];
                        }
                    }
                }
                
				$resource = new Resource($id, $type, $href);
				$resource->setAuxiliaryFiles($auxFiles);
					
				$returnValue[] = $resource;
			}
		}

        return (array) $returnValue;
    }
public static function getResourcesFromManifest( SimpleXMLElement $source)
    {
        $returnValue = array();

		//check of the root tag
		if($source->getName() != 'manifest'){
			throw new ParsingException("incorrect manifest root tag");
		}
			
		$resourceNodes = $source->xpath("//*[name(.)='resource']");
		foreach($resourceNodes as $resourceNode){
            
			$type = (string) $resourceNode['type'];
			if(Resource::isAssessmentItem($type)){
					
				$id = (string) $resourceNode['identifier'];
				$href = (isset($resourceNode['href'])) ? (string) $resourceNode['href'] : '';
					
				$auxFiles = array();
                
                //parse for auxiliary files
				foreach($resourceNode->file as $fileNode){
					$fileHref = (string) $fileNode['href'];
                    if($href != $fileHref){
                        $auxFiles[] = $fileHref;
                    }
				}
				
                //include dependency files in item
                foreach($resourceNode->dependency as $dependencyNode){
                    $ref = (string) $dependencyNode['identifierref'];
                    //find referenced files within the current manifest:
                    $refResourceNodes = $source->xpath("//*[name(.)='resource' and @identifier='".$ref."']");
                    foreach($refResourceNodes as $refResourceNode){
                        if(isset($refResourceNode['href'])){
                            $auxFiles[] = (string) $refResourceNode['href'];
                        }
                    }
                }
                
				$resource = new Resource($id, $type, $href);
				$resource->setAuxiliaryFiles($auxFiles);
					
				$returnValue[] = $resource;
			}
		}

        return (array) $returnValue;
    }
public static function getResourcesFromManifest ( SimpleXMLElement $ source ) { $ returnValue = array ( ) ; //check of the root tag if ( $ source -> getName ( ) != 'manifest' ) { throw new ParsingException ( "incorrect manifest root tag" ) ; } $ resourceNodes = $ source -> xpath ( "//*[name(.)='resource']" ) ; foreach ( $ resourceNodes as $ resourceNode ) { $ type = ( string ) $ resourceNode [ 'type' ] ; if ( Resource :: isAssessmentItem ( $ type ) ) { $ id = ( string ) $ resourceNode [ 'identifier' ] ; $ href = ( isset ( $ resourceNode [ 'href' ] ) ) ? ( string ) $ resourceNode [ 'href' ] : '' ; $ auxFiles = array ( ) ; //parse for auxiliary files foreach ( $ resourceNode -> file as $ fileNode ) { $ fileHref = ( string ) $ fileNode [ 'href' ] ; if ( $ href != $ fileHref ) { $ auxFiles [ ] = $ fileHref ; } } //include dependency files in item foreach ( $ resourceNode -> dependency as $ dependencyNode ) { $ ref = ( string ) $ dependencyNode [ 'identifierref' ] ; //find referenced files within the current manifest: $ refResourceNodes = $ source -> xpath ( "//*[name(.)='resource' and @identifier='" . $ ref . "']" ) ; foreach ( $ refResourceNodes as $ refResourceNode ) { if ( isset ( $ refResourceNode [ 'href' ] ) ) { $ auxFiles [ ] = ( string ) $ refResourceNode [ 'href' ] ; } } } $ resource = new Resource ( $ id , $ type , $ href ) ; $ resource -> setAuxiliaryFiles ( $ auxFiles ) ; $ returnValue [ ] = $ resource ; } } return ( array ) $ returnValue ; }
Enables you to build the QTI_Resources from a manifest xml data node
Content Packaging 1.1)

@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param  SimpleXMLElement source
@return array
@see http://www.imsglobal.org/question/qti_v2p0/imsqti_intgv2p0.html#section10003
Enables you to build the QTI_Resources from a manifest xml data node Content Packaging 1 . 1 )