Conditional activities: Latest Activity Locking Release

Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Number of replies: 91
Here's the latest incarnation of Activity Locking.

It has undergone some major changes. So many, in fact, you might even call this "version 2" or even give it a new name like "Activity Locking and Tracking" tongueout

As always, this is a pre-release test version. I haven't even tested it rigorously myself.

The biggest change is in the way those tick boxes that appear before or after activities are managed. You now set them on a per-activity basis instead of per-course. OK, it will take a little longer to set up your course, but it is far more flexible. The best way to see is install it and have a play.
Be aware, though, that you will lose your current "activity tracking" setting (the one that you set on the course settings page - None, Before each activity, After each activity). This now has to be set for each activity (assuming you don't want the default).

Unfortunately, I can't upload this to CVS. Firewall problems. I'd appreciate it if someone could do that for me.
Average of ratings: -
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by James Robertson -

I'm not familiar with .rar format -- I just checked their website.  Sounds good, but does anything besides the proprietary rar archiver read a .rar file?

You might want to give it a different name just so that the download under activity_locking remains the old version for now.

Can you set defaults for the course and then override them on a per-activity basis?

Thanks,

Jim.

In reply to James Robertson

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
I used rar as it's a slightly more efficient zipped format. Unfortunately, this zip fie was too big to upload to the forum. I believe rar is supported by more than just their own proprietory software, yes.

At this stage, no, you can't set defaults for the course. It will be the next thing to be added.
At the moment, the default is:
Visible when hidden
Do NOT show tracking checkboxes
Do show prerequisites checkboxes
Hidden style is "hidden"
Completed style is blank.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators
Hi Stuart,

Great to see the progres, I get though an error message on the frontpage where:

Fatal error: Call to undefined function: islocked() in C:\minixampp\htdocs\moodle\course\lib.php on line 988

I solved this by adding this line on line 987 in the file in the error message:

require_once($CFG->libdir.'/locklib.php');

Now the error message is gone.

BR
Jens

Average of ratings: Useful (1)
In reply to Jens Gammelgaard

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators
And the fix of Friday, 30 September 2005, 01:01 PM - should still be applied according to my latest test.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators
Hi Stuart,

In your new release I see a fine unlock symbol, but when I click it, I don't get anything unlocked.

What do I miss?

Kind Regards
Jens
In reply to Jens Gammelgaard

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
So everything else works for you Jens? It's just the unlock button that doesn't work?

Can you check in your lock.php file that you have a line, around line 63, that says
    if ($_GET['action'] == "unlock") {
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators
Everything else seems to work. I even have the line 63 that says
    if ($_GET['action'] == "unlock") {
In reply to Jens Gammelgaard

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
So what dows happen when you press the unlock button? Does it even try to load another page?
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jonny McCullagh -
I have just installed this feature for the first time using the Rar above. I can't wait to get it working, however when I try to lock activities regardless of the options I choose the activity always shows up as (locked and hidden) and also do not appear even after I have completed the requisites.
If I am doing something wrong I'd appreciate it if anyone has the time to point me in the right direction.
thanks,
jonny
In reply to Jonny McCullagh

Re: Conditional activities: Latest Activity Locking Release

by Alvin Shaffer -

Same here . All locked activities are completly hidden?

php 4.4 , mysql 4.0 , windows 2000 , Moodle 1.5+

In reply to Alvin Shaffer

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
After you have copied all the files over, have you visited the admin page to update the database?
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jonny McCullagh -
yes I followed the normal install process and it seems as though it is installed fine but just a few problems when I try to lock an activity it locks and hides it even if the prerequisites are met and does not show the activity completion even if chosen.
Any help as ever is appreciated,
thanks, jonny
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
There's a slight bug in the code, which makes it impossible to edit labels. This new file fixes that.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators

Hi Stuart!

Even after using your patch, I get the same Fatalerror:

<>

Fatal error

/>

From line 1825 -> 1832 in moodle\course\lib.php I remove the error by inserting the red line:

>: Call to undefined function: islocked() in C:\minixampp\htdocs\moodle\course\lib.php on line 1826

It is an error that you get, if you have a subject in the middle of the frontpage.    }
 require_once($CFG->libdir.'/locklib.php');
    if (islocked($mod)) {
     $unlock = '<a title="'.$str->unlock.'" href="'.$path.'/lock.php?id='.$mod->id.
         '&amp;sesskey='.$sesskey.$section.'&action=unlock"><img'.
               ' src="'.$CFG->pixpath.'/t/unlock.gif" hspace="2" height="11" width="11" border="0" '.
               ' alt="'.$str->unlock.'" /></a>';
    }

But the unlock feature is still not active.

Stuart, will you please insert the patch line in red?

- Jens

In reply to Jens Gammelgaard

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Yep, I'll put that code in the next release. I hadn't tested it with the front page setting you have.

Is there any chance you can have a look in your database and check you have extra fields added in the course_modules table. There should be visiblewhenlocked, checkboxforcomplete, checkboxesforprereqs, stylewhencomplete, stylewhenlocked.
Or something like that.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jonny McCullagh -
That's obviously the problem - something has gone wrong for me during the install. I have mdl_course_modules with 11 fields but no sign of:
visiblewhenlocked, checkboxforcomplete, checkboxesforprereqs, stylewhencomplete, stylewhenlocked

I checked the SQL file in the Rar download you provided but it does not include statements to create the fields you refer to. It only mentions the field 'delay' VARCHAR(10)
Should the SQL file have more statements in it? could you provide the SQL so I can run it manually?
Thanks for your help, jonny
In reply to Jonny McCullagh

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
It was an error in my code. It would work fine if you were upgrading from a previous release of activity locking, but not if you were starting afresh.

The fields you need to add are...
ALTER TABLE `prefix_course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`;
ALTER TABLE `prefix_course_modules` ADD `stylewhenlocked` VARCHAR( 200 ) NULL default 'locked' AFTER `visible`;
ALTER TABLE `prefix_course_modules` ADD `checkboxforcomplete` TINYINT( 1 ) UNSIGNED NOT NULL default '0' AFTER `visible`;
ALTER TABLE `prefix_course_modules` ADD `stylewhencomplete` VARCHAR( 200 ) NULL default '' AFTER `visible`;
ALTER TABLE `prefix_course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`;
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jonny McCullagh -
That SQL has done the trick - Many Thanks, jonny
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators
Hi Stuart,

I have these fields:

checkboxesforprereqs stylewhencomplete checkboxforcomplete stylewhenlocked visiblewhenlocked

But does not make the features like unlock working.

BR
Jens
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Patrick Jeitler -

I have tested this latest release of activitiy locks and have encounterd the the aforementioned problems and one that I have not seen in any forum:

 

When I installed activity locking, it did not create the new fields in the table course_modules. I tried installing an older version of activity locking followed by this latest release and then I found the new fields in SQL.

But more importantly, there seems to be a problem when the activity locking module and the certificate module are both installed. When I log in as admin and I go to :

Course Fullname 101
log.gifNews forum Jump to...
 

 

quiz1


The quiz is available until: Tuesday, 11 October 2005, 01:00 AM


>

 

If now I click on View 2 quiz attempts (1 Students), I get a page not found error because this link redirects the page to http://aus121stemp/moodle2/mod/quiz/attempts.php?id=2

If I use moodle without activity locking, then it woud redirect me to http://aus121stemp/moodle2/mod/quiz/review.php?id=2

The second problem is the time taken:

 
 
switch_minus.gif
First name / Surname
switch_minus.gif
Started on
switch_minus.gif
Time taken
switch_minus.gif
Grade/10
switch_minus.gif
f2.pngPatrick Jeitler3 October 2005, 11:49 AMnow10
  3 October 2005, 11:50 AMnow0
Select all / Deselect all    0) submitFormById('attemptsform'); }" name="action"> With selected Delete

Display options:

Attempts shown per page:
Show students with no attempts
Show mark details
Click to download the exported category file

You are logged in as Admin User (Logout)
In reply to Patrick Jeitler

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
How odd.

I've just tried to recreate your problem on my system. When I went to the page you described above and clicked on the
View 2 quiz attempts (1 Students)
link, I get sent to the page
........mod/quiz/report.php?mode=overview&id=27

I wonder if we are using different versions of the quiz module. In any case, it would seem that the problem is part of the quiz module, as opposed to activity locking.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
I've fixed a couple of errors in the above release.
I still can't upload it to CVS...
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by David Gagnon -
I have things installed and almost working.

The first issue was that certian resources were set to 'locked and hidden' and  I could not change any of the settings for locking. The locking screen would come up, but the setting wouldn't save. It aslo would not unlock by clicking the little open lock icon. I fixed them (there were only a few) by deleting and recreating the resource, then it worked.

The current issue is that when a resource is "locked and hidden" it never will unhide. If I set it so the locked item is visable when locked, it works fine. It is locked until a condition is met, then it is unlocked. If I ever say it should be hidden when locked, it dissapears and doesn't come back.

Any ideas?

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Patrick Jeitler -
Thank you Stuart. I have tried your latest release and now erverything is working the way it is supposed to.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by David Gagnon -
I just tried a "from-scratch" install using the newest version with moodle 1.5.2. The new sql installer works wonderfully, setting up not only the mdl_course_module_locks, but also adding on the additional fields to mdl_course_modules table.

Eveything looks good until I try the  "Visible when locked" option as "No". From there on, the item will never display, even if the locking conditions are met. If I change "Visible when locked" to "Yes" it works fine.

Before I give up tonight I am going to dig into the PHP and see if I can figure out where the choice is made to display a locked item or not.

Thanks again for some great work! I'm sure we will get this worked out soon.
In reply to David Gagnon

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Look in the file course/lib.php. There is a function called "print_section". What you are looking for should be in there. There is every chance I have made a mistake in the code. I made a couple of changes to fix a problem with labels and I may have inadvertantly broken that.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Alvin Shaffer -

Stuart,

I am having trouble figuring out how to lock a resource so that the student must score a particular grade on a quiz before moving on.

I have the latest moodle and Conditional Locking Code. When I lock an activity it only gives me an option to lock on the quiz based on access but I thought you could set a grade

In reply to Alvin Shaffer

Re: Conditional activities: Latest Activity Locking Release

by Alvin Shaffer -
Never mind -  I had a brain fart
In reply to David Gagnon

Re: Conditional activities: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators

Hi Stuart,

I have just tried the same as David, and it locks and unlocks if I press the open lock ikon, but it does not unlock for the user that enter the conditional activity, that should unlock the locked activity.

I remember that is has worked for someone, maybe a more simple version than the one from 4 Oct.

Anyone has a working version, that they could share here?

BR
Jens

In reply to Jens Gammelgaard

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
Hi Stuart,

I've finally been able to test your latest code.  Here are my observations.

1.  As above, I also found that when the activity is hidden it never becomes visible, thus locked and hidden doesn't work.
2.  Having both the activity complete and prerequesite complete is cool, however, what if you want to show the activity completion after the activity rather than in front--that is no longer an option?  This became obvious now that we can do this on a per activity basis--the problem is that those that do not show tracking (completion) are not in line with the other activities because of the icon. Maybe have a spacer gif in front of the activities?
3.  I feel rather dense, what are these?:
Style to use when the activity is complete:
Style to use when the activity is locked:

In reply to Chardelle Busch

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Hi Chardelle

1. I've probably made some silly mistake in the code.

2. It was never an option to show activity completion after an activity. The two options were
  • Show activity completion before each activity
  • Show prerequisites after a locked activity
These haven't changed, except you can now select the option for each activity.
I take your point about them going out of line if you choose to show the box on some but not on others. Like you say, I think the best option is to print a spacer image.

3. These give more flexibility over how locked/complete activities are displayed. Up until now, a locked activity used the "dimmed" css class. This option now allows you to use a different css class for locked or completed activities. This allows you to display locked items differently to other screen elements using the "dimmed" css class.

The attached file should fix points 1 & 2.

I'm considering doing a full re-write of activity locking. The code is starting to get a bit ugly. I suppose it's all down to time.
In reply to Stuart Mayor

Ang: Re: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators

Hi Stuart,

Well, you can count on me in respect of testing your new following releases.

And I am sure you can count on the others too.

We are very happy that you take your time to this project.

Kind Regards

Jens

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
FANTASTIC Stuart,

The locked and hidden now works and the spacer is in place!!!

It never occured to me that the styles were actually css styles blush.

Love it--great workkiss
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -
Hi Stuart,

I installed the above rar file on a Moodle 1.5.2+, version 2005060223 running on a LAMP server.  PHP debugging is set to high. I just want to share the result.  Are those notices in the attached screenshot normal?

And is it possible to ask for patches instead of fully patched files for files that are to be overwritten?  It seems that there are differences in this versions file like moodlelib.php from the one you hacked.

I'm new to this feature but I think it would be great to use.

Roel
Attachment editon.png
In reply to Roel Cantada

Re: Conditional activities: Latest Activity Locking Release

by Nicholas Stevens -

Hi Roel:

I'm getting the exact same 2 errors you are: undefined variables activitycomplete and unlock in the  ../course/lib.php file.  I don't understand enough about PHP and the Moodle architecture yet to figure it out. 

For example, during my activity_locking installation, I got a new ../moodle/course/lib.php file, but I did not get new lib.php files for the mod subdirectories (e.g., ../moodle/mod/assignment/lib.php).   These lib.php files in the mod subdirectories don't refer to activitylocking or unlock variables.  Is this right?  I don't know. 

Anyway,  if I find a solution I'll let you know; you do the same.  Thanks.

In reply to Nicholas Stevens

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
That is correct. Activity locking uses a replacement course/lib.php but does not need to change anything in the mod folder.

Just fyi, files in the mod folders link in to activity locking using a modified "require_login" function.
In reply to Roel Cantada

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Yes. Those notices are normal. They are a result of my sloppy programming.

The next release I'm working on will be much neater, with hopefully no notices. So far, features have been added mainly with quick-and-dirty methods, resulting in those nasty errors.

They will, of course, disappear if you turn debugging off.

If you could recommend how I create/modify/install patch files within a windows installation I would be more then happy to create some. As you say, it would be a much neater way of distribution.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Nicholas Stevens -

Thanks Stuart.   I didn't realize I could safely ignore these 2 error messages. (undefined variables activitycomplete and unlock).  Once I do that, I see that AL does in fact work on my install.  I've turned debug off and moved on.

As for your comment If you could recommend how I create/modify/install patch files within a windows installation, I don't think I have a windows installation.  My moodle host runs linux. My PC runs Windows XP.  I had to unzip the AL files (from the .rar)  on my PC b/c I don't know how to unpack a .rar file using linux commands. 

Anyway, the only suggestion I can make about the AL install process is to include a README in the .rar that talks about the common errors, like the two I've made (so far):

  • It is OK to ignore the 2 undefined variable messages.
  • Create the new activity_locking directory only below your existing blocks directory, not above it as well, even though the results of the AL .rar unpack process (creates the directory hierarchy activity_locking\blocks\activity_locking) might suggest this to you.

Great work and thanks a lot. 

In reply to Nicholas Stevens

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -

To unpack a rar file in your linux box, see to it that you have the unrar package installed.  Then type the following on a console. 

unrar x filename.rar

Heres a link to additional info on unrar.  But if your using KDE or GNOME desktop to work with your  linux box I don't know if there is a GUI interface to rar/unrar.

The following links may help regarding creating patch files on windows:

diff/patch port to native Win32

Unfortunately I have not tested this port to Windows, but I have used something similar to it.  I open a DOS box and go to where the port is installed then type linux commands like those below.  I just don't know whether they also changed the sytax for directories, in the ports of Linux utilities I have used I was able to use forward slashes to refer to directories instead of backslashes in DOS.

How to create and use a patch in Linux

Roel

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -

Finally had the time to remove debug and test it as a student.  Its works sang-ayon. Can't wait to try it in actual teaching.

Thanks for the contrib Stuart.

Roel

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Dan Hilke -

Is this the latest version? (activity_locking_2005101901.rar)

I tried to download and install this but it's only a 94k file, and while cPanel says it can unpack it, nothing seems to happen...  Am I missing something?

Is there a zip file??  And are there any installation instructions?

Thanks for any help,

Dan

In reply to Dan Hilke

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
Hi Dan,

I haven't unpacked anything with cPanel for a long time, but if I remember correctly, I think it prefers .tar files (zip files will work, but cPanel does funny things to permissions while unpacking a zip). So, if you want to unpack things directly to the cPanel file manager, you might have to re-package the file as a tar. I use a program called 7Zip that I got from Sourceforge.

As for installation--you simply add the files and folders to their corresponding folders in your Moodle install. Most of the files are new, a few contain changes to existing Moodle files.  After everything has been added, you need to click on the Admin link from your site homepage to install the new data tables.
In reply to Chardelle Busch

Re: Conditional activities: Latest Activity Locking Release

by Dan Hilke -

I'm just now getting the chance to actually do the install, and as I go to "Admin" for the first time after unpacking the files in the \blocks directory, I get the following warning: 

Warning: file(/home/.../public_html/blocks/activity_locking/block_activity_locking.php): failed to open stream: No such file or directory in /home/.../public_html/lib/blocklib.php on line 21

In reply to Dan Hilke

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Apologies for using rar as a compressed file format.
It is slightly more efficient than a zip file, which would be slightly larger than 100kb and hence I wouldn't be able to upload it to this forum.

I do try and keep it updated on CVS but I've has firewall issues here recently and not been able to connect.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Bill Weinheimer -

Hi Stuart,

I'm wondering if your rewrite timetable is soon enough for me to forego another attempt to install the last version and wait for your next release?  I've tried to reinstall the block after a deletion due to not having things function correctly.  What now happens on visiting the /admin page is a page full of

Error

Error

Error

Error

Error

Error

Error

Error

followd by database tables were not created successfully, then the Continue button.

I'm fairly new at customizing Moodle, but I have gotten the certificate module to work.

Any assistance is welcome.

Thanks,

Bill Weinheimer

In reply to Bill Weinheimer

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Don't worry. If you try and install activity locking twice you will get those error messages.

What is happening is that Moodle is trying to create a number of fields and tables that already exist. It should still work.

The next release won't be for a while - I've got 'real' work to do at the moment tongueout.

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Nikki Macfarlane -
Stuart,

On the previous version of activity locking I had a problem with exemptions. For example, a student is exempt in the gradebook from completing activity a, and activity a is a prerequisite for activity b. The activity locking for activity b was still requiring the student to compelte activity a.

Has this been amended in the new version so exemptions are taken into account when looking to see if prerequisites are completed?

Nikki Macfarlane
In reply to Nikki Macfarlane

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Hi Nikki,

At the moment, no, I haven't been able to include that functionality. To be honest, I'm not sure how to implement this. 'Exemptions' would require locking requirements to be stored for each user as far as I can see.
If activity locking was integrated with gradebook, the you would lose the ability to lock non-gradebook activities I think.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Ben Jean -

I'm running 1.5.2 and have loaded the latest version of activity locking and I'm trying to set a condition for a certifcate to be displayed after receiving a passing grade. When I set the activity lock, I get the following message error

The form did not come from this page! (referer = http://localhost/moodle/course/lock.php)

Any ideas would be appreciated. Thanks!

Ben

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by sina salehi -

Hi

I installed last version of activity_locking on moodle 1.5.2. I'm using dfwiki instead of moodle standard wiki and set the locking for dfwiki but when students want to go to a dfwiki locked activity before complete the prerequisites got the following error:

Fatal error: Cannot redeclare page_create_object() (previously declared in /var/www/html/moodle/mod/dfwiki/blocks/pagelib.php:21) in /var/www/html/moodle/lib/pagelib.php on line 58

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Nicholas Stevens -

I've got a really basic question about the install but I've rebuilt from scratch twice now (Moodle 1.5.2 and AL) and get the same error so I have to ask.

I can't unzip on my server so I unzip on my PC and FTP up to my site.  The directories you get after unzipping are:

 activity_locking\blocks\activity_locking

then activity_locking\ xx  (where xx = course,lang, lib, and pix )

My dum question is: do I create the activity_locking directory on my server underneath the existing moodle server blocks directory, or do I create a new activity_locking\blocks\activity_locking path on my moodle server?  (I've done the former,not the latter, but I'm beginning to wonder)

Under BLOCKS I show  Locks version 200509092800 so I must be part way there.  Admin messages all green on the table installs too.

My constant errors, though, whenever I have Locks installed are:

Notice: Undefined variable: activitycomplete in /homepages/15/d137666822/htdocs/test1/moodle/course/lib.php on line 1056

and

Notice: Undefined variable: activitycomplete in /homepages/15/d137666822/htdocs/test1/moodle/course/lib.php on line 1056

I do have the padlock icon when editing is turned on and clicking it does bring up the Activity Locks settings page.

Thanks for any help

In reply to Nicholas Stevens

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
Hi Nicholas,

You have probably figured this out, but you simply place the files in their appropriate folders--e.g., the locklib.php file goes into your existing Moodle lib file, the activity_locking block folder goes under your Moodle blocks folder... (this block by the way is not a block that you add to your course, it is there to create the database fields).
In reply to Chardelle Busch

Re: Conditional activities: Latest Activity Locking Release

by Michael C -

I just installed this and everything comes up like it is supposed to, problem though, when set to lock and pre-requisites required, you can click on anything even if the pre-requisite isn't met.  It doesn't lock anything even though it says it's locked.

Any help would be greatly appreciated.

 

In reply to Michael C

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Michael,
                can you precise "this" because there are some versions of activities locking and many versions of Moodle. That table in Moodle docs may help you to choose the appropriate version. Please don't test "this" on a production server.

I hope it may help,

Bernard



In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by Michael C -
using activityLocking2_0_for_1_6_july1006  with moodle 1.6
In reply to Michael C

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Michael,
                 you seem to have picked up two matching versions.

I am assuming that :
     you did'nt do an upgrade ( installation works only on a fresh new install ) and
     that the installation was fine, ( you accessed the admin page and the tables were created without errors ) .

If you try to access the activities as a teacher then you should always have access to it. The restriction should only appear if you try to access it as a student who has not yet meet the prerequises.

If you did all above and if you don't have success then is it possible that you give me some access to your test server to make some checks ( table creation, php and mysql versions, ... ) because that combinaison of Moodle and activities locking works here.

I hope it may help,

Bernard

In reply to Michael C

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Hello!

I want to install activityLocking2_0_for_1_6_july1006 but the link is off and I can't download the file. Anyone can tell me how can I download the file?

Thanks.
In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Teresa,
first welcome to Moodle.

I just retry the link from the modules and plugins and it works nowsmile. Maybe you try it during som network maintenance time at my organisationmixed.

Let me know if you have others problems.

I hope it may help,

Bernard




In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Thank you Bernard!

I have just tried the link but it still not works. I have disable my firewall but nothing. Please, could you send me the zip file to my email (teresapomposo@hotmail.com)?

Sorry for my English but I'm Spanish and my English is very bad. I read well but write very bad :S
In reply to teresa pomposo

Latest Activity Locking Release

by Bernard Boucher -
Hi Teresa,
sorry for the link but it works here!

The file is already sent to your email.

I have less problem reading people writing english as their second language because the compose their sentence like mewink After a double translation spanish-english-french the communication seem to keep on smile


Bye,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Thank you, Bernad!

I have the file and next Monday I will install it. I will post here telling you the results.

In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
I install the module and it runs perfectly but, as John Collins commented, I must add a default value to the delay field of the course_modules table to fix the error that not let me add a new course module.

Thanks for the module!!!
In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Hello again!

I have a problem. When I create a new section in a course (I'm working with topic format) it is created without "id" or sometimes with id=0, so it doesn't work well in any of both cases. For example,one of the consecuencies of the problem mentioned before, is that I can´t move a resource from another section to this one. The problem has appeared after I have installed the 'activity locking' module.

Can anyone help me?

Thanks.
In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Teresa,
can you precise the version of Moodle you are using and the activity locking version too and maybe a screenshot of what you are experiencing?

Here I use topic mode in a course with 20 topics and no problem.

I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Hello Bernard,

I'm using Moodle 1.6.1. (2006050510) and "activity locking 2.0 for 16july2006".

I have created a new section in a course (section4) and have taken three screenshot:
- In the first one (captura1.jpg), in the bottom of the page you can see the id of the new section (id=42126).
- In the second screenshot (captura2.jpg) you can see the error that appeared when I tried to edit section4. When I press the button 'continuar', I have to login, again, in moodle and then get in into the course.
- In the last screenshot (captura3.jpg) you can see that after the error mentioned before the id of the section4 is different (id=0). I don´t now why moodle has modified the id of that section but in the database it appeares with the id=0 so something must be going wrong.

If I create a new section without delete the mentioned section4 it´s created without id.

I hope you have understood what I've written.

Thanks.
In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Teresa,
thanks for the info. The section id 42126 is pretty big ( with 20 sections by course you must have 2100 courses in your site ).

If you don't have 2000+ course can you check the table mdl_course_sections in phpmysqladmin for it integrity.

For example in the 2 images attached, I just add a section ( #19 ) to a course and it get the id 237. In the table mdl_course_sections a record is added with the id 237, the course 3 and the section 19.

That is why I suspect that your table is corrupted.

Let me know if it is correct!

I hope it may help, good luck,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Hi Bernand,
I only have 254 sections but moodle assigned that "id" to the new section and I don´t know why. That it´s exactly the problem, when I create a new section its "id" is wrong. I don´t know how to solve this problem. Do you think is relate with the activity locking module?

Thanks.

In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Teresa,
as stated in my previous post,

"If you don't have 2000+ course can you check the table mdl_course_sections in phpmysqladmin for it integrity. "

First I hope you are not trying that on a production server. If so please make a copy of all your moodle parts:
mysql, moodeldata and moodel code.

And try what follow on your copy before:

To do that you will have to try the mysql command in phpmysqladmin :

check table mdl_course_sections

and check the result.

If the table is corrupted then the command:

repair table mdl_course_sections

should fix it.

For the "responsability" I don't think that activity locking is the culprit. In a copy operation or a restore or any other operation a table or many tables can be corrupted.

Let me know the details if you try it.

I hope it may help,

Bernard


In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by teresa pomposo -
Hi Bernard,

I checked the table mdl_course_sections and it's ok. But I noticed that the field "id" of that table it's wrong because it's not auto-incremented. So then, I just tried to modify this field and... alleluia,it worked!

Thanks you for your help. I never imagined that it would be here, in the database, the problem, I thought the problem came from the 'Activity Locking' module.

Teresa.
In reply to teresa pomposo

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -

Hi Teresa,

               I am happy that it works for you toosmile.

Take care with theses hacks!

Bye,

Bernard

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by 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.

In reply to Hamid Takesh

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Hamid,
               I have no idea of your problem. Maybe you used "stange" characters in the name of your activity. It happened here also when I used french characters '' ' " in activities name.

Activity locking as a hack is not easily uninstallablesad as you notice.

I hope it may help,

Bernard


In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by Hamid Takesh -

Hello again.

Thanx for your reply.

No, that's not the case, I have not used any special characters. I only used english and even tried useing only 1 word for the activity name, so that no spaces are there, but it still wouldn't work. What could be the problem?

I am running Moodle 1.6.1+, Apache 2, PHP 5.1, MySQL 5.0 on Windows XP.

I'll try downloading the full Apache/PHP/Moodle pack from moodle website... may be I use some... bad versions of one of those. I'll post what happens.

In reply to Hamid Takesh

Re: Conditional activities: Latest Activity Locking Release

by Hamid Takesh -

After downloading the full package, it magically worked...

The problem was my MySQL server. Sounds impossible...

I was running MySQL 5.0 downloaded from MySQL website, and this one is also 5.0. The version's difference is in 5.0.x.x

Didn't believe it first, but after a few reinstalls it proves to be so.

In reply to Hamid Takesh

Re: Conditional activities: Latest Activity Locking Release

by Bernard Boucher -
Hi Hamid,
              happy that it works for U2wink

Bye,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Latest Activity Locking Release

by John Collins -
Hi everyone,

I also got exactly the same error that Hamid described above after intalling the same version of activity locker.  It appears that there is a slight omission in the mysql.sql file provided with the module which is causing this bug.

There is no default value set on the delay field on line 17 of mysql.sql:

ALTER TABLE `prefix_course_modules` ADD `delay` VARCHAR( 10 ) NOT NULL AFTER `added`;

When you add a new activity to a course, Moodle will generate an INSERT statement for MySQL that will look something like this:

INSERT INTO mdl_course_modules ( COURSE, MODULE, INSTANCE, SECTION, ADDED, VISIBLE, GROUPMODE ) VALUES ( 3, 18, 10, 5, 1157548985, 1, 0 )

At a database level, this query will fail with the following error:

MySQL ERROR:

Field 'delay' doesn't have a default value

QUERY:

INSERT INTO mdl_course_modules ( COURSE, MODULE, INSTANCE, SECTION, ADDED, VISIBLE, GROUPMODE ) VALUES ( 3, 18, 10, 5, 1157548985, 1, 0 )

This will then result in the "Could not add a new course module" error being displayed on the frontend to the user of Moodle.

So to fix this error all you need to do is add a default value to the delay field of the <your DB prefix>course_modules table, I used a default value of zero and it seems to be working fine now.  You can achieve this using a MySQL frontend like phpMySQLAdmin.

Hope this helps,
John.
In reply to John Collins

Re: Conditional activities: Latest Activity Locking Release

by Nick Fisher -
Thanks John, that solved the problem for me. Nice work.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Eric Eberhardt -
Is this file (activity_locking_2005092900.rar) the latest? I notice that Stuart's message is dated Sept-2005, but it seems that there are recent posts. Any direction to the latest files would be great.

Thanks,

Eric
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Eric Eberhardt -
I am running version activityLocking2_0_for_1_6_july1006 of Activity Locking but it seems as though my language file for it isn't loading. Does anyone have any idea why?

See screenshoot.

Thanks,

Eric
In reply to Eric Eberhardt

Re: Conditional activities: Latest Activity Locking Release

by John Gschnaidner -

Sorry, Eric, but your screenshot is missing, so i have tu guess.

In moodle 1.6 the proper language directory would be /lang/en_utf8.
In the zip the directory for the language file 'lock.php' is /lang/en. That could be one problem. (In this case you will see the language tags instead of the message.)

If you want to use a language different from English you will have a problem with this version: part of the display (in the block for example) is in the code without using the language file. I am not to sure, but I think only the versions, that I worked on, have full language support (for English and German that is).

For more information please refere to the moodle Docs: Activity Locking. There you will also find information about other versions of Activity Locking.

Regards
  John

In reply to John Gschnaidner

Re: Conditional activities: Latest Activity Locking Release

by Eric Eberhardt -
John,

Thanks for the reply. I found that when I moved the lock.php lang file from en to the en_utf8 directory, that fixed the problem.

Regards,

Eric
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Eric Eberhardt -
Stuart,

I have successfully got the activity locking script working in Moodle 1.5.3, 1.6, 1.6.1, and 1.6.3. Kudos to you! This script is making it possible for us to use Moodle. I have began taking a gander at Moodle 1.7 Beta. With the implementation of the AJAX drag and drop code for moving items around, I assume that the file for the main course page has changed. I know that Activity Locking 2.0 overwrites some of these files. My question is, will it still work given the new code? If not, are there a lot of changes in the course homepage file? Could these changes be moved over manually?

Thanks,

Eric Eberhardt
In reply to Eric Eberhardt

Re: Conditional activities: Latest Activity Locking Release

by Chris Collman -
Picture of Documentation writers
Ditto Eric's questions and comments.

I uploaded the latest version in this thread into a clean copy of 1.6.3 on my windows XP localhost. Only change I think I needed to make was to copy the lock.php file in lang/en/ to to lang/en_utf8/.

Thanks Eric for the post which was the reason for my attempt of this version of AL. Here is a repackaged version which worked for me. No guarantees for anyone else smile
In reply to Chris Collman

Re: Conditional activities: Latest Activity Locking Release

by Eric Eberhardt -
Chris,

Have you tried the Activity Locking 2.0 in the 1.7 Beta yet? I'm eagar to know if it will work.

Thanks,

Eric
In reply to Eric Eberhardt

Re: Conditional activities: Latest Activity Locking Release

by Mike Coville -

I would be interested to learn if anyone has this running on Moodle 1.7. I would like to use this in conjuction with certificate 3.2

Thanky ou all for the help.

In reply to Mike Coville

Re: Conditional activities: Latest Activity Locking Release

by Chris Collman -
Picture of Documentation writers
Me too. I tried several flavors of AL (including Score Lock) in late October's version of 1.7. In short, they don't work.sad But there is always hope smile
In reply to Chris Collman

Re: Conditional activities: Latest Activity Locking Release

by John Gschnaidner -

None can!

Hello everybody.
Moodle 1.7 has massive changes in the code. There are new pieces of code and others have changed a lot.
It will be a lot of work to create a fitting version, and it won't happen anytime soon. It might even be possible, that the whole thing will need a complete new approach.

The 1.6 branch of moodle has been tagged as a kind of dead end; but I didn't thought, that changes would be that deep.
I only took a short glimpse at 1.7, but that was enough. Now I am even starting to consider, to give up Score Lock.

Either somebody has to work very hard, or we need to combine forces to put something like Activity Locking back into moodle.

Regards
  John

In reply to John Gschnaidner

Activity Locking

by Frosty Frost -
Hi there...

I don't suppose there is any movement on a new version of Activity Locking for 1.7 is there?

This is a great Module and would love to see it prosper in future versions.

Frosty
In reply to Frosty Frost

Re: Activity Locking

by Chris Collman -
Picture of Documentation writers
Bernard Boucher added a link to a Moodle 1.7 version of AL on the MoodleDocs Activity locking page under Table of Versions in Feburary 07. One of the forum links comes here.

Thank you Bernard, the link worked this morning 13 Mar 07 1100 UTA and onto my local host it goes for testing.

Best Chris
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Simon Gould -

Hi,

We installed this on a courses project but it made the site almost freeze up.  Is there any fixes for this at all or any other module that stops students progressing to the next questions until a certain time has elapsed?

thanks