Quiz Timer Hack

Quiz Timer Hack

by Chris U -
Number of replies: 49

Hi,

Well... I needed a timer to restrict students from taking forever on quizzes. (It auto submits the quiz too! smiley.gif) So I made a javascript timer... make a backup copy of your attempt.php located in mod/quiz

Then place a copy of the three js files and the hacked attempt.php in mod/quiz

Of course change your timer time located in the onload statement.

IE: countdown_clock(0,5,0); is equal to five minutes
IE: countdown_clock(1,0,0); is equal to one hour
IE: countdown_clock(0,0,5); is equal to five seconds

URL: http://forbin.ics.hawaii.edu/~chris/quizHack.zip

Enjoy,
_chris

Average of ratings: Useful (1)
In reply to Chris U

Re: Quiz Timer Hack

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What happens when Javascript is turned off in the browser? Can the quiz still be submitted?
In reply to Martin Dougiamas

Re: Quiz Timer Hack

by Chris U -

Hi,

Hrmmm... good question... The lab's our University teach in do not allow disabling of JavaScript. However, if JavaScript was turned off, the timer would be turned off, and even if the timer is disabled because of JavaScript, students could still submit the quiz as usual.

_chris

In reply to Chris U

Re: Quiz Timer Hack

by Timothy Takemoto -

Thanks very much Chris.

I wonder if it integrates with the moodle database to show how long students took over quizzes.

I want to use quizzes to encourage students to practice (as "Excercises") but in order to do that the results of these quizzes must be graded else the students will not do them.

We find that some students ask their friends for the answers and that others answer randomly. In order to counter we find it helps to use timed quizes. Then students that took only a few seconds per question can be graded down as having responded randomly, and those that took too long...well, it is useful to have a script that automatically sends the results in after a certain amount of time. 

I am still using a very basic perl suite called "Quiztest" and not Moodle since it can handle long timed quizes. 
Tim 
Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Timothy Takemoto -

With regard to the point that javascript could be turned off, as I posted to the bug/features request column, please may I share this with Chris U.
Thanks again for the javascript. 

The vast majority of my students are not capable of turning off javascript, but some are. So as it stands, I have a problem. However, if the timer not only timed and automatically submitted the test, but also stored the time taken to the Moodle database, then
1) it would enable instructors for look out for the press-buttons-randomly and leave type students.
2) it would mean that in order to get around the timer, students would have to turn off javascript while, not before, doing the test - since otherwise they would be timed as having taking 0 seconds to do the test, presumably. I think that inclusion of "time taken to do the test" in the moodle database, would prevent the objection that Martin raises to a javascript timer.

A timer could also, I guess, include a "(sytem clock) time when tests started", "time when test finished", and "time taken" so that as well as turning off java during the test, the student would also have to alter their system clock to ensure twts-twtf=tt and this in real time, to the second. This would be impossible for all but super-nerds.

By the way, timing is a must for me because:
1) My boss says it is a must (end of story)
2) To prevent copying says
3) To asses students that are answering too quickly (a lot of them just press the buttons and leave)
4) To emulate TOEIC/TOEFL type language exams, which are all timed.
5) To encourage language aquisition as opposed to learning (language that is accessable at spead is aquired, langauge that is accessable after a period of thought is said to be learnt, and probably not usuable)
6) The other methods of assessment that Martin mentions are not applicable to language education. If my students could take part in "activities" then I would not been to be giving them loads of practice / vocabulary tests.

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Genner Cerna -
Maybe, before the exams starts/attempts triggering the javascript or detecting if the javascript is enable else disable we could require them to enble for the quiz can be taken... The idea is something detecting the javascript is running...
In reply to Genner Cerna

Re: Quiz Timer Hack

by Timothy Takemoto -

Good idea Genner,

There are various ways of testing to see if javascript is enabled.
1) use

<noscript>
<meta http-equiv="refresh" content="1; url=non_js_page.html">
</noscript>

This seems to be the easiest way, does it work?

2) Use a cookie. I am not sure how moodle is creating cookies but if it is using javascript then we already have javascsript testing. If not we could create another cookie using javascript and test to see if it is there. I think that a cookie could also be useful to see if various students are taking a test from the same machine.

http://www.aspfaqs.com/webtech/082400-1.shtml

3) There seems to be a simple way of adding a tag to various calls as detailed here.

http://developer.irt.org/script/649.htm

I have not yet worked out how Chris's javascript works yet. He seems to be a javascript guru.

Tim

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Timothy Takemoto -

It seems that the easiest way of ensuring that Chris U's wonderful quiz timer will always operate is to make sure that people have javascript enabled.

This is easy.

Just add

<noscript>
<meta http-equiv="refresh" content="1; url=http://www.yourdomain.com/moodle/lib/non_js_page.html">
</noscript>

to the top of the javascript.php file in moodle/lib/
Then in the same directory  (moodle/lib/) add a file called, non_js_page.html containing

To access this site you must have javascript enabled in your browser

Most students willl have javascript enabled, since this is the default in the major browsers, this should not be too much of a problem.

Moodle uses some javascript by default. It is not essential for Moodle's functioning, but there is no reason why we as teachers cannot insist that students have javascript enabled.

Your timing addon is great Chris!

But I wish that Martin would get down off his constructivist pedestal, for the sake of language teachers at least, and be so kind as to include timing in the quiz setup modules. As it stands there will be only one time for all quizes. It would be nice if there is a timing dialogue in the quiz creation pages allowing for different times for different quizes. Or, rather, I wish that I had the skill to be able to add a time-out column to the databases for quizes, and were able to code the relevant dialogues to allow instructors to set up timed quizes using the Moodle quiz creation interface.  I have no idea how to extend the database. So I am stuck with one time for all quizes. But this is better than no timing at all.

Thank you Martin and Chris,

Tim

Timothy Takemoto
Yamaguchi University

PS There are still some problems...
We need to be able to prevent students from right-click "copy" so that they do not enter the quiz, copy it, do it at their leisure, go back, and then enter the quiz again. This is two problems. We can prevent rightclick using the javascript that Martin suggested, but I know of no way to prevent people from entering a quiz, looking at the questions, and then going back to the previous page, thinking about the questions, and then proceeding to the quiz page to do them again. We need a way of ensuring that entry to a quiz constitutes an attempt at quiz. As it stands, students can enter a quiz as many times as they like, so long as they go back before the quiz times out.



 

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Chris U -

Hi,

I'm currently working on all the problems and suggestions you have given. Especially the going back to take a quiz feature. I'm thinking of creating the table entry with a new field called inprogress. Which will validate a users amount of tries and see if the "post" will be graded or not. Well see...

L8rs,
_chris

In reply to Chris U

Re: Quiz Timer Hack

by Timothy Takemoto -

Wow, great.

If you have time to tell me a little about where/how you add table entries then I would like to try to add one for the time limit itself - so that all the tests don't have to be 5 minutes (or whatever) long.

Cheers,

Tim 

In reply to Chris U

Re: Quiz Timer Hack

by Genner Cerna -
I encounter an website that dont allow user to go back in browser, They are using javascript, to disallow/disabled the back and previous button... Offcource still we need to enable the javascript and see to it the javascript is running...
In reply to Genner Cerna

Re: Quiz Timer Hack

by Jenny Watt -

You can open the quiz in a new window and then there is no "back". If you store the start time in the record for the student's attempt of the quiz or in a cookie when they first click the link, then they will have from that time until the time allotted has passed to complete it.

In WebCT a student can start a quiz and as they answer each question they click on a Save button that saves their answer to a database. They can save an answer to a question as many times as they want. The save allows them to close the window and reopen it later and have the questions they saved reappear. This is also handy if there is a crash or a disconnect while they are taking the quiz. This is all done with JavaScript and I don't know if the answers are saved in a cookie or on the server. They use frames and the JavaScript lives in one of the frames and may be able to access the server without affecting the quiz.

Also, JavaScript has a focus property or event - you can set it so that if the quiz screen loses focus something happens. There is also an onclose event that could trigger something to happen.

Just some ideas from my experiences.

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Please understand that just because I say I personally don't see something as a priority does not mean it can't or won't be in Moodle!

It's true I have to make some decisions between alternative paths in order to keep Moodle becoming an unholy mess of options and to keep the focus on features important to most people. Like everyone I make decisions on the best information I have and "you can't please everyone all of the time".

But please feel free to make a whole new quiz module designed specifically for language teachers that takes a different approach to the current one - I'm totally OK with that and will even promote and distribute it.
In reply to Martin Dougiamas

Re: Quiz Timer Hack

by Timothy Takemoto -

To Genner
Good idea! Once we INSIST that students use Javascipt, we can prevent the browser back function, which will make it more difficult for them to enter a test and then go back and think about it.
Plus there is the disable right click. I think that it right click should be disabled in attempt.php only and not for the whole site. I want studnents to be able to copy the materials I give them. It is only a problem if they copy the quizzes.

To Martin 
Cool, great! I am glad that you recognise that there are other, non-trendy,  non-constructivist needs out here. To be honest, I am confused myself. Even, or especially, within language teaching there is a big push towards constructivism ("the communicative approach") and NOT-testing, and INTERACTION. But...it is a question of degree. As someone posted recently, testing, or  in my words, "evalu-practice" is very helpful in the language teaching world.

BTW, You might consider a language teachers forum. I think our needs are pretty similar and specific.

I would really like to be able to contribute to quiz development, but as it stands.... it looks difficult. I will keep trying.

Cheers,
Tim

In reply to Chris U

Re: Quiz Timer Hack

by Chris U -

Whoa... be careful folks... I found a jsclock.php which is "included" in attempt.php, you fix this by simply commenting it out. Maybe we can work with jsclock.php a bit more. smiley.gif

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/moodle/moodle/mod/quiz/jsclock.php

_chris

In reply to Chris U

Re: Quiz Timer Hack

by Timothy Takemoto -

Hi Chris, others that would like to see timed tests,

I did not realise that there were these wonderful new module forums, and I was not a member.

The jsclock.php is to let students know when the deadline of the test is about to end.
This is not a function I need (all the deadlines could be at 2 in the morning), but I do need
deadlines, so it would be no good to change the deadline. Is it possible to pass the jsclock.php,
something other than the deadline?

I guess that there is a bit of code redundancy in the solution that you have but, hell, it works.

I look forward very much to a version that

1) Prevents going backwards (either by a new window, or disabling the back button)
2) Takes the timelimit from an extra entry in the database so that we can set different
time limits. As it stands, all my times are going to have to be the same length.

I could do the former quite easily but it seems to be such a trivial thing that if Chris_U is
doing anything to the timer js, then to disapble the back button would be one line of code.


Tim

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Lev Abramov -

Chris, Timothy, Martin and all -

I'd just like to add my voice here.

1. The javascript timer is great - as a first step to timing: it is ONE timer for THE WHOLE pool of quizzes on a site. It will always be too short for some and too long for others.

Ideally, there should be a quiz-specific timer: a line defining the timer settings should be included in the quiz construction interface, with 0 disabling timing and any other value enabling it.  In my non-programmer reckoning, it could probably be realized by calling the jstimer from within the quiz - but it is too tricky for me to figure out how. I hope others on this forum will be savvy enough to implement it. Looks like you guys are close to doing it by adding a table to the DB - that would be great.

2. Setting quizzes up so that clicking the Attempt button will open the quiz in a new window seems like the easiest way out, with minimum programming effort required.

3. Having a forum for language teachers would be very useful.

Thanx in advance for all your efforts!

Best -

Lev

In reply to Lev Abramov

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Chris, Lev and other quizzers

Thank you very much for the timing thing Chris. I have implemented it on my course.

To Lev: I agree that having a forum for language teachers would be very useful.

But on another track, I had a look into preventing the back button. It is not as simple as opening a new window it seems.

http://www.htmlgoodies.com/tutors/nobackbutton.html
http://www-tcsn.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20682401.html
http://www.4guysfromrolla.com/webtech/111500-1.shtml
http://developer.irt.org/script/311.htm

These pages are helpful but they are all pretty complicated. Even so I would try and do what they suggest but I am not sure which file to change. I know that

attempt.php

is the quiz itself. But I do not know which is the the prequiz-page-making-file, i.e. that makes the page in which it has the "attempt quiz" button. Which php file makes the page before you enter a quiz?

By the way, I am using the Japanese version of moodle so I don't know if it is "attempt quiz" or "try quiz" (in Japanese it is "kuizu in chousen suru") but there is a page with a button meaning something like "attempt quiz" and it is necessary to change that page.

Tim

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Genner Cerna -
You mean, quiz can be time now?
In reply to Genner Cerna

Re: Quiz Timer Hack

by Genner Cerna -

Chris...

Could it be possible you can make the: countdown_clock(0,5,0); in variable when changing the time? Need to consider not all quiz takes a longer time to take and other quiz are taken in miniutes? It really depends on the type of quiz... Maybe storing the variable of of the time in a database is one possible solution for different quiz... I'm I saying it correct?, hope you got what im trying to point out....

In reply to Genner Cerna

Re: Quiz Timer Hack

by Genner Cerna -

I'm looking forward, this could be implemented....

In reply to Genner Cerna

Re: Quiz Timer Hack

by Rob Butner -

  WE IMPLEMENTED A HEADER.HTML FILE TO PROTECT MOST OF THE QUIZ FUNCTIONS USING ENCRYPTED JAVASCRIPT. IT DISABLES PRINTING, MOUSE TEXT SELECTION, CNTRL C, RIGHT CLICK, AND IF YOU SAVE TO HARD DRIVE-IT CAN'T BE VIEWED! WE THEN PUT ANYTHING WE WANT TO BE PRINTABLE IN ADOBE ACROBAT FORMAT (NOTES, ETC.)

TO IMPLEMENT IN YOUR MOODLE: COPY THE ATTACHED HEADER.HTML TO YOUR THEME FOLDER---YOU MAY ALSO WANT TO EDIT THE IMG TAG TO POINT TO YOUR LOGO BANNER AND THE COPYRIGHT NOTICE.

UNFORTUNATELY IT REQUIRES JAVASCRIPT TO BE ENABLED.

HOPE IT HELPS----ROB

In reply to Rob Butner

Re: Quiz Timer Hack

by Timothy Takemoto -

Thanks very much Rob

I am not sure how this is doing this but it is almost what I wanted (it will make Chris U's hack approach the functionality of the departed Mr Bristor's hack).

I would like students to be able to copy other areas of the site (other than the quizes) so I guess that I should put the bit between <script></script> tags in the header of mod/quizattempt.php

I don't see how it prevents viewing after saving to the hard drive. But I take your word for it. Fiendish.

I have just tried it out. Using only the javascript part of your header in attempt php, I find that right click is disabled but I can still print using the file menu or "control p". Am I missing something?

Naturally the back button is still working.  

Getting there gradually....

Thank you
Tim
Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Rob Butner -

TIMOTHY---

SOOO SORRY---I UPLOADED THE WRONG HEADER.HTML FILE---IVE ATTACHED THE CORRECT ONE HERE---GO AHEAD AND TRY TO SELECT TEXT, CNTRL C, OR PRINT WITH THIS ONE----ROB-

PS--ILL HAVE THE BACKBUTTON DISABLE IN THE NEXT FEW DAYS----

I'M GOING TO TRY TO IMPLEMENT THE CHANGES TO ATTEMPT.PHP SO THE PROTECTIONS WILL ONLY AFFEXT QUIZZES---TAKE CARE---

In reply to Rob Butner

Re: Quiz Timer Hack

by Joseph Vargas -

Hi there:

I tried your header file.

Somethings are working and others don't seem to be.

The right click is disabled, I can't highlight text and CTRL+C is disabled. However CTRL + P allows for printing the page.

Also, is there a way to disable "View Source" when the command options are viewable?

I am looking forward to seeing the disabled back button feature

Thanks

Joe Vargas

In reply to Rob Butner

Re: Quiz Timer Hack

by Joseph Vargas -

Hi Timothy:

How would I add a background image to your header?

Thanks

Joe

In reply to Joseph Vargas

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Joe Vargas

Sorry to be three weeks late in responding.

That is Rob Butner's header file not mine. I am about to install it today. I don't understand the difference between it and the other one at
http://moodle.org/mod/forum/discuss.php?d=3982

By the way Chris U is no longer enrolled in this course,
or if he is, then he is enrolled under a different name so he will not hear your thanks.

Tim

Timothy Takemoto

In reply to Rob Butner

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Rob Butner

It seems that you are posting two different headers. In the header in your post above, the javascript is encoded (perhaps just into its ascii equivalent), whereas in the header you posted a few days later at...

(Here I realise that your hack is so effective that I can no longer use copy functionality. This is going to be quite a problem! How do I get copy and paste functionality back!)

Phew, I managed to bring this here by dragging and dropping the flavicon for the other forum discussion.

http://moodle.org/file.php/5/moddata/forum/121/17556/header.html

This forum, posted on the 5th of December, contains an ascii (?) encoded javascript header.

The one you posted on the 10th of december on its own tread, you can see the javascript. Is the only difference between the two the fact that the second one is not ascii encoded?

Tim
Timothy Takemoto

PS Any word about a backbutton disable feature?

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Rob Butner -

Timothy-

As you have found---the header that is encrypted really does do alot of protection, it diables printing, disables storing the page in cache, kills the CNTRL+C, CNTRL+P, disables Adobe Acrobat Image to text capture, disables the ability to select text with the mouse, disables the clipboard, and disables right click. The problem with implementing the protection in the header.html, is the protection is site-wide. Therefore, if we want to offer a printable worksheet or handout, we have to create it in Adobe Acrobat, and offer it to students as a "resource-uploaded file".

We havent found a good way to stop a student from entering, looking at, then backing out of a test. We believe the best way to solve this is to offer the test in 1 question at a time format, requiring the student to "save answer & continue" to get the next question. That way the most they could "see" without taking the test is 1 question. One of my guys is trying to use a javascript that would force the test to be submitted automatically on browser unload, but there are many cross-browser compatibility problems.

It has been spoken of many times in this and other forums that looking to "secure" the quiz module is a flawed philosophy. The problem is, not all teachers are Social Contructivists, as much as I would like them to be. And the School has instituted a school-wide adoption of MOODLE as the elearning platform. This brings teachers to MOODLE, but still wanting to utilize their traditional pedagogies. We have found that the less you push on a teacher, the more willing the are to "explore" and "experiment" after they have basically replicated their in-classroom course to the WEB with MOODLE.

 I know that the majority of institutions are not necessarily happy with WEBCT/Blackboard/e-College, but for them to choose MOODLE as a replacement (which I believe it kicks the other around) then small changes like the QUIZZES offered one question at a time MUST be implemented. It's what they're asking for---let's give it to them---

Take Care Timothy--Rob

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Rob Butner -

Timothy-

As you have found---the header that is encrypted really does do alot of protection, it diables printing, disables storing the page in cache, kills the CNTRL+C, CNTRL+P, disables Adobe Acrobat Image to text capture, disables the ability to select text with the mouse, disables the clipboard, and disables right click. The problem with implementing the protection in the header.html, is the protection is site-wide. Therefore, if we want to offer a printable worksheet or handout, we have to create it in Adobe Acrobat, and offer it to students as a "resource-uploaded file".

We havent found a good way to stop a student from entering, looking at, then backing out of a test. We believe the best way to solve this is to offer the test in 1 question at a time format, requiring the student to "save answer & continue" to get the next question. That way the most they could "see" without taking the test is 1 question. One of my guys is trying to use a javascript that would force the test to be submitted automatically on browser unload, but there are many cross-browser compatibility problems.

It has been spoken of many times in this and other forums that looking to "secure" the quiz module is a flawed philosophy. The problem is, not all teachers are Social Contructivists, as much as I would like them to be. And the School has instituted a school-wide adoption of MOODLE as the elearning platform. This brings teachers to MOODLE, but still wanting to utilize their traditional pedagogies. We have found that the less you push on a teacher, the more willing the are to "explore" and "experiment" after they have basically replicated their in-classroom course to the WEB with MOODLE.

 I know that the majority of institutions are not necessarily happy with WEBCT/Blackboard/e-College, but for them to choose MOODLE as a replacement (which I believe it kicks the other around) then small changes like the QUIZZES offered one question at a time MUST be implemented. It's what they're asking for---let's give it to them---

Take Care Timothy--Rob

Average of ratings: Useful (1)
In reply to Rob Butner

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Rob,

I think that it should be possible to include your header in "attempt.php" so that it is not site wide.

Since I am teaching language and students have a strong need to be able to copy words and paste them into dictionaries and the like, I would not be able to cope with a site wide change. I will let you know if/when I get your header into attempt.php.

I don't know how he did it but John Bristor managed to get the quiz appear in a new page without the back buttons. I was unable to get back out of it. If there is no right click or alt key then the vast majority of my students would be foxed.

I have still not managed to find the part of moodle where people click the "attempt test" button, but when I do, it should be a simple matter to have it open in a new window with no back button.

As for "the flawed philosophy"...yes, my philosophy may well be flawed but umm...perhaps we need a philosophy of moodle course? One day.

Thanks again to you and your associates for a wicked (i.e. very useful) hack!

Tim

Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Indjana Dzons -

Timothy, here are my quick hacks for those. Header not site-wide: I've put just one line in all header.html files in the subfolders of theme folder, it says
<?php include("..\common.php") ?> right after <head> tag. And the common.php is only one line long in my case (more if's for more protected pages):
if (stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX")) {
 
include("blockit.html"); }

This easy way I can control what pages have the protection. Would be tedeous to update header.html lines when new version comes though. I think such a common header part functionality would be useful and should be considered as a standard feature so that we could easily make slight modifications to individual headers in one place.

Back button problem: the new window trick works fine for me. I've includeed the modified mod/quiz/view.php which does that. Easy to do but read the comments at the top of it please.

All my tricks are quick and dirty so be careful.
Good luck!
PS. Does anybody have an idea for a moodle hack to prevent students to take pictures of test pages on screen with their cellular phones equipped with digital cameras???

In reply to Indjana Dzons

Re: Quiz Timer Hack

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What most people do is burn out their students eyes with red-hot pokers - this makes it harder for them to aim their camera-phones. black eye wink

Sorry, was that too sarcastic? I'll be good now.  smile
In reply to Indjana Dzons

Re: Quiz Timer Hack

by Timothy Takemoto -
Dear Indjana Dzons,
Thanks a lot for your "not site wide" functionality above. I have it in place and it seems to work very well.

I am a bit scared about using the new view.php mainly since it involves changes outside of my themes folder and I will soon be upgrading moodle again. But perhaps I will in the future. Thanks very much.

I guess that it would prevent people from saving the page since the menu bars do not exist in the new window.

Tim
In reply to Lev Abramov

Quiz timer settings made easy

by Indjana Dzons -

Hi! Here is my solution for different timeouts in all quizes. If the quiz long description says "Good luck! (time: 1:10:0)" or "Take this (time left: 0:30:10)" you can ereg-find out the time to print (at the end of the hacked attempt.php, before "print" statement:

if (ereg ("(time.*: )([0-9]{1,2})sad[0-9]{1,2})sad[0-9]{1,2})", $quiz->intro, $ar)) {
    $quiztime = "$ar[2],$ar[3],$ar[4]";
} else {
    $quiztime = "1,0,0"; //default timeout
};
And below just print countdown_clock($quiztime...
I can't get rid of the emoticons, sad even inside code and pre tags. They should show : followed by ( instead of their faces.
In reply to Indjana Dzons

Re: Quiz timer settings made easy

by Timothy Takemoto -

Dear Injana Dzons
(from Poland I see. I am in Japan)

Thank you so much for this! I will be trying it out soon. I will use the words

(Time allowed: 0:30:00)

Only trouble is that it is going to add more hacked functionality to my Moodle. But with all these hacks the quiz is almost perfect.

Thanks again,
Tim

Timothy Takemoto

In reply to Indjana Dzons

Re: Quiz timer settings made easy

by azman sahari -
Hi Indjana,
I'm new to moodle, 
I've included your code in the attempt.php & change
countdown_clock(0,5,0) to countdown_clock($quiztime)
however, the "Time remaining" popup is witten with
"Time here" instead of default 5 minutes.
I dont understand it, where do i write the different time for say quiz 1 and 2
thanks
In reply to Chris U

Re: Quiz Timer Hack

by Joseph Vargas -

Hi Chris:

Just installed your QuizTimer Module.

Work Great, but even though I set the timer for 1 minute for my test, The time taken field in the report says 1 hour and 10 hours.

Any ideas what is wrong?

Joe Vargas

In reply to Joseph Vargas

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Joe Vargas
Again three weeks late but, for reference - I guess the reason is....
The moodle report records and shows the time from that when you first attempted to take a test. If you clicked into the quiz and then backed out, the timer shown by the report will still be running. When you finally took the test, and only took 1 minute, the report will still show the time from the first click of the attempt button. This is one of the reasons why some have felt that the timer needs to be combined with Rob Butner's javascript anti-back button hack above.
Timothy
Takemoto

In reply to Chris U

Re: Quiz Timer Hack

by Casey Bredeson -
Hi Chris,

I was wondering if you could post your quiz timer module again.  The link in this forum is down, and I would really like to try it. 

Thanks,

Casey

In reply to Casey Bredeson

Re: Quiz Timer Hack

by Timothy Takemoto -

Dear Casey,

Chris U is no longer subscribed to this forum, at least under that member name.
I have tried to find him on the Internet but the pages relating to him at University
of Hawaii are no longer available. It is my guess that he was a lab assistant and
thus possibly a student (rather than faculty as I originally presumed) so he may
have graduated. I am not sure if I will be successful in locating him on line.

I am attaching Chris's Hack to this post under the assumption that he wanted to make
this hack generally and permanently available. I am not sure that it is appropriate
to do so. If anyone thinks that it should not be here I will remove it instantly.

Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Art Lader -
Hi, All,

Building in the option to set a time for a quiz seems like a good idea to me. Some will use it, others won't. Everyone is happy, happy. smile

I do not know if I would use it or not, but I know that I will wait until it's a standard Moodle feature.

God only knows what I'd break if I started hacking around in the heart of Moodle.

Just my two cents.

Best regards,
Art Lader
Aiken High School
http://ahshornets.moodle.com/
In reply to Art Lader

Re: Quiz Timer Hack

by Timothy Takemoto -

I have been using Chris's Timer hack for the past 3 months without incident but I just found out that the time does not display when using Safari on the Mac. I think that it still times-out in the right way though.

I know what you mean about the dangers of hacking into Moodle. But, for me, it had to be done. The biggest problem is that I have not kept enough of a hack-log and I am going to have a lot of problems when I have to rehack the a new edition.

By the way, Chris U is back on the forums and he is happy that his hack still be available here above.

It is a real shame about John Bristor's hack. I can't get over that. It is just what I needed.

Timothy
Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Paul Norrod -

Timothy, I used the original Quiz Timer Hack and found that it would work with IE, but would not show the time for any Mozilla (Netscape) or Firebird users.  A friend I work with looked at it and found something IE-specific in the coding in the mod/quiz/attempt.php file hack code.  I am not sure what he changed, but it now works for me in those browsers.  Of course, that may not what your problem is, but in case it helps , I have attached my modified attempt.php file - what he changed was in the html that acutally shows the time remaining.

Hope this helps!

In reply to Paul Norrod

Re: Quiz Timer Hack

by Timothy Takemoto -

Thanks Paul Norrod,

I just found out that Chris U's hack does not work in Safari on Mac either. Thanks very much for this updated version. Now all I need to do is to add in Mr. Dzon's simplied timing hack too.

Tim
Timothy Takemoto

In reply to Timothy Takemoto

Re: Quiz Timer Hack

by Genner Cerna -

It's good to be back... Kinda busy... Anyway, I've read the treads... Maybe this things could be implemented in new moodle version...

What do you think Tim? is it possible...

In reply to Genner Cerna

Re: Quiz Timer Hack

by Timothy Takemoto -

Hi Genna,

That is not for me to decide. However...As you will see from the Moodle For Language Teaching course, a very php programmer by the name of Gordon Bateson is thinking of doing various things for the quiz module in February, under Martin's supervision. Maybe we will be in luck. I certainly hope so.

Tim