diff new/test_base.php @ 17:9da74cda0375

Ready to go
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 11 May 2016 13:32:54 +0100
parents 01608b20a12d
children b2ae87f9f1c7
line wrap: on
line diff
--- a/new/test_base.php	Tue May 10 18:20:05 2016 +0100
+++ b/new/test_base.php	Wed May 11 13:32:54 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, 'returnUrl' => '', 'saveFilenamePrefix' => '');
+  $defaultTestEntry = Array('url' => null, 'string' => null, 'class' => 'disabled', 'a' => false, 'editable' => false, 'alwaysAccessible' => false, 'returnUrl' => '', 'saveFilenamePrefix' => '', 'allowEarlyExit' => 'false');
 
   require_once('test_list.php'); //this returns $tests
 
@@ -88,7 +88,11 @@
   // if we are going to run a new test, return to the same page with next:=next+1
       $tests[$n]['returnUrl'] = urlencode($absoluteUrlNextPlusOne);
     }
-    if($tests[$n]['alwaysAccessible'] === true){
+    if($n < $next){
+      if($tests[$n]['alwaysAccessible'] === true){
+        $tests[$n]['allowEarlyExit'] = 'true';
+      }
+    }if($tests[$n]['alwaysAccessible'] === true){
       $tests[$n]['class'] .= ' alwaysAccessible';
     }
   }
@@ -116,7 +120,7 @@
 }
 .alwaysAccessible.done a{
   /*color: fa5858;*/
-  background: rgba(255,200,200, 150);
+  background: rgb(255, 249, 54);
 }
 .disabled{
   color: grey;
@@ -129,6 +133,9 @@
   padding-top: 5px;
 }
 
+h1{
+  text-align: center;
+}
   </style>
   <script src="js/jquery-2.1.4.js"></script>
   <script>
@@ -139,7 +146,7 @@
   var elements;
   $(document).ready(function(){
     lis = $('ul');
-    elements = $('li.done:not(.editable):not(.alwaysAccessible)', lis);
+    elements = $('li.done:not(.editable):not(.alwaysAccessible) a', lis);
     for(var n = 0; n < elements.length; n++){
       elements[n].onclick = confirmEditing;
     }
@@ -153,7 +160,7 @@
   </script>
 </head>
 <body>
-
+<h1>Hammond organ listening test</h1>
 <ul class = "tests-list">
 <?php foreach($tests as $n => $test) : ?> 
   <li class="test-element <?php echo $test['class'] ?>">
@@ -165,7 +172,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'].'&saveFilenamePrefix='.$test['saveFilenamePrefix'].'&returnURL='.$test['returnUrl'].'">'.($n+1).' - '.$test['string'].'</a>';
+  echo '<a href="'.$test['url'].'&allowEarlyExit='.$test['allowEarlyExit'].'&saveFilenamePrefix='.$test['saveFilenamePrefix'].'&returnURL='.$test['returnUrl'].'">'.($n+1).' - '.$test['string'].'</a>';
 } else {
   echo ($n+1).' - '.$test['string'];
 }