diff new/test_base.php @ 16:01608b20a12d

update
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 10 May 2016 18:20:05 +0100
parents 853caf8cd74b
children 9da74cda0375
line wrap: on
line diff
--- a/new/test_base.php	Wed May 04 17:25:19 2016 +0100
+++ b/new/test_base.php	Tue May 10 18:20:05 2016 +0100
@@ -59,7 +59,7 @@
     $queryString = http_build_query($queryStringParsed);
     $absoluteUrlNextPlusOne = $absoluteUrlSplit[0]."?".$queryString;
   }
-  $defaultTestEntry = Array('url' => null, 'string' => null, 'class' => 'disabled', 'a' => false, 'editable' => false, 'alwaysAccessible' => false);
+  $defaultTestEntry = Array('url' => null, 'string' => null, 'class' => 'disabled', 'a' => false, 'editable' => false, 'alwaysAccessible' => false, 'returnUrl' => '', 'saveFilenamePrefix' => '');
 
   require_once('test_list.php'); //this returns $tests
 
@@ -72,8 +72,10 @@
   // until this point, the content of $tests will always be the same for a given $id,
   // regardless of how many times we visited this page.
   for($n = 0; $n < sizeof($tests); $n++ ){
-    //TODO: check if the corresponding file exists
+    //TODO: check if the corresponding file 
     // meantime, let us just rely on the GET variable 'next'
+    $filename = pathinfo($tests[$n]['url'], PATHINFO_FILENAME);
+    $tests[$n]['saveFilenamePrefix'] = urlencode($id."-".$filename);
     if($n <= $next){
       $tests[$n]['a'] = true;
       $tests[$n]['class'] = 'enabled done';
@@ -163,7 +165,7 @@
   // id= keeps track of the user and of the sorting of the tests in this page
   // next= keeps track of the first test not yet undertaken
   
-  echo '<a href="'.$test['url'].'&returnUrl='.$test['returnUrl'].'">'.($n+1).' - '.$test['string'].'</a>';
+  echo '<a href="'.$test['url'].'&saveFilenamePrefix='.$test['saveFilenamePrefix'].'&returnURL='.$test['returnUrl'].'">'.($n+1).' - '.$test['string'].'</a>';
 } else {
   echo ($n+1).' - '.$test['string'];
 }