Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / quiz / jstimer.php
blobdc3183bf9a17909fd6f5caa71d7e73e31120d39a
1 <?php // $Id$
2 // QuizTimer main routines.
3 // This will produce a floating timer that counts
4 // how much time is left to answer the quiz.
5 //
6 defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
7 ?>
9 <script type="text/javascript">
10 //<![CDATA[
11 var timesup = "<?php print_string("timesup","quiz");?>";
12 var quizclose = <?php echo ($quiz->timeclose - time()) - $timerstartvalue; ?>; // in seconds
13 var quizTimerValue = <?php echo $timerstartvalue; ?>; // in seconds
14 parseInt(quizTimerValue);
16 // @EC PF : client time when page was opened
17 var ec_page_start = new Date().getTime();
18 // @EC PF : client time when quiz should end
19 var ec_quiz_finish = ec_page_start + <?php echo ($timerstartvalue * 1000); ?>;
21 //]]>
22 </script>
23 <div id="timer">
24 <!--EDIT BELOW CODE TO YOUR OWN MENU-->
25 <table class="generalbox" border="0" cellpadding="0" cellspacing="0" style="width:150px;">
26 <tr>
27 <td class="generalboxcontent" bgcolor="#ffffff" width="100%">
28 <table class="generaltable" border="0" width="150" cellspacing="0" cellpadding="0">
29 <tr>
30 <th class="generaltableheader" width="100%" scope="col"><?php print_string("timeleft","quiz");?></th>
31 </tr>
32 <tr>
33 <td id="QuizTimer" class="generaltablecell" align="center" width="100%">
34 <form id="clock"><div><input onfocus="blur()" type="text" id="time"
35 style="background-color: transparent; border: none; width: 70%; font-family: sans-serif; font-size: 14pt; font-weight: bold; text-align: center;" />
36 </div>
37 </form>
38 </td>
39 </tr>
40 </table>
41 </td>
42 </tr>
43 </table>
44 <!--END OF EDIT-->
45 </div>
46 <script type="text/javascript">
47 //<![CDATA[
49 var timerbox = document.getElementById('timer');
50 var theTimer = document.getElementById('QuizTimer');
51 var theTop = 100;
52 var old = theTop;
54 movecounter(timerbox);
56 document.onload = countdown_clock(theTimer);
57 //]]>
58 </script>