http://www.atutor.ca/atutor/mantis/view.php?id=4420
authorCindy Li <cli@ocad.ca>
Wed, 28 Jul 2010 17:12:48 +0000 (17:12 -0000)
committerCindy Li <cli@ocad.ca>
Wed, 28 Jul 2010 17:12:48 +0000 (17:12 -0000)
docs/home/ims/include/ims_template.inc.php

index b4d3aef..24a5639 100644 (file)
@@ -173,26 +173,28 @@ function print_organizations($parent_id,
                        $content_test_rs = $contentManager->getContentTestsAssoc($content['content_id']);       
                        $test_ids = array();            //reset test ids
                        //$my_files = array();          //reset myfiles.
-                       while ($content_test_row = mysql_fetch_assoc($content_test_rs)){
-                               //export
-                               $test_ids[] = $content_test_row['test_id'];
-                               //the 'added_files' is for adding into the manifest file in this zip
-                               $added_files = test_qti_export($content_test_row['test_id'], '', $zipfile);
-
-                               //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
-                               foreach($added_files as $filename=>$file_array){
-                                       $my_files[] = $filename;
-                                       foreach ($file_array as $garbage=>$filename2){
-                                               if (!in_array($filename2, $my_files)){
-                                                       $my_files[] = $filename2;
+                       if (is_array($content_test_rs)) {
+                               foreach ($content_test_rs as $content_test_row){
+                                       //export
+                                       $test_ids[] = $content_test_row['test_id'];
+                                       //the 'added_files' is for adding into the manifest file in this zip
+                                       $added_files = test_qti_export($content_test_row['test_id'], '', $zipfile);
+       
+                                       //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
+                                       foreach($added_files as $filename=>$file_array){
+                                               $my_files[] = $filename;
+                                               foreach ($file_array as $garbage=>$filename2){
+                                                       if (!in_array($filename2, $my_files)){
+                                                               $my_files[] = $filename2;
+                                                       }
                                                }
                                        }
+       
+                                       //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
+                                       $resources .= str_replace(      array('{TEST_ID}', '{PATH}', '{FILES}'),
+                                                                                               array($content_test_row['test_id'], 'tests_'.$content_test_row['test_id'].'.xml', $added_files_xml),
+                                                                                               $ims_template_xml['resource_test']); 
                                }
-
-                               //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
-                               $resources .= str_replace(      array('{TEST_ID}', '{PATH}', '{FILES}'),
-                                                                                       array($content_test_row['test_id'], 'tests_'.$content_test_row['test_id'].'.xml', $added_files_xml),
-                                                                                       $ims_template_xml['resource_test']); 
                        }
 
                        /* generate the a4a files */