Browse Source

[svn r12188] export mp3 files too.

Eric Marguin 18 years ago
parent
commit
4b82885245
2 changed files with 18 additions and 4 deletions
  1. 3 2
      main/newscorm/learnpath.class.php
  2. 15 2
      main/newscorm/learnpathItem.class.php

+ 3 - 2
main/newscorm/learnpath.class.php

@@ -6740,7 +6740,8 @@ function display_thread_form($action = 'add', $id = 0, $extra_info = '')
 		 		
 		 		
 		 		//get the path of the file(s) from the course directory root
-				$my_file_path = $item->get_file_path();
+				$my_file_path = $item->get_file_path('scorm/'.$this->path.'/');
+				
 				$my_xml_file_path = htmlentities($my_file_path); 
 				$my_sub_dir = dirname($my_file_path); 
 				$my_xml_sub_dir = htmlentities($my_sub_dir);
@@ -6838,8 +6839,8 @@ function display_thread_form($action = 'add', $id = 0, $extra_info = '')
 		 		//$my_dependency = $xmldoc->createElement('dependency');
 		 		//$my_dependency->setAttribute('identifierref','');
 		 		$resources->appendChild($my_resource);
-		 		
 		 		$zip_files[] = $my_file_path;
+		 		
 				//error_log('File '.$my_file_path. ' added to $zip_files',0);
 	 		}
 	 		else

+ 15 - 2
main/newscorm/learnpathItem.class.php

@@ -269,7 +269,7 @@ class learnpathItem{
      * Gets the file path from the course's root directory, no matter what tool it is from.
      * @return	string	The file path, or an empty string if there is no file attached, or '-1' if the file must be replaced by an error page
      */
-    function get_file_path(){
+    function get_file_path($path_to_scorm_dir=''){
     	if($this->debug>0){error_log('New LP - In learnpathItem::get_file_path()',0);}
     	$path = $this->get_path();
    		$type = $this->get_type();
@@ -307,6 +307,10 @@ class learnpathItem{
     				return '-1';
     		}
     	}else{
+    		if(!empty($path_to_scorm_dir))
+    		{
+    			$path = $path_to_scorm_dir.$path;
+    		}
     		return $path;
     	}
     }
@@ -503,7 +507,7 @@ class learnpathItem{
 						case 'htm':
 						case 'shtml':
 						case 'css':
-					 		$wanted_attributes = array('src','url','@import','href');
+					 		$wanted_attributes = array('src','url','@import','href','value');
 			    			//parse it for included resources
 			    			/*
 			    			$fh = fopen($abs_path,'r');
@@ -532,8 +536,17 @@ class learnpathItem{
 								{
 									//find which kind of path these are (local or remote)
 									$sources = $attributes[$attr];
+									
 									foreach($sources as $source)
 									{
+										
+										if($attr == 'value')
+										{
+											if(strpos($source , 'mp3file'))
+											{
+												$files_list[] = array(substr($source , strpos($source , 'mp3file=')+8),'local','rel');
+											}
+										}
 										if(strstr($source,'://') > 0)
 										{
 											//found some protocol there