Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Stuart Mayor -
回帖数:65
The latest incarnation of activity locking...

I have been working on a version to run on the latest 1.6 development version of Moodle. This has been virtually a complete rewrite and as such there are areas of functionality the were available in older versions of AL that are not in this. I believe this version is far more efficient and stable, though.
Things that are in this release:
  • Conditional locking: Lock based on a user's performance in previous activities. You can also choose to unlock and activity if a user scores less than a certain grade.
  • Show activity completion: The checkbox that appears before each activity to show it have been done.
Things that haven't made the release, but are in the pipeline:
  • Automatic Installation: More trouble than it's worth so far.
  • Locking of topics.
  • Time locking: A user has to be enrolled for a certain amount of time before the activity is available.
  • Hiding locked activities.
  • Group locking: Activities only available to certain groups.
  • Decent documentation: There's lots of help files still need writing.
This is very much an interrim release. I'm away for the next week, but I wanted to get this released for some of you nice people to test for me. Development will resume on my return.

Installation
Read this carefully
Firstly, you need the latest, nightly build of Moodle 1.6. This version of AL might work on earlier releases but I didn't write it with them in mind and I certainly can't support them.
Next, you need to modify one table in the database and add a new one (I use phpmyadmin for this). The table you need to modify is mdl_course_modules. You need to add the following fields:
completedbox TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'
completedscore VARCHAR(255) NOT NULL
completedstyle VARCHAR(255) NOT NULL
lockedbox TINYINT(1) UNSIGNED NOT NULL DEFAULT '1'
lockedstyle VARCHAR(255) NOT NULL DEFAULT 'locked'
lockedvisible TINYINT(1) UNSIGNED NOT NULL DEFAULT '1'
delay INT(10) UNSIGNED NOT NULL DEFAULT '0'

The table you need to create is as follows:
CREATE TABLE `mdl_course_locks` (
`id` int(10) unsigned NOT NULL auto_increment,
`courseid` int(10) unsigned NOT NULL default '0',
`locktype` varchar(10) NOT NULL default '',
`targetid` int(10) unsigned NOT NULL default '0',
`locks` longtext NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='Contains locks for sections and modules';

Lastly, you need to copy the following files from the zip file:
lib/moodlelib.php to moodle/lib/moodlelib.php
lib/locklib.php to moodle/lib/locklib.php
course/lib.php to moodle/course/lib.php
course/lock.php to moodle/course/lock.php
course/mod.php to moodle/course/mod.php
course/settings.html to moodle/course/settings.html
pix/t/open.gif to moodle/pix/t/open.gif
pix/t/closed.gif to moodle/pix/t/closed.gif
lang/en/lock.php to moodle/lang/en/lock.php

Useage
Things have changed slightly in this version. Now, in order to switch locks on or off, you need to click on the pencil icon next to the activity name (the one you click on to update an activity). Now, on the update page there is 3 tabs at the top. Click on the Activity Locks tab to set activity locks. The Settings tab allows you to set whether checkboxes are shown for the locks etc.
It's worthwhile mentioning that teachers and administrators (should) never see ticks in the activity complete boxes, regardless of whether they have completed it. You need to log in as a student to see the ticks in boxes.
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Chardelle Busch -
Core developers的头像
Hi Stuart,

Don't be gone too longwink. I haven't had a chance to install 1.6 yet, but will test this as soon as I can.

I wanted to mention something I have been thinking about. As you know, the "viewed" only locking for activities that are not locked by grade/time etc. can be problematic. For a read one-time only resource, for example, it's great. However, for other activities that a user may want to review, or work on for awhile, (hence clicking on them more than once) it doesn't work. Would it be possible to have a "checked by student" option for an activity, giving the student control over when the activity/resource is completed. I'm thinking maybe an icon (with a "Click here when you have finished this activity" tooltip) next to the activity/resource that when a student clicks on it it turns into the "completed check" icon?

Just something to think about. (This is how it is done in the FNMoodle format, student clicks on a link when finished and gets a check--I haven't seen this code, so not sure how its done-I think Michael Churchward developed that code.)

And BTW, DO NOT worry about the documentation.  We all can help you with that.  Anyone wanting to try this code should understand it is developmental, should NOT expect full documentation, and should read all of the discussions regarding it before trying it.
回复Chardelle Busch

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Jens Gammelgaard -
Translators的头像
Yes!!, - Stuart don't hesitate about asking for help with the documentation either. Your contribution is of very high significance to us, so we would be happy to assist you where possible.
回复Chardelle Busch

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

ryan wise -
Yeah, this is what I need. I'm devising a hack in Flash using shared objects for the present. I need the ability to hide a test and yet have it be accessible if a person knows the URL. It'd be nice if this feature were included (clickable when hidden.) I may just remove protections to make it universally available in my own code.
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Julian Ridden -
Have just installed this as per your instructions above and am getting n error when trying tto institute locks.

I edit the resource as per your instructions, but when I click on save I get the error "No Data Sent".

Any ideas?
回复Julian Ridden

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Julian Ridden -
Thought I should point out that I also have tried to add to the course modules table the following. Have I made an error here?

ALTER TABLE `mdl_course_modules`
ADD `completedbox` TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL ,
ADD `completedscore` VARCHAR( 255 ) NOT NULL ,
ADD `completedstyle` VARCHAR( 255 ) NOT NULL ,
ADD `lockedbox` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL ,
ADD `lockedstyle` VARCHAR( 255 ) DEFAULT 'locked' NOT NULL ,
ADD `lockedvisible` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL ,
ADD `delay` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;
回复Julian Ridden

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Timothy Takemoto -

Was there an error in there? Is there a self installing version of AL by Stuart, Julian?

回复Timothy Takemoto

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Julian Ridden -
i had finally gotten this working by completely removing all files and tables and reinstalling.

but saly, as we entered beta, the code has stopped working again. Ill let you know once i have found the problem
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Tony Ruggiero -
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Nicole Snyder -
Yay,

I have tried your stuff out and it works great. The only glitches were that it made the lables look like this:

Wacky Label

And I am unable to use the time lock.

Thank you so much for this awesome activity locking code微笑.
回复Nicole Snyder

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Nathanael Klassen -

I was able to fix the messed up labels on my installation. The problem was with the code in courses\lib.php at lines 1052 and following. Currently the code is structured like this:

if ($mod->modname == "label") {
    ....

if (array_sum($locks)) { //locked
    ....
} else { // Normal activity
    ....
}

I changed it to this:

if ($mod->modname == "label") {
    ....
} else {
    if (array_sum($locks)) { //locked
        ....
    } else { // Normal activity
        ....
    }
}

Basically I just changed line 1060 to "} else {" and added another "}" after line 1077. This prevents the activity locking code from running if $mod is a label.

I also noticed the following string was missing from lang\en\lock.php:

$string['activitycurrentlylocked'] = "This activity is currently locked."

Hope this helps someone. Thanks to Stuart for creating activity locking.

Nathanael

回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Eduardo Hernandez -
Hello,

Today I have just downloaded the latest Moodle 1.6 (Beta3) and tried installing the Activy Locking posted in this forum. I tried installing it by following the original instructions but it didn't work. I had to restore several functions specialy in course/lib.php and lib/moodlelib.php, and I also had to update the code of some functions. So, I think that the best way to install activity locking is compare files and add the missing lines to the existing functions.

After correcting all the broken functions, it seems to work fine so far.

Eduardo
回复Eduardo Hernandez

Ang: Re: Activity Locking v2.1 (for Moodle 1.6)

Jens Gammelgaard -
Translators的头像
Hello Eduardo,

We can help you checking your refinement if you attach your improved activity locking.

Will you attach it?

Thanks,

BR
Jens
回复Jens Gammelgaard

Re: Ang: Re: Activity Locking v2.1 (for Moodle 1.6)

Eduardo Hernandez -

Sure. Here it is.

for all the people who will be trying this, please follow the installation instruction provided by Stuart at the beginning of this thread.

Eduardo

回复Eduardo Hernandez

Re: Ang: Re: Activity Locking v2.1 (for Moodle 1.6)

Julian Ridden -
This is working flawlessly in my latest build of 1.6.

Great work. I have added this to the Playpen for anyone who wants to try it.
回复Jens Gammelgaard

Re: Ang: Re: Activity Locking v2.1 (for Moodle 1.6)

Chandru Hiremath -
Is the AL module compatible with Moodle 1.5.3*?
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

John Gschnaidner -

Hello everybody!

I have been trying this software with the latest Moodle 1.6 Beta and it has been working almost perfect.

The little restriction:
When you edit your requirements for the activity and save them, then a second database entry will be created. It is just a small bug in /course/lock.php. I took the liberty to fix it.

Additional I reworked the layout for the settings a bit - I use a big screen and I had problems to relate the activity and its settings, while they were hanging on the left and right edges of my screen.

Finaly I created some help files and a translation for de_utf8, tested and compressed the data. Sorry as a normal ZIP it has been a little bit to big.

The file is attached to this, so help yourself.

Thank you everybody for making this a great tool. Keep up the good work.
 

  John

回复John Gschnaidner

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Nikki Macfarlane -
John,

I am unable to open your attachment - are you able to post what the changes were that you made to the course/lock.php file and I will adjust manually.

Thanks,

Nikki
回复Nikki Macfarlane

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

John Gschnaidner -

Hello Nikki,

sorry about the download. I try it here again as a ZIP. Hope it will work.

Otherwise here is the code, that I changed in /moodle/course/lock.php:

In the original code it looks like that:

    if (isset($lock->locks)) {
     $lock->locks = serialize($lock->locks);
     if (!$lockid) {
      insert_record('course_locks', $lock);
     } else {
      $lock->id = $lockid;
      update_record('course_locks', $lock);
     }

I changed to this:

    if (isset($lock->locks)) {
     $lock->locks = serialize($lock->locks);
     if (!record_exists('course_locks', 'courseid', $course->id, 'locktype', $locktype, 'targetid', $target->id)) {
      insert_record('course_locks', $lock);
     } else {
      $lockids = (get_record('course_locks', 'courseid', $course->id, 'locktype', $locktype, 'targetid', $target->id));
      $lockid = $lockids->id;
            $lock->id = $lockid;
      update_record('course_locks', $lock);
     }

I could not find the definition of lockid. I figured, that here I need to have two different lines instead of one variable: check for an entry and if there is one update it. It may not be pretty (I am not a software engineer) but it works. In the debugger it looks OK now and the database has no double entry any more (checked with the debug mode). The rest is purely cosmetic: The delay function is not working, or better it is missing in settings.html so I did hide the line; and I did not the design of the pages, so I changed alignment and wording.

The ZIP also includes your code about the label thing. Many thanks for that one! (saves me the trouble)

John

回复John Gschnaidner

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Will Muenchow -
John,
Your zip worked greating and locking is working in my Moodle 1.6 Beta 5 install. I'm getting one problem though. When I click on an assingment, or certificate that is locked, it says

activitycurrentlylocked
#1 Lesson Quiz
#2 Lesson Quiz
#3 Lesson Quiz

Is it suppose to say "activitycurrentlylocked" or something else?

Thanks!

Will
回复Will Muenchow

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

John Gschnaidner -

Hi Will,

when you see a text like this in moodle, it means, that a string (in this case 'activitycurrentlylocked') is missing from the language file.

The line
  $string['activitycurrentlylocked'] = 'This activity is currently locked!';
is missing from moodle\lang\en_utf8\lock.php.
I have added the file, so you just need to copy it to the 'en_utf8' directory.

Or you can try something else. Currently there are several different versions available from the forum:

  • my AL 2.1 for 1.6
  • another 2.1 for 1.6, where you can also hide items, when they are locked
  • AL v3 from Stuart, who is the original designer of Activity Locking
  • there might be some more

AL v3 is a bit different from v1.5 and 2.1, which I am used to. At the moment Stuart is trying to sort things a bit, since we got some people confused with all this Moodle 1.5.x / 1.6 and AL2.1 /3 versions.

But one thing is for sure: AL is an important asset for moodle, if you are trying to design more complex courses.

With best regards
  John

回复John Gschnaidner

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Stella Maris -

Hi Everyone!

I'm very new here and I've been following these posts trying to make heads or tails out of them. I downloaded the ALV2_1_debug.zip file and added the files and folders to my Noodle ver. 1.6.5, but nothing different is happening. I'm sorry if I sound dumb but I'm a newbie to all of this! Where was I supposed to upload the mysql.db to? Please help!

Stella

回复Stella Maris

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Chris Collman -
Hi Stella,
I am a newbie at messing around with MySQL but I am getting braver and braver.   I sometimes  learn by breaking things and fixing them and I am learning so beware!

It is possible that the mysql.db is a script which works with some sort of MySQL editing program.  Open the file with your text editor, like notebook.  The content looks similar to the "read these instructions carefully" initial post in this thread by Stuart.   These are things we might know if we had a bit more education 微笑  

I am getting ready to give it a shot myself but I ran out of time yesterday. Here is my plan for one of my localhost Moodle 1.6s, which I used to break and erase on a regular basis but not for a couple of months now.  This localhost runs from a folder called C:\Moodle16 and under this are folders like C:\Moodle16\MySQL and C:\Moodle16\Moodle, with things like C:\moodle16\moodle\mod in it.   Hope you get the idea.  Once or twice a week I download from moodle.org and replace the c:\moodle16\moodle folder with the zip file.   Once I install activity locking, the unzip process will cause me some new headaches.   With that preamble out of the way:

1)Sometime in the last 4 months I might have downloaded phpMyAdmin 2.6.2 and attached it to Moodle 1.6.  See step 4 when this program seems to have popped up.  2) I went and did a zip of the ..mysql folder, hey if I break it maybe this backup will restore it. 3) I went to Moodle 1.6 as admin.  4) went to the Administration block and clicked on Database at the bottom. 5) Here is where I ran into my current brick wall.  I tried to get mysql.db to run as a script (one of the options).  I tried pasting in all and then various parts of the mysql.db files from my notebook, another option.   My next move is to use the phpMyAdmin interface and by hand to add the fields to mdl_course_modules and then to create mdl_course_locks with the right fields. 6) I am then going to pray to the great Moodle deity that I typed everything correctly and have actually altered the MySQL database.   7) Then I am going to paste those php files that I unzipped someplace safe, into the right folders, one at a time. 8) a final prayer, I will exit Moodle, go back in as admin and then go to Administration and configuration by which time I expect Moodle to think something is different and reconfigure itself for Activity_Lock.  Bob's your Uncle.

Let me know if that works! (evil grin).   Chris

回复John Gschnaidner

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Stella Maris -

Hi All,

Forget about my last post. I do have the activity locking tabs on my course pages, but it's not working. I choose which activities that have to be accessed and/or the quiz score that students have to get, but when I test the locking I'm able to access what should be locked. I uploaded the mysql.sql right into the main noodle directory. Is this where it should be?

Stella

回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Mon B -

Hi everyone,

I've tried very hard to do this on my own, reading tons of threads and documentation, but after 5 hours I'm no better off. I'm VERY much newbie and I realise these forums are dominated by experts, programmers and their ilk, and us newbies hate butting in, but please, a little help for the lost ones.

I worked out how to create all the fields and the table to the best of my knowledge. I uploaded and unpacked Eduardo's zip file, as well as uploaded the modified lock.php. The only thing I didn't do was:
TYPE=MyISAM COMMENT='Contains locks for sections and modules';
as I don't understand where that goes.

So my questions are:

Nothing is showing up anywhere - no tabs in my activites and the module isn't listed in the Admin > Modules area.

Is simply uploading a module into the mod directory an installation of that module?

Are the 'course', 'lib', 'lang', 'pix' folders supposed to be inside another folder in the mod directory?

thanks in advance 微笑

回复Mon B

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Mon B -

It's NOT a module!!! good grief! One little word in another thread and it dawned on me. blush

OK, I have it all set up.

When I choose the 'User must access', and click save activity locks, I am transported to this page: /moodle/course/lock.php

but it's totally blank. When i return to check the lock, it hasn't taken. (I'm assuming after applying a lock that the next time you see that page the 'user must access' is already checked?)

微笑

回复Mon B

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

N Hansen -
For those having troubles with this, it would help us to be able to troubleshoot it for you if you provide the following three pieces of information:

1-What version of Moodle are you using? (note 1.6.5 is not a version of Moodle that exists)
2-What version of activity locking are you trying?
3-Did you simply copy the activity locking files over the existing files in your installation?

I ask about 3 because if you use a version of 2 that is not the same as your 1, you could have problems. If your activity locking version that has not been designed for the version of Moodle you are using, it may not work and may cause other problems in your Moodle. If you wish to mix versions, you will need to manually compare the files and remove from 2 the relevant lines and paste them in your files from 1. If you aren't used to editing files, this probably isn't something you want to attempt yourself and so it is better to find a version of activity locking designed for your version.

Finally, note that you must copy each file in the activity locking package to the corresponding folder in your Moodle installation. It will not work if you simply drop the package into the Mod folder. And don't forget to visit your admin page or activity locking won't get installed.

I'm going to upgrade to 1.6 today using Bernard Boucher's version for 1.6. I'll let you know how it goes.
回复N Hansen

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Mon B -

Hi  N Hansen 微笑

moodle 1.6
AL 2.1 Eduardo's fix
and john Gschnaidner's code change.
I uploaded each file with most copying over existing files.
I created and modified tables manually - checked them over three times yesterday and again this morning.

I get the tab and the AL page to choose what to lock. After saving, I now get the 'no data sent' page.

Incidently, nothing happened when I went to mysite/moodle/admin.

I am also still unsure about two things:

with the field `locktype` is under default, the symbol " ?

no idea where to put: TYPE=MyISAM COMMENT='Contains locks for sections and modules';

回复Mon B

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

N Hansen -
I would double check that John's files aren't older than the files in the standard installation. I don't understand your question about locktype.

What are you using to edit the tables?
回复N Hansen

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Mon B -

Hi,

I've tried it with and without John's files.

'locktype' is one of the fields we are to create in the new table - mdl_course_locks.

In the first post with the installation instructions it says to create that field and - default '',
I'm uncertain if I'm to input the symbol  - "  all the others seem to be numbers.

I'm using phpmyadmin.

thanks 微笑

回复N Hansen

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Bernard Boucher -
Hi all,
         first I am very sorry about all the confusion  around  activity locking versions.

One page on moodle ( thanks Alvin and Chris ) and its page comment documentation wiki are on the way to :

1 - Identify some of the existing versions
2 - qualify Moodle version required
3 - precise the installation method ( "automatic" or via phpmyadmin )
4 - refer to the installation readme file or the post representing it
5 - enumerate some of the most importants features supported
6 - list know bugs
7 - ...

Please be patient! A table or a matrix of feature/requirement  will be produced and will be maintainable by all ( that is why we choose the wiki instead of the forum for that )

Don't forget to always test any of these versions on a fresh new appropriate moodle install and not on a production server

Downgrade or revert process is not available. You must make a ZIP  backup of your entire moodle ( php code, moodledata and mysql database )  before installing
.

I hope it may help,

Bernard

回复Bernard Boucher

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Mon B -

Hi Bernard,

I have heard this from a few users around the forums, and it is my personal experience as well. Those that are more experienced around here might feel differently of course. But, one big problem that causes confusion is that versions are attached to posts, which is handy for users that are part of the conversation at the time. But for the rest of us who come later, we find ourselves going around in circles.

The wiki page explaining the versions is great. It would be brilliant if versions were actually attached there as well, or the link provided to the file. What most/all wiki articles do is point you to the forum discussion, and back on the merry-go-round we go. lol

I had read that page earlier and felt confident about which version I wanted, but was then left to try to pull together pieces of files and modified code from many posts and threads.

It sounds like the plan is for something really comprehensive, if it includes the exact location of the necessary files, you have my vote!

Such a page might be redundant for developers, but for newbies and the less technically inclined it's the difference between a moodle experience that is good to one that is great.

Just an observation. 微笑

thanks Bernard for your hard work.

回复Bernard Boucher

Re: See Newbies, help is on the way: Activity Locking v2.1 (for Moodle 1.6)

Chris Collman -
Bernard,
There is absolutely no doubt in my mind that progress is being made.   And I really like the  idea of MoodleDocs, which I think will bring things together so some flavor of AL will be part of 1.7.x standard ( along with certificate). 

Thanks for the tip about a "total" zip backup.   Blush, after I did the MySQL backup, I did a full backup..just in case.

People who feel new, well they feel new and out of place.  I think Moodle is  fairly straight forward for a  teacher or student.   Yes, it is possible to do cartwheels but as you said, "not on a production server".  KISS.  

Nice summary.

Chris

回复N Hansen

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Stella Maris -

Hi All,

I'm using 1.6 beta 5 version of noodle and I'm trying John's AL version 2.1 for 1.6. I used phpmyadmin and added the lines to mdl_course_modules and I created the mdl_course_locks table. Then I uploaded all the files to their corresponding folders. I get the activity locks tab and the settings tab now and I'm able to specify what requirements need to be met. I get the little box and it says 'locked'. But when I log on as a student I can access all the lessons, even though I shouldn't be able to. Does anyone have any idea what I could have missed. Oh, yes, also when I accessed my administration area, nothing new happend there.

Stella

回复Stella Maris

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

N Hansen -
You have to really log in as the student, not just using "loginas" a particular student to get it to work.
回复N Hansen

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Stella Maris -

I did log in as a student. And even though I can see the empty check box and the activity says locked I can still access it. Also, when I visisted my administration page, nothing new happened.

 

回复Stella Maris

Re: AL lock is temp on in a localhost 1.6

Chris Collman -
I've got something similar to Stella's issue going on.

The short of it is when a student clicks on a prereq activity and backs out, all the locks disappear, as it the student can print up a certificte without taking the quiz.

My details: Running localhost 1.6.  Installed ActivityLockingWithHide from Chardelle's web site (thank you very much) yesterday. Installed Certificate Module from download on 6/27/2006.  Created a short course.  1 tiny glossary, in consecutive topics I placed Lessons A,B and C, 1 tiny quiz and a certificate.   Just for fun I went into Lesson B and put a prereq for Lesson A (score 1) told it not to show boxes and hide if locked.  Went to Certificate made it dependant upon  quiz with a score of >= 1.   Created a new students "X1" and X2.

As X1,  the first time course was opened, Lesson B  and Certificate1 were not showing up in their topic slots.   I clicked on Quiz, backed out via breadcrums.  There was Lesson B and Certificate 1 in their topic slots.  I clicked on Certificate1 and my adobe writer turned on and out came an unimproved certificate.

As x2, the first time the course was opened, I tried clicking on where LessonB and Certificate blank spots.  I went into Quiz again and this time used the jump window in the intro screen to go to Certificate.  Was able to print. 

Anything I can do to help? 
回复Chris Collman

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -
Hi all,
         I just tested Chardelle and John versions: they are very similar and they share a small bug in the logic: as soon as a student have accessed an activity locked ( respecting the lock(s) )  if you change the locks conditions ( with the same activities ) the students will allways have access to the locked activity because only the presence of a record in the Moodle log file is sufficient to unlock the activity.

To be more clear ( I am sure it is possible but not necessary in that paragraph ) if a resource is dependent of a quiz qrade, after an attempt of the quiz, even if the teacher delete the quiz attempt, the student will be granted access to the resource because a trace of the access to the quiz is present in the log file.

You will find the slighty modified locklib.php attached that try to correct that bug.  Modified lines are commented with //bb

Test it carefully: maybe I created others bugs.

I hope it may help,

Bernard

p.s. I will be out and mute for the next 10 days
回复Bernard Boucher

Re: AL lock is temp on in a localhost 1.6

Chardelle Busch -
Core developers的头像
Just to clarify--my version is John's version which is one of Stuart's versions--just updated.

Ok. I'll try the new locklib.php Bernard.  And yes, that is exactly the problem.  So, does the version you posted NOT use the logs??? (I haven't had time to look at it yet).

And, by the way, thanks for keeping up on this.  Everyone should know that it was Bernard who started all this with a hack to lock the certificate based on a quiz score waaaay back when (probably over two years ago).  It was great!


回复Chardelle Busch

Re: AL lock is temp on in a localhost 1.6

John Gschnaidner -

Thank you Bernard,

I will check it out. If it works out and I find the time, I will update my version and also my chapter in the moodle docs.

Regards
  John

回复John Gschnaidner

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -
Hi John,
             if the new locklib works fine and if there are some  needs,  I think it will not be too difficult  to integrate the sectionlock  option in your ( Chardelle and You ) version of AL.

Thanks for testing and debugging,

Bernard

回复Chardelle Busch

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -
Hi Chardelle,
                   first thanks for your kind words.

    I just updated AL V 2.0 for 1.6 that I posted before with some bugs fixed: hide and section lock works now. I updated also Moodle docs and I put that version of AL in Modules and Plugins Database.

I hope it may help,

Bernard





回复Bernard Boucher

Re: AL lock is temp on in a localhost 1.6

Simon Williams -
Bernard,

thanks 4 all your efforts.

Unfortunately the link to download does not work.

http://206.167.134.155/bb/authoring1/activityLocking2_0_for_1_6_july1006.zip

-Simon
回复Simon Williams

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -
Hi Simon,
              I just re-check it and it works for me. Maybe you tried it when some part of my organisation network was down.

Better luck next time wink,

Bernard
回复Bernard Boucher

Re: AL lock is temp on in a localhost 1.6

Simon Williams -
Bernard

Link still doesnt seem to work - maybe not availble to the outside world?

This other version link works
http://proemployees.com/ActivityLockingWithHide-1.6.zip

But the link from modules and plugin page http://moodle.org/mod/data/view.php?d=13&rid=391
to the latest version below times out (I am on a fast uni network)
http://206.167.134.155/bb/authoring1/activityLocking2_0_for_1_6_july1006.zip

I am a little confused as to which is the 'latest' version with most bug fixes - I am assuming it is the link(not working) from the modules and plugin page.

-Simon
回复Simon Williams

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -
Hi Simon,
               sorry for the link but it works from outside world ( I created it at home ) . At work ( College ) it is vacation and maybe you are "synchronised" with  network maintenance down time thoughtful

For the version confusion, please don't use the links from the forums but those from the table in MoodleDocs  or module and plugins database. These two later are editable and can be corrected if problems exist.

The first link you refer ( http://proemployees.com/ActivityLockingWithHide-1.6.zip
 )  is version V 2.2  of Chardelle and John with tabbed interface.

The last one is  just and adaptation from Stuart old V 2.0 ( October 2005 )  with padlock interface to works with Moodle 1.6 that I try to maintain.


I hope it may help,

Bernard


回复Bernard Boucher

Re: AL lock is temp on in a localhost 1.6

A. H. -
Hi Bernard,
(moodle version 1.6.4)
I am afraid that when i click on activity locks and then save activity locks, it gives me a page saying: No data sent. i click continue and i am kicked out of the course.

I followed the installation instructions for 2.1 and the general installation instructions.

Finally, is this tool, as i understand, like the selective release in webct?
Selective release: allows u to release the tool for certain students or all, at a selected time.

regards,
amer
回复A. H.

Re: AL lock is temp on in a localhost 1.6

Bernard Boucher -

Hi Amer,
from that table, I don't think that activity locking exist for moodle 1.6.4.


Activities locking is only a hack, that mean that it is not upgraded with all other moodles files. For example the file moodlelib.php is modified for activities locking. That link show you how much moodlelib.php was modified since activities locking 2.0 9 months ago. That may explain the problems you experience with a mismatch between moodle and activities locking.

If you strickly conform to the matching versions included in that table, ( from a fresh install only, not an upgrade nor after a removal ) activities locking works fine. If you find errors in that table you can correct them in the table to make it better.

I don't know Webct, but activity locking make selective release based only on grade or on access not on time basis.

I hope it may help,

Bernard

回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Rick Barnes -
I am in the process of setting up a new local moodle to test all of the features I want on a new site in November. I have followed your instructions but stilll get the error
Fatal error: Call to undefined function: isunlocked() in C:\Program Files\xampp\htdocs\moodle\course\lib.php on line 829

which shows on the home page of the moodle, what have I done wrong ans what do I do to fix it.

This is the most complicated editing i have managed so far, having never used php or mysql before
Thanks in advance

Rick.
回复Rick Barnes

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Bernard Boucher -
Hi Rick,
           sorry I missed your post!

    I just downloaded lastest Windows package with Moodle 1.6.1+ and activityLocking2_0_for_1_6_july1006 from that table.  Locks works fine first time.


  Can you precise the activities locking version and moodle version you are trying to fit together? Maybe it will be easier to reinstall the above versions.

I hope it may help,

Bernard

回复Bernard Boucher

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Tony Ruggiero -
Can anyone help?

I had Activity Locking working on a 1.5.3 install.

I upgraded to 1.6.1 (2006050510) and I am using the version of AL for 1.6.

Here's the problem, I realize that all the old locks won't work and I will have to restore all the old locks, but I have students that have completed some of the previous activities and when I put the new locks in - they are locked out fomr the activities they did complete.

Now that I got you all totally confused. Is there a way for me to manually put in the database the users that completed certain tasks?

Thanks,
Tony
回复Tony Ruggiero

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Bernard Boucher -
Hi Tony,
            sorry for the confusion.

First activities locking is not upgradable nor backupable: that mean that if you upgrade a site who already has activities locking installed then the new will probably not work automatically even if you reinstall the new version of activities lockingsad  Som manual adjustment are required to fit the old AL version with the new one!

 That is why it is strongly recommanded to test it on a test server before trying it on a production server.

For your particular problem:
it is nearly normal that locks have dissapear because the differents AL versions and the maybe you did a restore.

for the students who have completed some activities new locks should not change  accessibility:  non locked  activities should be accessible  as they were before the installation of activities locking.
 


Can you precise from that table wich version of activities locking you have really installed and what version was installed ?

If you are playing with a copy of your original site then I suggest to flush all and to reinstall Moodle 1.6.1  and AL 2.0 from the table.

If you are working on your production server I suggest you answers my preceding questions and to give me some access to make some tests.

I hope it may help,

Bernard


回复Bernard Boucher

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Tony Ruggiero -
Bernard:

Well the client has decided to redo the whole course, thus all the locks will have to be redone anyway.

Thanks,
Tony
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Hamid Takesh -

Hello.

I have installed the activityLocking2_0_for_1_6_july1006 on my moodle 1.6 test application.

It works fine, locking/unlocking and showing no errors.

But whenever I try to add new activities/resources to the course the application gives me an error: "Could not add a new course module". (It comes at "./course/mod.php")

And I can not even get rid of this error AFTER I uninstall the Activity Locking. I have to drop the DB and instell moodle again to get it to work...

Why does the Activity Locking create this problem for me? Looks like noone is experiencing this problem... I've searched for the solution for 2 days. Tried different versions of AL on different versions of moodle. Nothing worked fine so far.

Please help.

回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Savanah Fahrney-Day -
I have basically NO experience with creating/editing databases. Could someone please help me out? My SQL version is 4.0.25-standard. I have Moodle 1.6.3. I am not even sure what version of Activity Locking I should use. Please help.
回复Savanah Fahrney-Day

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Bernard Boucher -

Hi Savanah,

activities locking is only a hack, that mean that it is not upgraded with all other moodle files.

If you strickly conform to the matching versions included in that table, ( from a fresh install only, not an upgrade nor after a removal ) activities locking works as indicated in the table.

The column MySql install may interest you because one of the version create the table automatically. On the other side it was done about 6 months ago, meaning that you will loose some functionnalities of moodle or worse get errors if you install it with a version of moodle different of 1.6.

You may give it a try on a test server with 1.6.3 or better with 1.6 and let me know what happens.

I hope it may help,

Bernard

回复Bernard Boucher

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Steve Bilton -
Hello All,

I use Moodle 1.6.4, I want to lock all activies once the final (test/exam) activity has been started. I cannot find any info on how this can be done or if its possible.

I have posted more details here: http://moodle.org/mod/forum/discuss.php?d=64512

If there is anyone out there that can produce a re-hack of any version of AL that works with Moodle 1.6.4 to provide what i'm after?!? I would be willing to to put a small cash figure on a re-hack of AL to provide the functionality that i'm after.

Thanks All

Steve
回复Steve Bilton

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

删除的用户 -

Steve Bilton wrote "If there is anyone out there that can produce a re-hack of any version of AL that works with Moodle 1.6.4 to provide what i'm after?!? "

I am working a hack for 1.6.4, specifically for the Quiz Module (I call it Quiz Lock). I will be posting it in this forum probably in another week or so, after I've done a little more testing.

You can take a look at it after I post it, and see if it will do what you want it to do.

回复删除的用户

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

Steve Bilton -
Hello Jeff,

That's great news! however i have already had someone do a custom hack for me for the examination i talked about.

It's very different from the activity locking module and totally custom.

I would still be very interested in the modifications that you will make

Thank
Steve
回复Stuart Mayor

Re: Conditional activities: Activity Locking v2.1 (for Moodle 1.6)

R McPhee -

For the life of me I can not get this to work...

It displays as if all is OK, and I set things so that they can not get into the next part of the course without completing the assignments, however they can read ahead...

I am really getting frustrated with this...

I have even go as far as un installing and reinstalling, and still not working out for me...

Any one able to help me here???