Conditional activities: Activity Locking (for Moodle 1.5)

Conditional activities: Activity Locking (for Moodle 1.5)

by Marion de Groot -
Number of replies: 33

Please Stuart can you post a link to the latest version of the activity locking module for Moodle 1.5 ? I'd really like to try this module but I can't find the right download... it's all for 1.6

Thanx in advance

Average of ratings: -
In reply to Marion de Groot

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Andrew Winter -
If you'd like you can try this.  I cut all the AL code out of the lastest version of AL v1 and placed it in what was the latest 1.5.3+ code as of Feb 5th, 2006.  Click on the link above to download it.
In reply to Andrew Winter

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Andrew Winter -
I forgot to mention that we've been testing this and so far everything seems to work.  I don't believe there were any modifications after this zip was created but if you have any trouble let me know.
In reply to Andrew Winter

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Marion de Groot -

I do have trouble:

I've put all the files in the right dirs, but now when I try to go to the admin page  (admin/index.php)  I get:

Fatal error: Cannot redeclare check_dir_exists() (previously declared in /my site/HTML/lib/moodlelib.php:6422) in /my site/HTML/backup/lib.php on line 86

Any ideas?

In reply to Marion de Groot

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Jens Gammelgaard -
Picture of Translators
Hi Marion,

I had some errors, but I then used the original index.php instead of the one from the al-zip package from this thread.

And now I don't get error messages so far smile

BR
Jens
In reply to Jens Gammelgaard

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Marion de Groot -

Restoring the original index.php was indeed the solution: no more errors now. Thanks Jens!

In reply to Marion de Groot

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Colin McQueen -
This fix (restoring the index.php file did not work for me. Instead I commented out the offending function in the backup/lib.php file as it's in moodlelib as well. Where should the function check_dir_exists($dir,$create=false) be?
In reply to Colin McQueen

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Simon Harvey -

This fix also didn't work for me.  I have commeted out the function as well and now when I try to access admin i get 'Error' - seven times and underneath that it says 'Block activity_locking tables could NOT be set up successfully!'.

Has anybody worked out how to get this working... thanks.

Simon

In reply to Simon Harvey

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Colin McQueen -
The fix I mention (doing the commenting out only - so not putting back the original index.ph file in the root of Moodle) works here. I have also combined it with the draggable blocks code which uses AJAX and it still works!.

Can you give the detail of the 7 errors.
In reply to Colin McQueen

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Simon Harvey -

Hi Colin

There are no details.  I am using the index.php that came with the mod.  The error looks like this:

activity_locking

Error

Error

Error

Error

Error

Error

Error

 
 

Block activity_locking tables could NOT be set up successfully!
In reply to Colin McQueen

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Simon Harvey -

I forgot to say that I can access the course and set locking as an admin user... I just can't access the admin area.

As a standard user I can't access the course, i get the following error: 

Fatal error: Call to undefined function: course_parent_visible() in /home/ismwbayz/public_html/onlinecourse/moodle/lib/moodlelib.php on line 1418

I have tried a fresh install of moodle but i get the same results (although i can't use the 'Latest Stable Branch' because it dosen't install properly, not all the files seem to get uncompressed properly, not sure what's going on there... so have been using the 'Latest Reslease')

In reply to Simon Harvey

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Simon Harvey -

Ok... that 'Error' problem was to do with my sql... because of a failed installation attempt earlier some of the tables already existed, i have sorted that...

Now the problem is when a student trys to access the course they get:

<>Fatal error>: Call to undefined function: is_restricted_user() in /home/ismwbayz/public_html/onlinecourse/moodle/blocks/admin/block_admin.php on line 185
In reply to Simon Harvey

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Stuart Mayor -
That error is because you are using AL that was written for 1.5.2 in Moodle 1.5.3.

Here's what you need to do...
  • Restore an original moodlelib.php (in the lib folder) for 1.5.3
  • Open the original moodlelib.php and look for a function called require_login
  • Modify the require_login function so that it is like the one in the moodlelib that is included in Activity Locking.
Don't worry, a new version of Activity Locking is on the horizon...
Average of ratings: Useful (1)
In reply to Stuart Mayor

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Baz Jenner -

All sorted.

Thank you.

In reply to Baz Jenner

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Baz Jenner -

Spoke too soon.  Trying to open a certificate1.2al and get the following:

Fatal error: Call to undefined function check_locks() in C:\moodle\moodle\mod\certificate\view.php on line 84

I  have seen in the forums that others have successfully got:

Certificate to open after feedback module has been completed

Feedback to be available after SCORM has been accessed

Too much head scartching has almost left me bald!!!

Help!!

Baz

In reply to Baz Jenner

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Stuart Mayor -

Open C:\moodle\moodle\mod\certificate\view.php and look for line 84.

Around there, there should be about 4 lines of code, including the comments ///Activity Locking///

Delete them all.

Save.

In reply to Marion de Groot

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Eric Eberhardt -
I'm getting a similar error.

Fatal error: Cannot redeclare make_upload_directory() (previously declared in D:\WebRoot\moodledev\lib\setuplib.php:42) in D:\WebRoot\moodledev\lib\moodlelib.php on line 3751

Steps I took to get this:

1. Downloaded and installed via CVS Moodle 1.6 20060320
2. Verified it to be working right
3. Imported the 3 .sql files as tables in my db from Activity Locking 20060316
4. Copied over the entire Activity Locking 20060316 to moodle dir

If I am trying the file Activity Locking 20060316 with 1.6 do I still need to patch the lib files or can I just overwrite them?

If I do need to patch them, can someone give me the right syntax to use with the patch utility. I haven't had any luck getting the patch utility to work right.

Thanks,

Eric
In reply to Eric Eberhardt

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Stuart Mayor -

You will need to use the patch files. The lib files included are only for 1.5.2.

Unfortunately, I don't know what parameters you need to use a command line for the patch command. Perhaps some more experienced Moodlers can help.

In reply to Stuart Mayor

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Eric Eberhardt -
I got it working! For reference the syntax for patch is as follows:

patch -i patchfile.patch -o newfilename.php currentfilename.php

-i is the input patch file
-o is the output of the merged files
currentfilename.php is the file you are using for comparison.
In reply to Andrew Winter

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Julian Ridden -
I am importing this into my nightly build of 1.6.

Could you generate a patch file of changes that need to be made to existing moodle files? Files such as moodlelib have undergone some major changes so I cannot use yours.

Many thanks in advance
In reply to Julian Ridden

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Andrew Winter -
You might want to check with Stuart Mayor on that.  He's the guy that created the Activity Locking code, and last I checked he was working on a 1.6 version. 

Otherwise, I would happy to create a patch log.
In reply to Andrew Winter

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Heather P -
I'm probably showing signs of not being the brightest button in the pack but is this activity locking a 'Module' or a something else?
What I'm asking is do I put the majority in the modules section and a bit in the blocks section and a bit in the courses section and a bit in the lang section or does none of it actually belong in the modules section.
I tried the activity locking from the CVS site and got it wrapped around my neck once so I'm keen to make sure I'm putting everything in the right place before I get started this time.

Many thanks.
In reply to Heather P

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Stuart Mayor -
Hi.

Activity Locking as actually a 'hack' rather than a module.
Regardless of the version of activity locking that you are trying to install, you simply copy the files from the zip into the same folders of your Moodle installation. ie, the files in the course folder go in the course folder in your installation.

There is currently several of versions of Activity Locking floating about, all in various states. The one I would recommend is the one found at http://download.moodle.org/modules/activity_locking.zip
It seems to be the most stable.
In reply to Stuart Mayor

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Heather P -
Many thanks for this.
Which version of Moodle is this one for? I just applied it to version 1.5.3 and wiped out the home page of Moodle with it! I could still get to the admin pages just not the course listings or course pages all very weird.
Thanks
In reply to Heather P

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Jamie Smith -

This is a common problem.

The hack you downloaded does not likely have the index.php file which is located in the root of your Moodle installation included.

If you have displayed "topics" on your front page, what you have experienced is common.

You need to add the following line to the top of your index.php file to correct the problem.

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

This should do it.

Let me know if you have further troubles.

Jamie

In reply to Jamie Smith

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Heather P -
Well that actually made it worse not better. This time it wiped out the admin pages too! Ooops. Perhaps I'm not doing it right or maybe I have had the certificate module and the activity thing on and off one too many times and corrupted things!
I have recovered Moodle and will try again shortly as I am convinced it can't be that difficult.
Many thanks

In reply to Heather P

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Jamie Smith -

I understand.

For future reference, the problem you're experiencing only exists with your front page. If you ever have to access the admin functions directly, you can simply type your moodle location followed by "/admin/index.php" into the address bar.

Again, I think if you changed your front page site settings to "List of Courses" it would temporarily relieve the problem. The problem comes in when you attempt to display topics.

Also, if you could post your exact error message it would be helpful in getting things fixed for you.

Good luck.

In reply to Jamie Smith

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Heather P -
Hi
I've finally got my Moodle back up and running again. I've tried to apply the actvivty locking thing but again it seems to have broken the site.
My home page of Moodle currently has a line about an inch down from the top with the 'You are logged in as' etc. and the drop down menu to choose your language and that is all.

I've now gone into index.php and added the line of code from the earlier posting and now everything has vanished from my Moodle home page. I don't even have the 'You are logged in as' I just have a white page. I do still have access to the admin pages though which is better than last time.

In the version of Moodle that I have you cannot display Topics on the home page I just have the display a list of courses selected.

I am not getting any error messages. I'm not getting anything at all.

During the restoration process I did discover that I've lost the original Moodle download that I was using (it seemed to be something less than 1.5.3, but more than the 1.5.2 that I currently have going, I'm guessing I had a later stable version of 1.5.2 but have since eaten it and now cannot obtain it.

Thanks
In reply to Jamie Smith

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Heather P -
No that did not work either. I was typing into the address bar for the admin pages.
In reply to Heather P

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Baz Jenner -

Stuart,

Using Moodle 1.53 and after using the code you sent me yesterday I'm having the following error when logging in as a user:

Fatal error (Never Good). Call to undefined function is_restricted_user() in ....\moodle\blocks\admin\blockadmin.php Line 185.

Will keep plugging way.

Baz

In reply to Stuart Mayor

Re: Activity Locking (for Moodle 1.5.3)

by N Hansen -
Stuart-The activity locking module you suggest people download is not a good one. I just tried it with 1.5.3 and once the activities were locked, even the teacher couldn't see them anymore. The best 1.5 version available so far is the one from 19 October. It was recommended to me by Chardelle and I have successfully installed it on 1.5 and 1.5.3 and I believe she successfully installed it on 1.5.2. It can be found here. If you use it with 1.5.3 though, you should not just copy over the files, but you need to carefully compare the differences and make the changes that way. It's a bit time consuming, but it does work. 
In reply to Marion de Groot

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by Simon Harvey -

Hi,

I have now got Activity Locking working with 1.53, thanks!

It's not quite doing what I expected though.  It is hiding, and not allowing access to activities that I set until the previous activities have been completed...ok......   once the previous activity is completed it is then allowing access but it is not un-hiding them on the course page, so the only way into the activity is through the 'resources' page.

Is there anyway to make it so the activitys are un-hidden as well as being unlocked?

Thanks

In reply to Simon Harvey

Re: Conditional activities: Activity Locking (for Moodle 1.5)

by yassaman karakoç -
i have this problem.how can i fix this
Fatal error: Cannot redeclare check_dir_exists() (previously declared in /home/joomlaok/public_html/lib/moodlelib.php:6428) in /home/joomlaok/public_html/backup/lib.php on line 86