public function getDataItemByRdfItem(core_kernel_classes_Resource $item, $langCode = '', $resolveXInclude = false)
    {
        $returnValue = null;

        try {
            //Parse it and build the QTI_Data_Item
            $file = $this->getXmlByRdfItem($item, $langCode);
            $qtiParser = new Parser($file);
            $returnValue = $qtiParser->load();

            if(is_null($returnValue) && !empty($qtiParser->getErrors())){
                common_Logger::w($qtiParser->displayErrors(false));
            }

            if($resolveXInclude && !empty($langCode)){
                try{
                    //loadxinclude
                    $resolver = new ItemMediaResolver($item, $langCode);
                    $xincludeLoader = new XIncludeLoader($returnValue, $resolver);
                    $xincludeLoader->load(true);
                } catch(XIncludeException $exception){
                    common_Logger::e($exception->getMessage());
                }
            }

            if (!$returnValue->getAttributeValue('xml:lang')) {
                $returnValue->setAttribute('xml:lang', \common_session_SessionManager::getSession()->getDataLanguage());
            }
        } catch (FileNotFoundException $e) {
            // fail silently, since file might not have been created yet
            // $returnValue is then NULL.
            common_Logger::d('item('.$item->getUri().') is empty, newly created?');
        } catch (common_Exception $e){
            common_Logger::d('item('.$item->getUri().') is not existing');
        }

        return $returnValue;
    }
public function getDataItemByRdfItem(core_kernel_classes_Resource $item, $langCode = '', $resolveXInclude = false)
    {
        $returnValue = null;

        try {
            //Parse it and build the QTI_Data_Item
            $file = $this->getXmlByRdfItem($item, $langCode);
            $qtiParser = new Parser($file);
            $returnValue = $qtiParser->load();

            if(is_null($returnValue) && !empty($qtiParser->getErrors())){
                common_Logger::w($qtiParser->displayErrors(false));
            }

            if($resolveXInclude && !empty($langCode)){
                try{
                    //loadxinclude
                    $resolver = new ItemMediaResolver($item, $langCode);
                    $xincludeLoader = new XIncludeLoader($returnValue, $resolver);
                    $xincludeLoader->load(true);
                } catch(XIncludeException $exception){
                    common_Logger::e($exception->getMessage());
                }
            }

            if (!$returnValue->getAttributeValue('xml:lang')) {
                $returnValue->setAttribute('xml:lang', \common_session_SessionManager::getSession()->getDataLanguage());
            }
        } catch (FileNotFoundException $e) {
            // fail silently, since file might not have been created yet
            // $returnValue is then NULL.
            common_Logger::d('item('.$item->getUri().') is empty, newly created?');
        } catch (common_Exception $e){
            common_Logger::d('item('.$item->getUri().') is not existing');
        }

        return $returnValue;
    }
public function getDataItemByRdfItem ( core_kernel_classes_Resource $ item , $ langCode = '' , $ resolveXInclude = false ) { $ returnValue = null ; try { //Parse it and build the QTI_Data_Item $ file = $ this -> getXmlByRdfItem ( $ item , $ langCode ) ; $ qtiParser = new Parser ( $ file ) ; $ returnValue = $ qtiParser -> load ( ) ; if ( is_null ( $ returnValue ) && ! empty ( $ qtiParser -> getErrors ( ) ) ) { common_Logger :: w ( $ qtiParser -> displayErrors ( false ) ) ; } if ( $ resolveXInclude && ! empty ( $ langCode ) ) { try { //loadxinclude $ resolver = new ItemMediaResolver ( $ item , $ langCode ) ; $ xincludeLoader = new XIncludeLoader ( $ returnValue , $ resolver ) ; $ xincludeLoader -> load ( true ) ; } catch ( XIncludeException $ exception ) { common_Logger :: e ( $ exception -> getMessage ( ) ) ; } } if ( ! $ returnValue -> getAttributeValue ( 'xml:lang' ) ) { $ returnValue -> setAttribute ( 'xml:lang' , \ common_session_SessionManager :: getSession ( ) -> getDataLanguage ( ) ) ; } } catch ( FileNotFoundException $ e ) { // fail silently, since file might not have been created yet // $returnValue is then NULL. common_Logger :: d ( 'item(' . $ item -> getUri ( ) . ') is empty, newly created?' ) ; } catch ( common_Exception $ e ) { common_Logger :: d ( 'item(' . $ item -> getUri ( ) . ') is not existing' ) ; } return $ returnValue ; }
Load a QTI_Item from an, RDF Item using the itemContent property of the
Item as the QTI xml

@access public
@author Somsack Sipasseuth, <somsack.sipasseuth@tudor.lu>
@param  Resource item
@throws \common_Exception If $item is not representing an item with a QTI item model.
@return Item An item as a business object.
Load a QTI_Item from an RDF Item using the itemContent property of the Item as the QTI xml