public function importContent($package, $item, $language = '', $validate = true) {
	    //load and validate the package
	    $packageParser = new PackageParser($package);
	    $packageParser->validate();
	    
	    if($packageParser->isValid()){
	    
	        //extract the package
	        $folder = $packageParser->extract();
	        if(!is_dir($folder)){
	            throw new taoItems_models_classes_Import_ExtractException();
	        }
	    
	        //load and validate the manifest
	        $fileParser = new tao_models_classes_Parser($folder .'index.html', array('extension' => 'html'));
	        $taoItemsBasePath = common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems')->getDir();
	        $fileParser->validate($taoItemsBasePath.'/models/classes/data/xhtml/xhtml.xsd');
	    
	        if(!$validate || $fileParser->isValid()){
	    
	            $dir = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item);
	            foreach (
	                $iterator = new \RecursiveIteratorIterator(
	                    new \RecursiveDirectoryIterator($folder, \RecursiveDirectoryIterator::SKIP_DOTS),
	                    \RecursiveIteratorIterator::SELF_FIRST) as $content
	            ) {
	                if (!$content->isDir()) {
	                    common_Logger::i('Upload '.$content.' to '.$iterator->getSubPathName());
	                    $file = $dir->getFile($iterator->getSubPathName());
	                    $fh = fopen($content, 'r');
	                    $file->write($fh);
	                    fclose($fh);
	                }
	            }
	            $returnValue = common_report_Report::createSuccess(__('%s was successfully replaced', $item->getLabel()), $item);
	        } else {
	            helpers_File::remove($folder);
	            $returnValue = $fileParser->getReport();
	            $returnValue->setTitle(__('Validation of the imported file has failed'));
	        }
	    } else {
	        $returnValue = $packageParser->getReport();
	        $returnValue->setTitle(__('Validation of the imported package has failed'));
	    }
	    return $returnValue;
	}
public function importContent($package, $item, $language = '', $validate = true) {
	    //load and validate the package
	    $packageParser = new PackageParser($package);
	    $packageParser->validate();
	    
	    if($packageParser->isValid()){
	    
	        //extract the package
	        $folder = $packageParser->extract();
	        if(!is_dir($folder)){
	            throw new taoItems_models_classes_Import_ExtractException();
	        }
	    
	        //load and validate the manifest
	        $fileParser = new tao_models_classes_Parser($folder .'index.html', array('extension' => 'html'));
	        $taoItemsBasePath = common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems')->getDir();
	        $fileParser->validate($taoItemsBasePath.'/models/classes/data/xhtml/xhtml.xsd');
	    
	        if(!$validate || $fileParser->isValid()){
	    
	            $dir = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item);
	            foreach (
	                $iterator = new \RecursiveIteratorIterator(
	                    new \RecursiveDirectoryIterator($folder, \RecursiveDirectoryIterator::SKIP_DOTS),
	                    \RecursiveIteratorIterator::SELF_FIRST) as $content
	            ) {
	                if (!$content->isDir()) {
	                    common_Logger::i('Upload '.$content.' to '.$iterator->getSubPathName());
	                    $file = $dir->getFile($iterator->getSubPathName());
	                    $fh = fopen($content, 'r');
	                    $file->write($fh);
	                    fclose($fh);
	                }
	            }
	            $returnValue = common_report_Report::createSuccess(__('%s was successfully replaced', $item->getLabel()), $item);
	        } else {
	            helpers_File::remove($folder);
	            $returnValue = $fileParser->getReport();
	            $returnValue->setTitle(__('Validation of the imported file has failed'));
	        }
	    } else {
	        $returnValue = $packageParser->getReport();
	        $returnValue->setTitle(__('Validation of the imported package has failed'));
	    }
	    return $returnValue;
	}
public function importContent ( $ package , $ item , $ language = '' , $ validate = true ) { //load and validate the package $ packageParser = new PackageParser ( $ package ) ; $ packageParser -> validate ( ) ; if ( $ packageParser -> isValid ( ) ) { //extract the package $ folder = $ packageParser -> extract ( ) ; if ( ! is_dir ( $ folder ) ) { throw new taoItems_models_classes_Import_ExtractException ( ) ; } //load and validate the manifest $ fileParser = new tao_models_classes_Parser ( $ folder . 'index.html' , array ( 'extension' => 'html' ) ) ; $ taoItemsBasePath = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'taoItems' ) -> getDir ( ) ; $ fileParser -> validate ( $ taoItemsBasePath . '/models/classes/data/xhtml/xhtml.xsd' ) ; if ( ! $ validate || $ fileParser -> isValid ( ) ) { $ dir = taoItems_models_classes_ItemsService :: singleton ( ) -> getItemDirectory ( $ item ) ; foreach ( $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ folder , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: SELF_FIRST ) as $ content ) { if ( ! $ content -> isDir ( ) ) { common_Logger :: i ( 'Upload ' . $ content . ' to ' . $ iterator -> getSubPathName ( ) ) ; $ file = $ dir -> getFile ( $ iterator -> getSubPathName ( ) ) ; $ fh = fopen ( $ content , 'r' ) ; $ file -> write ( $ fh ) ; fclose ( $ fh ) ; } } $ returnValue = common_report_Report :: createSuccess ( __ ( '%s was successfully replaced' , $ item -> getLabel ( ) ) , $ item ) ; } else { helpers_File :: remove ( $ folder ) ; $ returnValue = $ fileParser -> getReport ( ) ; $ returnValue -> setTitle ( __ ( 'Validation of the imported file has failed' ) ) ; } } else { $ returnValue = $ packageParser -> getReport ( ) ; $ returnValue -> setTitle ( __ ( 'Validation of the imported package has failed' ) ) ; } return $ returnValue ; }
import the owi as content into an existing item
replacing the old content

@param string $package
@param \core_kernel_classes_Resource $item
@param string $language
@param string $validate
@throws taoItems_models_classes_Import_ExtractException
@throws taoItems_models_classes_Import_ImportException
@return common_report_Report
import the owi as content into an existing item replacing the old content