<?php // $Id: jstimer.php,v 1.16.2.1 2007/11/02 16:19:56 tjhunt Exp $
// QuizTimer main routines.
// This will produce a floating timer that counts
// how much time is left to answer the quiz.
//
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
?>

<script type="text/javascript">
//<![CDATA[
var timesup = "<?php print_string("timesup","quiz");?>";
var quizclose = <?php echo ($quiz->timeclose - time()) - $timerstartvalue; ?>; // in seconds
var quizTimerValue = <?php echo $timerstartvalue; ?>; // in seconds
parseInt(quizTimerValue);

// @EC PF : client time when page was opened
var ec_page_start = new Date().getTime();
// @EC PF : client time when quiz should end
var ec_quiz_finish = ec_page_start + <?php echo ($timerstartvalue * 1000); ?>;

//]]>
</script>
<div id="timer">
<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<table class="generalbox" border="0" cellpadding="0" cellspacing="0" style="width:150px;">
<tr>
    <td class="generalboxcontent" bgcolor="#ffffff" width="100%">
    <table class="generaltable" border="0" width="150" cellspacing="0" cellpadding="0">
    <tr>
        <th class="generaltableheader" width="100%" scope="col"><?php print_string("timeleft","quiz");?></th>
    </tr>
    <tr>
        <td id="QuizTimer" class="generaltablecell" align="center" width="100%">
        <form id="clock"><div><input onfocus="blur()" type="text" id="time"
        style="background-color: transparent; border: none; width: 70%; font-family: sans-serif; font-size: 14pt; font-weight: bold; text-align: center;" />
        </div>
        </form>
        </td>
    </tr>
<!--(Shirai095): 小テストのタイマー表示位置を画面四隅に動かすボタンの追加(2008/09/13)-->
<!--(Shirai095): ここから追加-->
<?php if (fs_function_enable('FS_DISABLE_TIMERPOSITION')) {
echo '
    <tr> <td nowrap bgcolor="#ffffff">
    <input type="button" value="'.get_string('tposLeft' , 'fs_moodle').'" style="background-color:#ffffff" onClick="alignX = \'L\';">&nbsp;
    <input type="button" value="'.get_string('tposUp'   , 'fs_moodle').'" style="background-color:#ffffff" onClick="alignY = \'U\';">&nbsp;
    <input type="button" value="'.get_string('tposDown' , 'fs_moodle').'" style="background-color:#ffffff" onClick="alignY = \'D\';">&nbsp;
    <input type="button" value="'.get_string('tposRight', 'fs_moodle').'" style="background-color:#ffffff" onClick="alignX = \'R\';">
    </td></tr>';
} ?>
<!--(Shirai095): ここまで追加-->
    </table>
    </td>
</tr>
</table>
<!--END OF EDIT-->
</div>
<!--(Shirai095): 小テストのタイマー表示位置を画面四隅に動かすボタンの追加(2008/09/13)-->
<!--(Shirai095): var alignXとvar alignYを追加-->
<script type="text/javascript">
//<![CDATA[

var timerbox = document.getElementById('timer');
var theTimer = document.getElementById('QuizTimer');
var theTop = 100;
var old = theTop;
var alignX = 'L';
var alignY = 'U';

movecounter(timerbox);

document.onload = countdown_clock(theTimer);
//]]>
</script>
