jhylands

download1.php

Mar 23rd, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.04 KB | None | 0 0
  1. <?php
  2. include 'head.php';
  3. if(isset($logIn)){
  4. if($logIn!="admin"){
  5. echo "<h1>Error:7 # you can not access this page</h1><p>Please <a href='index.php'>click here</a> to go back to where you should be.";
  6. //stops the rest of the page from being shown
  7. exit(404);
  8. }}
  9. ?>
  10. <script>
  11. //an array of all of the descriptions of the limiting factors
  12. var arrDescriptions = new Array("This option will output a CSV where each row is from a specific pupil, about a specific class. You will be able to change the columns later in this form.","This option will output a CSV where each row is the summary from a specific class. The question values will be a summary of all of the students in that class who answered the questions.","This option will output a CSV where each row is a year group.","This option will output a CSV where each row is a subject.","This option will output a CSV where each row is from a teacher.","This option will summarise the question from the whole school for comparison against previous years.");
  13. //declare a global variable allowing the correct descriptions to be shown
  14. var foci=0;
  15. //declare a global variable allowing the correct visuals of the limiting slection summary
  16. var summaryNo=0;
  17. //function to set the description to coraspond with what the user has selected as their limiting selection
  18. function focus(){
  19. //get the description box element and store it to a local variable so it can be edited more easiliy
  20. var informationBox = document.getElementById('limitDescription');
  21. //set the innerHTML (what is displayed inside the box) to a preset description of the limiting selection that is stored in the arrDescription array
  22. informationBox.innerHTML = arrDescriptions[foci];
  23. }
  24. //function to change the limiting selection or set it in the first place
  25. function changeFocus(newFoci){
  26. //unformat the last limiting selection so that only one limiting selection is shown
  27. //first get the object to unformat as a lcoal variable
  28. var visualChange = document.getElementById('limit' + foci);
  29. //set the background back to white
  30. visualChange.style.backgroundColor = "white";
  31. //set the text colour back to black
  32. visualChange.style.color = "black";
  33. //reassign the global variable that holds the limiting selection with the new limiting selection value (the one that has just been clicked on)
  34. foci = newFoci;
  35. //get the object that refers to the element in the form that will be submitted sending data to the next stage of the download form.
  36. //store this to a local variable and update its value with the value of the limiting selection just selected
  37. var limitToSend = document.getElementById('limitToGo1');
  38. limitToSend.value=foci;
  39. //do the same with the other form element (the first refures to the form that sends data to another page, this one refurse to a form that downloads all of the data)
  40. var limitToSend = document.getElementById('limitToGo2');
  41. limitToSend.value=foci;
  42. //change the visuals of the element just selected so that the use can see that the program has picked up their selection
  43. //get the object corisponding to the element the user just clicked on
  44. visualChange = document.getElementById('limit' + foci);
  45. //change the colour of the backgroud to blue
  46. visualChange.style.backgroundColor = "blue";
  47. //change the colour of the text to yellow
  48. visualChange.style.color = "yellow";
  49. //now that we  know the user has selected a limiting selection at least once we can allow the user to go onto another stage and either select more option or download all the data
  50. //the following two lines allow the user to click on the corisponding buttons, they were not able to before as it would have caused an error on the next page as the limiting selection value would be null
  51. document.getElementById('next').disabled = false;
  52. document.getElementById('download').disabled = false;
  53. //change the text in the description to corispond with the updated limiting selection allowing the user to see more information on what they have just selected
  54. focus();
  55. //if the limiting selection is not element then a limiting selection summary type will be required
  56. var summaryTable = document.getElementById('limitingSummary');
  57. if(foci!=0){
  58.     summaryTable.style.visibility = 'visible';
  59. }else{
  60.     summaryTable.style.visibility = 'hidden';
  61. }
  62. }
  63. //function to allow the user to change the summary type of their limiting selection
  64. function changeFoci(newFoci){
  65. //get the object corresponding to the last summary that was selected store it to a local variable
  66. var visualChange = document.getElementById('sum' + summaryNo);
  67. //change the visuals of the old element
  68. visualChange.style.backgroundColor = "white";
  69. visualChange.style.color = "black";
  70. //change the global variable corisponding to the summary
  71. summaryNo = newFoci;
  72. //get the element corrispnding to the variable in the form
  73. var limitToSend = document.getElementById('summary1');
  74. //update its value
  75. limitToSend.value=foci;
  76. //do the same for the other form
  77. var limitToSend = document.getElementById('summary2');
  78. limitToSend.value=summaryNo;
  79. //get the element corisponding to the summary method that has just been selected and store the object to a local variable
  80. visualChange = document.getElementById('sum' + summaryNo);
  81. //change the visuals of the element
  82. visualChange.style.backgroundColor = "blue";
  83. visualChange.style.color = "yellow";
  84. }
  85. </script>
  86. <center><table width="500px">
  87. <tr><td class="dow1tdl"><b>Limiting selection</b></td><td id="summaryType" rowspan="7">
  88. <table id="limitingSummary" style="padding-bottom:90px;height:130px;">
  89. <tr><td><b>Summation for limiting selection</b></td></tr>
  90. <tr><td id="sum0" onclick="changeFoci(0)"><li>Summation</li></td></tr>
  91. <tr><td id="sum1" onclick="changeFoci(1)"><li>Mean</li></td></tr>
  92. <tr><td id="sum2" onclick="changeFoci(2)"><li>Standard deveation</li></td></tr></table></td>
  93. <td id="limitDescription" style="vertical-align:text-top;" rowspan="7"><p> Please select an option from the left.</p></td></tr>
  94. <tr>
  95. <td id="limit0" class="dow1tdl"  onclick="changeFocus(0)"><li>Entry</li></td>
  96. </tr><tr>
  97. <td id="limit1" class="dow1tdl"  onclick="changeFocus(1)"><li>Class</li></td>
  98. </tr><tr>
  99. <td id="limit2" class="dow1tdl"  onclick="changeFocus(2)"><li>Year</li></td>
  100. </tr><tr>
  101. <td id="limit3" class="dow1tdl"  onclick="changeFocus(3)"><li>Subject</li></td>
  102. </tr><tr>
  103. <td id="limit4" class="dow1tdl"  onclick="changeFocus(4)"><li>Teacher</li></td>
  104. </tr><tr>
  105. <td id="limit5" class="dow1tdl"  onclick="changeFocus(5)"><li>Annum</li></td>
  106. </tr><tr>
  107. <td></td><td>
  108. <table><tr>
  109. <td><form action="download2.php" method="POST"><input type="hidden" name="summary" id="summary1" /><input type="hidden" name="limitToGo" id="limitToGo1" value="entry"/><input id="next" value="Next" name ="submit" type="submit" disabled="true" /></form></td>
  110. <td><form action="download4.php" method="POST"><input type="hidden" name="summary" id="summary2" /><input type="hidden" name="dall" value="true" /><input type="hidden" name="limitToGo" id="limitToGo2" value="entry"/><input id="download" value="Download" name ="submit" type="submit" disabled="true" /></form></td>
  111. </tr></table>
  112. </td></tr>
  113. </table></center>
  114. <?php
  115. include 'foot.php';
  116. ?>
Add Comment
Please, Sign In to add comment