Conditional activities: Activity Locking course format

Conditional activities: Activity Locking course format

by Chardelle Busch -
Number of replies: 122
Picture of Core developers
It has come to my attention that many people are having fits with the AL code. The problem is that the moodlelib and course/lib files can change with every Moodle update, making it almost impossible to keep up with the hacked course/lib file (which has many hacks and is not fun).

To make it easier, I have created a new course format called Activity Locking. This requires no hacks to course files. Unfortunately, you will still have to hack your lib/moodlelib file, but it is very easy to do.

Instructions

1. In the zip you will find the AL block. If you already have it installed, you do not need it, it is the same block as before. If you have never installed it, add the folder under the blocks folder called Activity Locking to your moodle/blocks folder. Then click on Notifications to install.

2. Copy the folder called locking under course/formats to your moodle/course/format folder. (If you currently have AL installed, you can safely delete the lib/locklib.php file, the lang file, and the course/lock.php file, and any added icons--they are all included in the format--be sure to get a new clean copy of the course/lib.php file for your moodle version!!.)

3. Open your moodle/lib/moodlelib.php file (DO NOT use a moodlelib file from one of the AL files, use the clean copy for your Moodle version!). Go to about line 1975 under the function_require_login AFTER this code:

/// If the site is currently under maintenance, then print a message
if (!has_capability('moodle/site:config', $sysctx)) {
if (file_exists($CFG->dataroot.'/'.SITEID.'/maintenance.html')) {
print_maintenance_message();
exit;
}
}

paste in the following code here:

//Check to see if Activity Locking criteria have been met
require_once($CFG->dirroot.'/course/format/locking/locklib.php');
global $cm;
check_locks($cm);



4. Go to your course settings and choose the Activity Locking format (I made this using the topics format, so that is what you are stuck with for now.)

Now, go to your course, turn editing on and you will see your lock icon after each activity. Using it is the same as it always was.


If somebody is running a test site (Chris???) please test this, I put it together rather quickly.


Average of ratings: Useful (7)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Hi, Chardelle,

Sweet. smile

I will be happy to give it a go.

This format is for 1.9.x, right?

-- Art
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Angela Carswell -

Does anyone have activity locking working (stable) with Moodle 1.9.10+ (Build: 20101206) ? If so, can you please provide instructions?  I'm new to Moodle and trying to learn as much as I can.

 

Thanks,

In reply to Angela Carswell

Re: Conditional activities: Activity Locking course format

by Deb Smith -

I would like to know how to get this to work too!  Earlier versions contained files that weren't in later versions.  If I need to upload those to make it work in 1.9.10 I would like to know!

In reply to Deb Smith

Re: Conditional activities: Activity Locking course format

by Angela Carswell -

Hey Deb,

I found another thread that might be useful for us:

http://moodle.org/mod/forum/discuss.php?d=165504#p725446

Let me know if you get things up and runnning and I'll do the same!

In reply to Angela Carswell

Re: Conditional activities: Activity Locking course format

by Deb Smith -

No, I have tried all these things and nothing worked.  I got the padlocks at least once I turned off Ajax, but when I tried to lock some items, I always got "There are 0 locks in this course."  I think some files were omitted from the later versions, and since I only tried to install it with the 1.9.9 and 1.9.9.1 versions, they were never loaded to the site.  But I cannot verify this is the problem, and I don't want to just blindly load stuff for fear I could do some real damage.

 

If anybody knows the answer, we could use a bit of help here!  The earlier versions of AL include:

lib folder:  deprecatedlib.php and locklib.php

lock.php to go in the lang folder

images to go in the pix/t/folder

course folder/ lib.php, lock.php, and section.ock.php

 

I don't think any of these files are included in the later versions that I have tried to get to work.

 

 

 

 

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Chris Creed -
Hi Chardelle

I'll give it a test run over the weekend and get back to you.

The instructions are very clear to follow - well done.

Chris
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Wow this sounds awesome. Can not wait to hear how the tests go. I will check back in. thank you thank you!!!!!
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Hi Art, I thought you might like thissmile. It should work with any 1.9 version. Be sure to delete any of the old AL files and restore your course/lib.php file or you will get error messages due to duplicate code. Since it uses the same db fields, your old AL locks will still be there--so DON'T delete the old AL block (it controls the db installation/uninstallation and hasn't changed)!

Thanks Chris and other testers. Please report back and let us know how it goes and what version you test it on.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Great news. I am in touch with Remote-Learner about setting up a test server for this. We have not upgraded our production server to 1.9.5 yet (procrastination may have paid off this time smile) so am hoping this will work.

Has anyone tried this on the latest build of 1.9.5. That is what we plan to try. Wow. This would be awesome. Keeping my fingers and all my toes crossed!!!!!
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Hi,
I have developed a split personality due to budget cuts. Right now I am floundering around in a different pond with a bunch of alligators. In my current context, "A.L." is in my priorities but low on my next alligator to wrestle list. However in the other pond that I will be in on Monday, I will be looking forward to testing out "A.L." and reporting back.

Did I tell you that I tried to follow instructions you gave me before but they didn't work for me. I had print outs of your email, the old and the new file open at the same time, numbered the 6 different changes I thought were required, carefully tried to copy and paste and note. However, I am pleased to report that in both ponds, what ever version of AL that is there, is behaving itself just enough not to crash anything (I think).

Thank you for all your efforts.

Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Ok I am going to give this a go - now! I have never edited that moodlelib.php file but if it's just a case of copying and pasting some code where you say I should be able to manage that. Will try first on a 1.9.5 and will let you know.
In reply to Mary Cooch

Re: Conditional activities: Activity Locking course format

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Wowsmile Replying to myself here - just installed it (two minute job)and it all appears to be working - so I am off to test it out and will be back againsmile Thanks in advance!
In reply to Mary Cooch

Re: Conditional activities: Activity Locking course format

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Ok - I have tried it in a Moodle 1.9.3 and 1.9.5 and (as far as I can tell) all works fine - I made a really rough and ready quick screencast here if it is of use to anyone on how to install and then use - I've never used Activity Locking (though I've tried conditional activities in Moodle 2.0 ) so I hope it's rightsmile

Average of ratings: Useful (1)
In reply to Mary Cooch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Screencast is super, Mary.

-- Art
In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Wow looks like my hero CB comes through again. I can hardly wait for Monday. As a matter of fact, I know somebody in my current pond who would probably like to try this sooner rather than later. They even know some PHP.

Thanks for the quick reports and feedback.
a gold star for everybody !
In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
I just heard back from a tester (Thanks Tom and other testers) who discovered I spaced out the code for locking a section, and the unlock code was not updated.

So, here is version 2 (2009070405).

Wonderful screencast Mary. Very helpful. One thing to note, when you click on the locking icon for an activity, you can set two things--1) criteria to be met before a student can access that activity and 2) criteria to be met to show that activity as being completed. At the top of the page you will see all other activities in the course. Choosing anything there will lock that activity with the criteria you set for those activities. If you choose the setting Show activity prerequisites, you will see locks BEHIND the locked activity showing the requirements, and green checks after they have been met. Right above the settings you will see the Activity Completion section with the activity you are locking. By setting something here, your students will see an open box in FRONT of the activity when incomplete and the green check once the Activity Completion requirements for the activity have been met.
Average of ratings: Useful (1)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Michael Weiland -

Chardelle -

I followed the instructions.  After the databases were successfully created, I lost my template!  All formatting, text, colors, etc. were lost.  Any ideas on this one?

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Michael Weiland -

More data...

When I replaced my backed up version of moodlelib.php, all was well.  I was able to login (as I wasn't able to reviously), and the theme returned.

I am using 1.9.5+

In reply to Michael Weiland

Re: Conditional activities: Activity Locking course format

by Art Lader -
Michael, I had the almost same experience on a local install of 1.9.4.

Never was able to log in, so I got no indication that the database had been updated.

I wonder if I pasted the moodlelib.php patch into the wrong place.

-- Art


Attachment moodlelib.gif
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Art Lader -
OK, tried again. This time, I was already logged in as an admin, so I was able to update the database. When I logged out and tried to log back in, the attached image is what I saw.

Not finding the style sheet, I guess.

When I replaced moodlelib.php with the original version, all was well again.

Hope that helps.

-- Art
Attachment nostyle.png
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Art Lader -
OK, installed version 1.9.5.1.

Seems to be working fine. smile

-- Art
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
1. Could someone paste here their moodlelib.php file that messes up the stylesheet.

2. If your style is messed up, is it also messed up in a course that does not have the Activity Locking format?

3. Do you have debugging turned on? Any error messages?

4. If you have access to db, do you have the course_module_locks table and 4 new fields in the course_module table:

delay, checkboxesforprereqs, checkboxforcomplete, visiblewhenlocked
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Dear Chardelle,

I am attaching a screen capture of the course module locks table. Please check your messages for more.

I hope that helps!

Thanks,
Art
Attachment coursemodulelocks_table.gif
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Art Lader -
And moodlelib is here. (File size is too big to upload to this forum.)

-- Art
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Thomas Michalak -
Hi Chardelle,
thanks for the great work. It just works fine on my 195 installation.

Just one Hint: There is a problem with the Menu Block: Although you course format is based on topics, the Navigation Links in the Menü Block points on a weekly course format.

i.e. with your course format a link looks like

http://www.ofsb.de/course/view.php?id=2&;week=1

but in a themebased course format it should be

http://www.ofsb.de/course/view.php?id=2&;topic=1

so sadly: the Navigation with the Menu Block does't work...

any ideas? and tahnk you very much,

Thomas (Michalak) from Berlin
Average of ratings: Useful (1)
In reply to Thomas Michalak

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
That's odd. There are a few different course menu block plugins. Which one are you using? I'll see if I can take a quick look at it.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Thomas Michalak -
Hi Chardelle,
i use 'Menu Block (menu_site_and_course)' (http://moodle.org/mod/data/view.php?d=13&rid=1216%22%3Ehttp://moodle.org/mod/data/view.php?d=13&rid=1216).

Thank you, Thomas
In reply to Thomas Michalak

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Hi Thomas,

I just looked at that block. Yikes, with debugging on it throws up a few notices. However, to fix the problem, find this line in the main block file:

if ($this->course->format == 'topics') {

and change it to

if ($this->course->format == 'topics' or 'locking') {

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Thomas Michalak -
Thank you so much, this was easy to do. Thomas
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think that should be

if ($this->course->format == 'topics' or $this->course->format == 'locking') {

In reply to Thomas Michalak

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

With the activity locking format you will NOT be able to add the Section Links block to the course because of this line (around line 24 in blocks/section_links/block_section_links.php):

   function applicable_formats() {
        return (array('course-view-weeks' => true, 'course-view-topics' => true, ,'course-edit-weeks' => true, 'course-edit-topics' => true));
    }

Reason - for the section_links block to appear as an option (in the BLOCKS>>>ADD) it needs to make sure that the course format can acutally support sections (makes sense).

To fix - add the BOLD to above:  

   function applicable_formats() {
        return (array('course-view-weeks' => true, 'course-view-topics' => true, 'course-view-locking' => true,'course-edit-weeks' => true, 'course-edit-topics' => true,'course-edit-locking' => true));
    }

This hack tells section_links that this course format (activity locking) has sections. 

Ken

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Harsha Prabhu -
Hi Chardelle

I added activity loking format in course format for my moodle 1.9.5(stable).But my problem is if i lock activities students can view them .Locked activities are showing activity complete and prereuisite complete even if student view them before .I am using activities as scorm for course content and lessons for assessments.Please can u tell me what should i do.



/// If the site is currently under maintenance, then print a message
if (!has_capability('moodle/site:config', $sysctx)) {
if (file_exists($CFG->dataroot.'/'.SITEID.'/maintenance.html')) {
print_maintenance_message();
exit;
}
}
/*i added code here*/
//Check to see if Activity Locking criteria have been met
require_once($CFG->dirroot.'/course/format/locking/locklib.php');
global $cm;
check_locks($cm);
/*till here*/


/// groupmembersonly access control
if (!empty($CFG->enablegroupings) and $cm and $cm->groupmembersonly and !has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_MODULE, $cm->id))) {
if (isguestuser() or !groups_has_membership($cm)) {
print_error('groupmembersonlyerror', 'group', $CFG->wwwroot.'/course/view.php?id='.$cm->course);
}
}
Average of ratings: Useful (1)
In reply to Harsha Prabhu

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
The only thing I can think of is to make sure your students have the student role assigned to them in the course. Anyone with a teacher role or above will not be locked out of activities.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Harsha Prabhu -
Thank u very much.We had changed student role,enabled viewhiddenactivities in course but activity locking is dependent on that role.Now i changed so everything fine.Before it was showing activity complete icon(open.gif) for students also.Thanks
In reply to Harsha Prabhu

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
You're welcome everyone. Glad I could help.

As for AJAX, it requires javascript functions to show the editing icons and I don't really want to go that far.

However, this is for the editing icons ONLY. So, you cannot edit the locks if you have Disable AJAX course editing turned off. You still should be able to use forum ratings. And you could still use ajax course editing once you have the course locks all set up.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Hi - Interesting. So you can enable/disable AJAX at the course level? That would be cool, but if you can only enable/disable at the site level that would not work since we have a lot of courses and instructors and no idea when they will set up activity locks.

Let me clarify - we can use forum ratings but was told with AJAX enabled you could rate/reply in one step as we do on this site. Otherwise it is a two step process but maybe those settings are controlled elsewhere? That would really be a time saver.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Alvin Shaffer -
Chardelle,

I still seam to have this roles issue where the admin and teacher have to adhear to the locks

1.9.7+

AL format block version 2 - 2009070400
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Rainer W -
Hello everyone.

I have a Problem with this AL course - and its really urgent.
I allready created another thread here.
The problem is that when I try to change the activity lock settings - they wont save. It probably has something to do with tables...
I allready posted the error message (from the debug mode) but I dont know what to do now.

Just wanted to point some attention on my thread

Thanks everyone for their afford.
In reply to Rainer W

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Here is a new copy of the locking course format. This zip contains the format folder only. If you need the activity locking block (which installs the db tables) you will need to also download the zip at the top of this thread.

This version fixes the "teachers can't access locked activities" problem, and also fixes the locking on forum posts problem.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Andy Smith -
Can anyone point me to a resource where I could find the information I need about integrating Activity Locking into a Flex page course format?

Doing a project where Flex page is the best course format, but activity locking is required also.

Thanks everyone!
In reply to Andy Smith

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
Hey Andy,

You need to look for "AMFPHP" with moodle in moodle docs along with complete understanding on Activity locking mechanism (you need to do this part by reading code as no live official source code or documentation exists till now for this purpose)


http://docs.moodle.org/en/Development:AMFPHP


^ ^ sorry no gui editor in my present weird test browser.

All the best


~ ~ ~ Peace - Ravishankar Somasundaram ~ ~ ~
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking course format

by Andy Smith -
Thanks Ravishankar,

I had no idea I could write Flash apps to work with Moodle. That could come in handy some day.

I was actually looking for some help on using Activity Locking with the FlexPage Format
from Moodlerooms. Sorry I didn't put the link in my first post. I usually use a Web-kit browser without access to the GUI editor to insert links.

Sorry for the confusion, and thanks for the response!

Andy
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -
Hey Chardelle,

The latest version of locking that you attached (04-23-2010) solved the issue I had with instructors not being able to view "locked" quizzes.

But.....if an instructor tries to edit (update a quiz question) in that "locked" quiz they still are not given access.

Ken
In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Hi Ken,

I just noticed this post. I rewrote the locking code. Please try this locklib file and see if it works for you--activities are now shown as completed for teachers, so editing shouldn't be a problem.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Here is the latest activity locking course format zip that includes the file above. If you have never installed activity locking, you need to download the first zip at the top of this thread and install the block.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

Hey Chardelle,

Sorry for the delay in responding. Tried the new locklib.php you posted 5/10/2010 and have the same issue.  As an admin (I can edit all locked items fine), but when I "login in as" the teacher in the course, I still cannot access locked items (assignments, quizzes) and get the standard "this item is locked you need to complete pre-requisite ABC before.....opens".

Ken  

In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Thanks for testing. Try this one instead.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

Much closer - but not quite.

Here are the steps:

  • "login as" instructor
  • Clicked on a "locked" quiz (they need to first open docs A,B,C)
  • Quiz opens (good - I wasn't getting this far before)
  • Select Edit Tab - see the 10 quiz questions (all good)
  • Try edit question#1 and get the "this activity is locked...."(no good)

Switch back to admin role and can complete without issue - so admin is ok, just not teacher (or at least "logged in as" teacher).

Without the locks the teacher can edit the question fine - so there is some buried permission that isn't quite getting set right.

Really appreciate the help.

Ken

In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
One more time--this is why testers are so valuable.smile
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

YOU GOT IT - fixed the issue. 
Can now edit all the way through as "instructor".

Ken

In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by John Anderson -
Hi, just thought I'd give some feed back about these updates. I am working on a new site and started from the beginning with a Moodle 1.9.5 install. Everything went fine. I did zip 1, then the zip 2 package above. Moodle gracefully told me I still needed to get an update for AL on the notifications page.

Got the latest other ones posted here , display.php and locklib.php in place and it now seems happy with my upgrades.

Need to test some still, but the install went good. The youtube videos were wonderful. Only thing better would be a new whole packaged zip.

Thank You Chardelle and testers here.
In reply to John Anderson

Re: Conditional activities: Activity Locking course format

by John Anderson -
Hi again, wondering if this is a bug or something I did installing. I see these warnings when I try to lock a section with a time required (1 day):

Notice: Undefined index: time in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Trying to get property of non-object in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Undefined index: time in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Trying to get property of non-object in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172
Table 'meckmoodle.mdl_' doesn't exist

SELECT * FROM mdl_ WHERE id IS NULL

* line 686 of lib\dmllib.php: call to debugging()
* line 481 of lib\dmllib.php: call to get_recordset_sql()
* line 421 of lib\dmllib.php: call to get_record_sql()
* line 172 of course\format\locking\display.php: call to get_record()
* line 215 of course\format\locking\format.php: call to locking_print_section()
* line 227 of course\view.php: call to require()


My database is missing some 'time' field or a whole table? Without setting a time period, it seems to work.
In reply to John Anderson

Re: Activity Locking course format Email notifications

by Hugo Boss -
Hello!

Thought I'd share this idea here, maybe someone can put it to use. I had to customize the Activity Locking course format so that it would send emails to students to notify them each time a previous activity that was locked is now unlocked.

See the changes in the attached file, locklib.php. The only alteration I made is between lines 103 and 159.

The new code I added is very basic, expensive and very awkward - I only recently begun playing with Moodle smile. Nonetheless, it explains the logic and it works, and there are definitely much better and cleaner ways to do this.

What an awesome plugin this is!
In reply to Hugo Boss

Re: Activity Locking course format Email notifications

by Chardelle Busch -
Picture of Core developers
Nice idea. Yes, this is difficult since the code searches for locked mods on every course homepage load..
In reply to John Anderson

Re: Conditional activities: Activity Locking course format

by Eric Maikranz -

I am getting this exact same error that John reported in July of 2010. 

Notice: Undefined index: time in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Trying to get property of non-object in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Undefined index: time in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172

Notice: Trying to get property of non-object in E:\Inetpub\wwwroot\meckcares_moodle\course\format\locking\display.php on line 172
Table 'meckmoodle.mdl_' doesn't exist

SELECT * FROM mdl_ WHERE id IS NULL

* line 686 of lib\dmllib.php: call to debugging()
* line 481 of lib\dmllib.php: call to get_recordset_sql()
* line 421 of lib\dmllib.php: call to get_record_sql()
* line 172 of course\format\locking\display.php: call to get_record()
* line 215 of course\format\locking\format.php: call to locking_print_section()
* line 227 of course\view.php: call to require()

Any idea how to correct this?  Thanks

Eric

In reply to Eric Maikranz

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -

I was having a problem with my activity lock not recognizing when the previous requirement was completed and not allowing the nest step to continue. I was modifying the moodlelib.php and replaced it. Now I get a long in screen, and then nothing, a blank screen.

I cannot get into my site, how do I correct this?

In reply to DeWayne Demland

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -

I have found this information:

Debugging showed this error" Fatal error: Call to undefined method auth_plugin_manual::prevent_local_passwords() in /home/content/d/e/w/dewayne24/html/moodle/lib/moodlelib.php on line 3397"

That section of this file reads:


/**
* Update pssword hash in user object.
*
* @param object user
* @param string plain text password
* @param bool store changes also in db, default true
* @return true if hash changed
*/
function update_internal_user_password(&$user, $password) {
global $CFG;

$authplugin = get_auth_plugin($user->auth);
if ($authplugin->prevent_local_passwords()) {
$hashedpassword = 'not cached';
} else {
$hashedpassword = hash_internal_user_password($password);
}

return set_field('user', 'password',  $hashedpassword, 'id', $user->id);
}


All I did was change the lines, as instructed:

3. Open your moodle/lib/moodlelib.php file (DO NOT use a moodlelib file from one of the AL files, use the clean copy for your Moodle version!). Go to about line 1975 under the function_require_login AFTER this code:

/// If the site is currently under maintenance, then print a message
if (!has_capability('moodle/site:config', $sysctx)) {
if (file_exists($CFG->dataroot.'/'.SITEID.'/maintenance.html')) {
print_maintenance_message();
exit;
}
}

paste in the following code here:

//Check to see if Activity Locking criteria have been met
require_once($CFG->dirroot.'/course/format/locking/locklib.php');
global $cm;
check_locks($cm);

Can someone help tell me what I screwed up and how to correct it?

Thanks so much.

In reply to DeWayne Demland

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -

ok, sorry about the previous two post. I have been able to correct both these problems.

Now I think I have found a bug. I have both a hosted moodle and a local test moodle. I have installed the activity lock on both machines, and they are both acting the same way.

attached is a screen shot of what I have. Number 1 is the first event to be accomplished. After it is accomplished the green check mark occurs in the box. Number 2 is then done. When it is completed you see the check in the boxes for quiz 2 and 3, but it cannot be accessed for quiz 1 which is what should follow.  Quiz 1is not allowed to be accessed. Each event is dependant on the one directly above it only. is there a bug here?

Attachment Lock.jpg
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Rob Johnson -

I am having this issue with the non-editing teacher role.  Is there any way they can view locked activities?  I am running 1.9.7 with all updated AL code installed.

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Got it, Chardelle.

-- Art
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Wayne Wenthin -
Wow! This was easier than any of the previous ones and just works even with the weekly's. Its up and running on Moodle 1.9.5+ (Build: 20090617)

Now to get the rest of the site launched.

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Leslie Sandoval -

I got it installed and it looks like it works, but it keeps generating error messages on the Notifications page. (see attached file) I had this problem with my AL hack install and never got an answer on how to fix it, so if anybody can tell me what's wrong I'd really appreciate it!

(Edited by Helen Foster to cut and paste the long error messages into the attached text file - original submission Monday, 20 July 2009, 09:45 PM)

In reply to Leslie Sandoval

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Like I mentioned in the instructions, if you already have had AL installed DO NOT install the block again.

To get rid of the messages, delete the blocks/activity_locking/db/mysq.sql file (not the mysql.php file) and everything should be fine.
In reply to Leslie Sandoval

Re: Conditional activities: Activity Locking course format

by Chris Creed -
Hi
I have exactly the same thing – it looked like AL was going to work but didn’t so I have had to take it off.

Let me know if yours works or you get a work around.


Chris
In reply to Chris Creed

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Thanks Art. I can't even login to your test server. This is typically caused by some goofy code somewhere, i.e. two extra spaces at the bottom of a file after the ?> (particularly in your config file), extra spaces after a line, etc. The problem is I can't duplicate it on my 1.94 or 1.95 test servers.

It is also possible that the conflict is caused by unclean code in some other plugin that you may have installed. Sorry about that.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Not a problem, Chardelle! Just testing it all out.

And it's working perfectly on my up-to-date installation of Moodle. It's only a problem for me in 1.9.4.

Thank you for all of your work on this (and everything else, of course). I know it's a very big investment of time and energy.

-- Art
In reply to Art Lader

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Okay Art,

Thanks for testing, and sorry about the problems. The odd thing is that it works fine for me on my 1.9.4 test server(??). So it isn't the version, but must be some other conflict somewhere.

And you're welcome.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Art Lader -
Ahhh, the joys of debugging!

Who knows what weird thing I have done, Chardelle? The possibilities are endless. wink

-- Art
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Just installed this on our test server Moodle 1.9.5+ (Build: 20090722) and it appears to be working great so far. Lots more testing to do but hoping to be able to get this on our production server soon. I was hoping that this might allow us to use AJAX but no luck. Enabling AJAX disables Activity Locking as it had before. So am guessing we will have to wait until Conditional Activities is core in Moodle 2.0 to use AJAX. I am especially looking forward to being able to rate/post in one step instead of two. You need AJAX enabled to do that.

But awesome work Chardelle. Thank you so much. Upgrading had been such a nightmare the other way.

Will keep testing and look forward to others input and feedback as well.
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking course format

by John Anderson -
Hi Deb,

What setting should I have in concerning the AJAX settings in Moodle for this module?
Both set to Disable ?

Enable AJAX

Disable AJAX course editing



Thank you.
In reply to John Anderson

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Please follow the instructions in this discussion John. You do not put anything under your mod folder, so I have no idea how you are getting that error message.

As for ajax, yes, like mentioned above, you will not get the activity locking editing icons if you do not have Disable AJAX course editing selected, however AJAX can be used for forum ratings.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by John Anderson -
I tried again today, starting from backups. I have everything in the correct place and it is almost working. When ever I try add some content to a course I see this error:

---------------------------------------------------

Field 'delay' doesn't have a default value

INSERT INTO mdl_course_modules ( COURSE, MODULE, INSTANCE, SECTION, ADDED, VISIBLE, GROUPMODE, GROUPINGID, GROUPMEMBERSONLY ) VALUES ( 7, 18, 5, 3, 1249411425, 1, 0, 0, 0 )
  • line 1554 of lib\dmllib.php: call to debugging()
  • line 2296 of course\lib.php: call to insert_record()
  • line 297 of course\modedit.php: call to add_course_module()
Could not add a new course module

---------------------------------------------------

Apparently this is still an issue that people have worked around? Looking at:
http://moodle.org/mod/forum/discuss.php?d=117815

Is this how I should fix it, give the DB a default value ?

Thanks again for the responses.

---------------------------------------------------
EDIT
---------------------------------------------------

This was indeed a problem for me and the workaround in the other thread did correct the problem. The install script does not provided a default for the column:

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

Mine was fixed using the 0:0:0 default mentioned the mentioned thread:

ALTER TABLE `ddtimoodle`.`mdl_course_modules` MODIFY COLUMN `delay` VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0:0:0';


Seems to really be working now smile




In reply to John Anderson

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Yes as Chardelle suggested, both have to be disabled unfortunately.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by David Maynard -

I'm running 1.95+ and after struggling around a bit, I have AL installed and working.  Thanks!

But, I have two small issues:

1) When I go to moodle / admin I get this error:

Version mismatch: block activity_locking can't downgrade 2009070400 -> 2007101100!

I'm sure that's because I tried several combinations / methods to get Al working.  Somewhere along the line I've got a mixed bag of modules.  Any suggestions?

2) AL forces me (Admin) to complete the prerequisites too!  And I wrote them!  Not a big deal, just rather surprising.  Maybe this is related to the error message?

Anyway, thanks for the Activity Locking code!  I would appreciate any help getting my two issues fixed up.

www.pm-neic.org

-- Dave

In reply to David Maynard

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
If you used the files in the zip (second) posted in this discussion, you shouldn't have these problems. The block version is 2009070400, and my locking code has always shown admins and teachers as completing the locks, I don't think it has changed in this course format code, if anyone else has noticed this problem, let me know.
Average of ratings: Useful (1)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by David Maynard -

I've uploaded the the second AL zip file and the error message is gone.  Thanks!  You were right on the money.

But I still have to satisify the locks, even though I'm logged in as the admin.

-- Dave

In reply to David Maynard

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Yes David,

Some activities lock you out, some don't, if it is a problem, let me know. Otherwise, just complete the requirements--gives you a chance to test it.
Average of ratings: Useful (1)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by David Maynard -

Thanks Chardelle!

Its not a big deal.  I've been working through all of activities.

I do have a question on forums.  Is the activity lock for forums satisfied by just looking at a forum or is posting in a forum required?  If it's just "looking" then is then I'd like to add to your long shopping list: "Posted message in forum xx" as an activity.

-- Dave

In reply to David Maynard

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
If you click on the icon to lock an activity, and have a forum in the course you see 2 options for that forum:
User must access this activity


User must post in this forum



Also, a tester notified me that when visible when locked: No is set, the activity is still visible. If you want to use this option, try the attached new display.php file
Average of ratings: Useful (1)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by David Maynard -

Chardelle,

First, thank you for your support.  I know how hard it is to keep track of all these conversations.  I appreciate it.

I've installed the display.php script in /course/format/locking

No joy.  Here's what I see.

Locking

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
Awesome. That worked for me. Love this format and we have just updated our production site to 1.9.5+ with the Activity Locking format and using the new display.php file and all appears to be working well.

This was our last barrier to upgrading to 1.9.5 (getting activity locking to work) so I am thrilled that this new format was created I think it will aid us in doing updates in a more timely fashion in the future.

Thanks again!!!!
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking course format

by David Maynard -

Deb,

<gulp>  I'm going to have to sit and think about why my 1.95+ with "display.php" isn't doing the job.

Thanks for posting your message!

-- Dave

In reply to David Maynard

Re: Conditional activities: Activity Locking course format

by Deb Burdick-Hinton -
What build of 1.9.5+ are you using?
We are using: Moodle 1.9.5+ (Build: 20090722)
If you send me a private message I can send you the email of the person who installed the activity locking format for us.
Bummer on your challenges!
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by David Maynard -

Chardelle,

I'm still fussing around with a proper installation of AL + display.php.

Today, for other reasons, I decided to unlock all of the "topics" in my course.  After doing that twice, I still have an indication that there are "47 locks" in the course.

Is this some initial value or is there something odd going on.  Should I be able to get to zero locks?

Oh, and add to my wish list a "Release all locks"  "Store all current locks"  " and "Restore all locks" options

Thank you!

-- Dave

In reply to David Maynard

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Sorry you are having problems, it works for me on my 1.9.5 test site.

Yes, if you unlock any locks, then the block should show that many locks.

This is just a stipgap solution until Moodle 2.0.


In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Shail Jai -
Hello,

In my case teacher also locked as well as student.

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by John Anderson -

Hi Chardelle and folks.

I'm a first time user of this module / format and start with a 1.95+ Moodle install. Got the correct download from here and followed the steps above. Things went smooth with the block install.

I'm only getting this error / warning in my moodle admin area, at the top of the site:

"C:\Inetpub\wwwroot\ddtimoodle/mod/AL format/version.php was not readable"

Then this seemed to go away. And I think it's working. I created a new course in the new locking format, no troubles.

I then added the 'activity locking block' to the course page. It says :

"There are 0 locks within this course."

Anything more to be wary of ? And is there anymore documentation or forum topic on how to use it?

Thank you so much for the much needed module...

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
Dear Chardelle Busch,

I see that you have built this script with base which christiano created (please correct me if am wrong).

can you please give me an idea of how to solve these issues which have with this http://moodle.org/mod/forum/discuss.php?d=124609#p570628
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking course format

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Ravi - I see you have posted on several forums - I will pick the one you refer to above and give you what help I can try to.
In reply to Mary Cooch

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -
Chardelle,

Thank you for a great module. It does exactly what I was looking for, but I found that for some reason it would not work on my local test site. When I uploaded to the server it worked great.

What I do have a question on is this, I have several branches in a single lesson. If a student looks at the first page in the lesson, and then goes back to the course main page, it checks him off as completely the activity. I can work with it like that, but is it possible to show the activity completed only when they complete all the lesson activities?

I think that this will be a great addition to Moodle 2.0 when it is released for sure. Thank you again for all the hard work.
In reply to DeWayne Demland

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
Hi Dewayne,


First, be aware that this code is not in 2.0, the 2.0 conditional activities code will be different, so all locks will have to be reset when you upgrade.

For lessons, you might put a question on the last page that says something like if you are finished with the lesson click yes, then give them a grade for clicking yes, and set the tracking to a grade of 100% for the lesson.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -
Does this lock work on Forums? I have included a pic of how I set it up. Problem is after a post to the required forum occurs, it does not show the activity as being completed.
Attachment Activity_Lock.jpg
In reply to DeWayne Demland

Re: Conditional activities: Activity Locking course format

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
I have got it to work in a forum DeWayne. However, I have sometimes had problems/issues with the locking not always "unlocking" first time -as if I have to refresh or go away and come back again and then it works. Maybe that's just my laptop though. I believe it should work with forums though.
In reply to Mary Cooch

Re: Conditional activities: Activity Locking course format

by DeWayne Demland -
I have refreshed a few times and still have the same problem. I will have to keep looking. I have to show this to a VIP in the next day or so, hate to have it happen. I am trying to get this school to go to this program.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

Chardelle,

Installed on 1.96 stable in 2 minutes and is working flawlessly.
Cannot thank you enough - a much better "hack" for the AL block.

Ken

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

Hey Chardelle,

Running the Latest Activity Locking Format + Display.php posted above in a couple of Moodle 1.95+ installs. All is good..eeerrrr.....great.  Just love it.

Only issue - when I lock an activity (i.e. - say I lock an assignment - the lock is that you must access + post in a forum above it first) it works as intended.  The problem is that the lock is working the same for students - teachers - admins.

So when I lock something as the admin, I then cannot access it (say to edit the due date on a locked assignment) until I satisfy the locked requirements - in this case posting in that forum above.

Any easy way to have the locks all confirmed for an admin?

Ken        

In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Esh Nagappan -
Hi,

Has anyone installed AL for Moodle 1.9.7 ? If yes, which version of AL should i use ?

Any help on this is appreciated .

Thanks
Esh
In reply to Esh Nagappan

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Hi, I started a new thread and used your question. It is a good one. My short answer: "Sort of, depends" smile

Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
Dear Chris Collman,

would be great if you would have linked the new thread in your post above so that people can have their discussions on that in there. smile
Average of ratings: Useful (1)
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Hi Ravishankar Somasundaram,
Excellent point. Where is a forum administrator when you really need them. wide eyes

That was my intent but/and then the world almost came to an end as I knew it. I started doing too many things at once and that todo in the next 30 minutes slipped away.

However, let me see if I can do it here (assuming nothing distracts me). I will even attempt a cross link between threads! I can.

Here is a link to a thread about Activity Locking in 1.9.7 in this forum.

Best Chris
In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
Dear Ken Gibson,

You can find a solution here

read it till end, you can find a file uploaded in the replies for the second time.


- - Peace
Ravishankar Somasundaram
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking course format

by Ken Gibson -

Hey Ravi,

I tried the new locklib file that you posted here .

But I am getting the same results (locks work perfectly - but ALL users must complete pre-req before items will unlock.).

Thoughts?

Ken  

In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
Dear Ken Gibson,

Did you use this file ? and replaced the existing one ?

Because it works fine for me.

Please turn debugging to developers mode and test it, and post here if you get any errors, so that we can isolate the issue and proceed further.
In reply to Ken Gibson

Re: Conditional activities: Activity Locking course format

by Ravishankar Somasundaram -
In case somebody looking for a curriculum mapping tool which has activity locking mechanisms as part of it in moodle, version < 1.9.7 and > 1.9.2 (Though i didnt test it in any other versions), have a look at this

And if you find it useful, do vote for it.

Bug reports and feedback's are always welcomed.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Andy Smith -
This is great! Thanks for making this available.
In reply to Chardelle Busch

Odp: Activity Locking course format

by Maciej Czuchry -
Welcome,
I have a problem with AL course format, becouse as I see AL is prepared for MySQL base, and I'm using Oracle Database. How can I manually create required tables and modify existing ones to make AL course format working?
In reply to Maciej Czuchry

Re: Odp: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
I'll have to look into updating this. In the meantime, you can see the code in the AL block db folder. You need to create the new table course_module_locks, and modify the existing course_modules table like this:

execute_sql(" ALTER TABLE `{$CFG->prefix}course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`");
execute_sql(" ALTER TABLE `{$CFG->prefix}course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`");

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by iron nori -
Hello everyone

I installed Activity Locking and everything seems to work (I'm still doing tests)
Thanks for your work Chardelle

I wanted to ask if any of you use this function on a Moodle platform in production.

I am concerned:
- The fact that I have found to download on Modules and Plugins
- I have to go change the code of a page in php (moodlelib.php)
- Some have reported malfunctions.

Before using it on a production I would have some reassurance from someone who uses a stable

I usually use Moodle 1.9.8 (Build: 20100526)

Thanks
In reply to iron nori

Re: Conditional activities: Activity Locking course format

by Sandeep Kankatala -
Hi Chardelle and others.

Firstly, a big thanks for your help in improving the Activity Locks function.

I'm a newbie and using Moodle 1.9.8 version. I need your help in troubleshooting. I followed your procedure and tested it on the website.

The problem I'm facing is:

It appears activity lock function is working, but actually it is n't? I mean I can create an activity lock, make some conditions etc. But when I login as a Student, there are no conditions/restrictions on the activities. They are simply topics/activities.

Observation:
(When I click on Notifications, after adding the Activity Lock Code initially, I could say no messages like "Tables Created". Its just a blank white page on the browser. I observed there is no Green Tick mark appearing next to an activity, when I created a Lock.).

Do you think its because of the 1.9.8 version of Moodle? If so, whats the alternative for me?

Thanks in advance.
In reply to Sandeep Kankatala

Re: Conditional activities: Activity Locking course format

by Chardelle Busch -
Picture of Core developers
The database tables are created by installing the activity locking block.
In reply to Sandeep Kankatala

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Hi Sandeep,
I do not think it installed. I do not see why 1.9.8 would make a difference. Did this happen with the set of AL files I compiled and recently posted in this forum in another thread here? Or were you brave like me and read all 100 plus posts in this thread to determine what needed to be done?

I got frustrated in trying to follow all the very helpful changes and suggestions in this particular thread. After many attempts, I did get it to work and immediately zipped all the AL files. I tested those files on another 1.9.9 local host and again on a production server 1.9.9. Both times I got a notification and it installed and worked as I expected.

However, I had the same thing happened to me on one of my attempts to install AL from all the suggestions in this particular thread. I got the right sort of screens but I checked the MySQL moodle database and did not find any AL tables. That made sense to me because I did not see anything happen in notification. If you can, check your database and I bet you will not see any AL tables. In short you did something that did not achieve the desired result smile

If up to this point, your site has never used AL, then I suggest the zip file I compiled from suggestions of more knowledgeable than myself. These files should work on any 1.9 version of Moodle.

Chardelle and others, please feel free to jump in and correct my misconceptions smile

Best to all
Chris

In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Sandeep Kankatala -
Hi Chris & Chardelle.

I found out that there were no activity locking tables installed on the database. Can you please tell me, where I made a mistake in the procedure? I'm planning to redo the process again.
In reply to Sandeep Kankatala

Re: Conditional activities: Activity Locking course format

by Sandeep Kankatala -
Hi Chris and Chardelle.

Like I said before, I could see no tables in the database. So, I tried the procedure again, but no luck. When I clicked on Notifications, all I could see is a blank page. I used the recent version of activity locks (Changes made by Chris AL_format_v3_20100912.zip).
Can you please tell me, if there's any alternative?

In reply to Sandeep Kankatala

Re: Conditional activities: Activity Locking course format

by Chris Collman -
Picture of Documentation writers
Hi Sandeep,
Thank you for the confirmation. What is the database you are using? If it is not MySQL then that would explain what is happening.

For example, there is not a PostSQL file in the blocks/db folder to create the necessary tables and fields in a PostSQL database. If you are familiar with MySQL and PostSQL you might be able to create the necessary tables and fields in Post SQL by reading the MySQL.sql file and doing it manually.

In case your database is MySQL, I will review the install steps and give you my ideas about troubleshooting. I would also suggest turning up the debug level for your site while you install any contributed module or upgrade.

The AL_format_v3_20100912.zip contains 2 folders, blocks and course. These folders should be placed in the moodle root. There should already be folders in the root with these names.

Troubleshooting #1. After the unzip or copy, you should see a ../moodle/blocks/activity_locking/db/mysql.php file along with a mysql.sql file. If you do not see those files along that path, then check your rights to the moodle folder and look for an error on the webserver side when you are trying to copy the files. That has also happened to me blush.

Troubleshooting #2. Since I have a lot of moodle folders (moodle19al, moodle18, moodle20 and so forth), I like to double check I put the files in the correct moodle folder that my webbrowser is using when something does not work. When my browser is looking at MyMoodle.org/Training and I carefully put the AL files in MyMoodle.org/moodle19al, it will never work. That has also happened to me blush

Troubleshooting #3. The mysql.sql file is a mysql query that should create the necessary tables and records. This is probably the long way of doing things. I run a script from phpMyAdmin for MySQL databases. I have edited the contents of this file and placed it in a MySQL query window and pressed the go button. You should notice "prefix" is used 5 times in the file. Change prefix to the table prefix used in your database (found in the ./moodle/config.php file). For example in the moodle I want to change, the prefix used is mdl_moodle19a_ .
Change:
CREATE TABLE `prefix_course_module_locks`
To
CREATE TABLE `mdl_moodle19a_course_module_locks`
and replace prefix the same way in the 4 other places it is used.

Troubleshooting #4. I have used up all my 1.9.x localhosts so I have not tested this. I suspect the short way of doing things, is to run the activity_locking/db/mysql.php file from your browser when you are logged into the moodle site as administrator.

Again, I just play around in my spare time because I learn by doing. I am sort of a blind man when ever I go behind the Moodle User Interface like this. I have the belief that eventually, I will be lucky and find the door in the wall. Since I am blind, I tend to repeat the very long path I used to get there because it worked once. Those with real knowledge have vision smile

Hope this helps you and others, Chris




In reply to Chris Collman

Re: Conditional activities: Activity Locking course format

by Sandeep Kankatala -
Hi Chris...

Thanks a ton for your quick reply and kind words. You are an inspiration, I like learning new things and I don't like giving up things. I will follow your Trouble shooting tips and will tell about the outcome very soon.
In reply to Sandeep Kankatala

Re: Conditional activities: Activity Locking course format

by Sandeep Kankatala -
Hi Chris...

Your troubleshooting tips worked wonders for me. I ran the mysql.sql file with 'mdl' in place of prefix in PHPMyAdmin and now the locks are working fine. Thanks a billion.

I observed one thing, after successfully creating the tables I clicked on the Notifications tab, it still returned a blank page. Anyways, my mission is accomplished with your immense help. I will post a reply in an existing thread that Activity Locks work fine for 1.9.8 version of moodle.

Thank you. God bless.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking course format

by Jason Smith -

I think I found my problem with 1.9.8 and AL Format.

I found that the sectionlock.php code was pointing to the root/lib/locklib.php instead of the course/format/locking/locklib.php

the code I put in is

<?PHP
require_once("../config.php");
require_once("lib.php");
require_once($CFG->dirroot.'/course/format/locking/locklib.php');

....

Seems to work just fine now. I will trouble shoot with student and staff.

 

cheers

everyone