Conditional activities: Lock all but one activity

Conditional activities: Lock all but one activity

by Steve Bilton -
Number of replies: 4
Hello All,

Some time ago I posted a question on the general forums regarding locking of all activities once a particular activity had been started.
My previous posting is located at http://moodle.org/mod/forum/discuss.php?d=58001#263836
unfortunately I have had no response as yet from November 2006

For example I have made a hack module of 'lesson' that I call 'exam'. I have edited the code so no response is given as feedback which gets rid of 'that's the correct answer' 'and you scrored /a' /a denoting the students score for that question. This also involded editing the exam.php language file.

As this hack is supposed to be an Exam we and our accreditors do not want the student to be able to login to the course using a seperate browser window allowing them to go through the content of the course and find the answers in the 'learning materials'.

Is there a way to lock the student out of all other activities except the exam (hack of lesson)???

I really really need a hack for this!
I am using Moodle version 1.6.4 and have uploaded version 2.0 of conditional activities. would this be the best version of AL to use or should I be using another?

Many thanks for any suggestions, at all!
Average of ratings: -
In reply to Steve Bilton

Re: Conditional activities: Lock all but one activity

by Bernard Boucher -
Hi Steve,
sure that you did'nt get response for that post but you got some for the very similar crosspost done the same day if you rememberwink

As posted regulate right did approximately what you want. If you have some programming skill the 3 functions ( 200 lines ) can be included in activities locking to do the job.

Unfortunatly my job descriptions changed and I have no time to work on that.

I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Lock all but one activity

by Steve Bilton -
Hello Bernard,

Ah yes I remember now!! it was soo long ago! Thanks for the reminder, i couldnt find the references to my earlier postings, obviously i did not look deep enough.

I think what i'm after could be done by editing the lib/moodlelib.php file for a smaller custom hack that will effect moodle universally. But i only have one course on the site i need it for (so far) and that would do the job for me.

I have breifly discussed this with Gordon Bateson and he high lighted that editing the following paramters may do the trick in moodlelib.php:

require_variable
optional_variable
required_param
optional_param

and inseting lots of IF (viewing activity) stamentes
THEN (don't show all other activities)

function optional_variable(&$var, $default=0) {
global $CFG;
if (!empty($CFG->disableglobalshack)) {
error( "The optional_variable() function is deprecated ($var, $default)." );
}
if (! isset($var)) {
$var = $default;
}
}

In the above code or something to that effect for example, probably a 3 or 4 liner inserted in the correct places.

I appriciate you don't have the time to work on this, but would you say this is an effective approach?
In reply to Steve Bilton

Re: Conditional activities: Lock all but one activity

by Bernard Boucher -
Hi Steve,
from what I understand from your post it is not perfectly clear for me what you really want.

The simplest case, wich require no hacking, is to hide all the sections or weeks of your course and let only the section with your exam visible: any moodle version can do that without hack. But the course will be hidden to all students at same time.

On the other end of the spectrum, a hack like activity locking permit to refine at the student level that kind of control.

Depending of your needs maybe the visibility control is sufficient.

I hope it may help,

Bernard



In reply to Bernard Boucher

Re: Conditional activities: Lock all but one activity

by Steve Bilton -
Hello Bernard,

Sorry for not being so clear.

I have discussed the changes i want further with Gordon Bateson, and have commissioned him to do the necessary changes i am after.

From the conversations i have had with Gordon he will be tackling the changes i am after by editing the config.php $cfg and will alter the four functions (not parameters) in lib/moodlelib.php to check the config file.

Sorry for being a little vauge, but i will post the modified files on the forums within the next week should anyone else wish to have the same capabilities, and obviously with a more clear description of what exactly has been done.

Thanks for your prompt responses Bernard!

Steve