Conditional activities: Activity Locking for 1.9.5 (stable)

Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Number of replies: 35
Hello,
I have prepared the Activity Locking Module version for

Moodle 1.9.5 (Build: 20090515)

It is available for download at this page:
open source software for Moodle

A working version of the module can be seen at this moodle course (sorry for the course content is in Italian): learn programming mmorpg with dimensionex

For who is interested:
  • please read the README.txt file inside for instructions
  • please check that your moodle version matches the one this package is made for. If the versions are different (see build number), your Moodle installation is not guaranteed to work correctly.
This package is designed for use with the stable 1.9.5 version, not for the weekly relelase. Get the stable 19.5 version of Moodle from the main download page of the Moodle site.
Attachment activity_locking_195.jpg
Average of ratings: -
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Deb Burdick-Hinton -
Hi Christiano-
Thanks for contributing this to the moodle community. I installed on our test server and the locks appear for the block but not for the individual activities. I should have looked at your screen shot closer. Our current activity locking allows you to lock each individual activity so locks appear next to each activity. See screen shot. Do you or anyone have a 1.9.5 update that enables this. It is the only way we will be able to upgrade to v1.9.5.
Thanks for your feedback and efforts!
Attachment 1.9.5AL_NoLocks.jpg
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Upon help from Debra I made a new version of Activity Locking for Moodle 1.9.5 stable, which includes the fixes by Sharon Goodson.

The result is a module which allows individual activities' locking - see attached picture for a preview.

It still doesn't work with AJAX, though.

If anybody has a hint of how to made it compatible with AJAX, or to make the code more modular, just message me.

The module is available for free download from the same page (I just replaced the old file):

http://software.cristianoleoni.com/tiki-index.php?page=Moodle

Thanks again to Debra and Sharon.
Attachment al_195_a.jpg
Average of ratings: Useful (1)
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Shaltry -
Thank you both for your tenacity in getting this working! I, and MANY others, really appreciate having such a valuable module available.
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Deb Burdick-Hinton -
Thank you thank you cris! Sure appreciate all your hard work!
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi Christiano,
First I want to add my name to the list of people who really appreciate your work on AL. My site administrator says we will jump from 1.5.3 to 1.9.5 in the next month and told me to check AL and a few other features.

I wondered if I am missing something in the install instructions. I have been trying to get AL for 1.9.5 working on 4 or 5 clean installs (brand new 1.9.5 complete windows install package). I think a few of those installs were on a 1.9.5 May version rather than the current.

Here is what happened yesterday on the last attempt: I see the section locks but not the activity locks. The section locks do not seem to work for a student. When I log in as a student, I see topic 2, although the teacher placed a lesson in the Topic 1 and set the lock in topic 2 for a 70% grade in the lesson, show check boxes and hide section if locked.

Later today I will try to upgrade a clean install of 1.8.x to the 1.9.4+ Moodle and the AL for it that you so kindly supplied, to double check that.

Any suggestions on the 1.9.5+ install?

Thanks in advance,
from one more
Chris




In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Hi Chris,
the package you can download today from software.cristianoleoni.com will enable you also to lock individual activities, but it's no surprise to me that it does not work on 195+.

Please, try again by using the 195 (stable). I have tested the system on it.

Actually the tests for this new versions have not been extensive, so I cannot 100% sure that something doesn't work as expected, but I think that if you use 195 stable you should be done.

Also in the past I have received complaints from users trying to apply the patch to another newer version, and that Moodle was not working properly after that.

Perhaps, other users having tested the patch for 195 thorughly can help, too.

Let me know if it helped


In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi,
A progress report of not much progress. I am having a difficult time creating a clean install of 1.9.5 15 May 2009. Not sure why. Thought I could create a complete install package for 1.8.9 then upgrade that with the zip 1.9.5 done in May. Opening page works but I only see a blank page when I try to log in. Grrrr. Nothing to do with the AL code. smile

This is why I have have a bald head ! (I change my pictures, that might not be the current me).

Just to let you know I am still trying. Ciao

Chris





In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Ok,
I decided to copy a more traditional website I set up using Xampp, that had htdocs and a moodle folder in it. It had 1.9.5+ Moodle 6 June 2009, with certificate and questionnaire. Copied everything from the top folder to a new folder and changed some config files. Copied an unpacked version of al195-a into the new moodle folder. Presto, locks appear in both the section and in the activities. Magic!

What is more the locks work in the one lesson activity I set them in. I will do more testing later.

Interesting, I wonder why it did not work with the complete install package for 1.9.5+ 6 June? I will try that one more time and rather than unpack to the location, copy the files from the unpacked version.

Horray! I promise to work out what I did and then document it. I am feeling much better. Home to celebrate with a ...humm wonder if my daughter will let me sample that Super Tuscan she brought home last year! big grin I will get a big can of Foster's Bitter just in case.

Best Chris

In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi All,
This is very interesting. I repeated my experiment on my home computer, same results: I got AL to sort of work on one webserver but not on another one. Both were 1.9.5+ latest. As some might say "close but no cigar" and no celebration yet.

The sort of worked was on a 1.8.3 beta site which used a webserver supplied by apachefrends (XAMPP) I set up a long time ago. I upgraded to 1.9.5+ latest and then added the AL195_A set of files. I went straight to a course, turned editing on and everything looked good. Then I shut everything off and went back in.

There are error messages that appear concerning course\lib.php line 1369 on the homepage and 1450 and 1455 above every activity in a course. I could not see my homepage unless I went through site administration>courses and went into a course and turned editing on. Then when I backed out via the bedcrumb to the homepage, I could see my course categories and the one course I had on the front page. This was very consistant. And the AL locks worked for the activities.

I took a 1.9.5+ 10 June complete install package and created a localhost. I put in a copy of the MoodleFeatures course, no users, just data. and copied over the same AL195_A files. No AL icons appeared, no matter what I tried.

Conclusion: I can get it to sort of work. There is obviously something going on with the course/lib.php calls and I suspect that the old 1.8.x MySQL table/field setup has some "left overs" that remain after an upgrade which are used by AL195_A. I only say that because a new MySQL table setup by the complete windows install packages does not work in 1.9.5+ weekly.

Hope this helps people who know code.

Allora. smile Anybody got a suggestion? Let me see what happens on my work computer.

Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Just because I have no life, I decided to apply Sharon's course/lib to webserver which "sort of worked". That seemed to solve it's problems. No more error messages.

Here it is again, just so I can find it later smile Now off to work to see what goes on there. I shall report back.

Best to all

Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Wow. Sharon's lib.php seems to be miracolous.

I thought I had applied all the changes on version-195's lib.php, but I guess I didn't.

This tells me I have to give a closer look...

thanks for the feedback!
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi,
Sharon's lib.php does not seem to help my Moodle sites made from a clean complete window's install.

I am at work and creating my 3rd friendsofapache Xampp site. Decided it would help me with the installation documentation for Moodle. The documentation instructions are just a little confusing for a bald headed person, they jump around and the decision tree is not clear IMHO.


Best Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Petra Benky -
Hello,

I am using AL for 1.9.5 stable and I experiencing a little problem and I hope you can help me. I have installed the newest version of activity locking with locks both for topics and also for single activities.

The trouble is that students can see the lock/unlock icons for topics, lock/unlock icons for single activities are hidden. I am attaching picture. Do you know how to solve this problem?

Thanks,
Petra

icons.jpg
In reply to Petra Benky

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Unfortunately I never understood if this behaviour is the correct, intended one or not.

Actually I thought students should not see any locks, but just be advised via text if they try to access a resource for which they do not have the prerequisites.
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi Christiano,
Your thoughts are correct. Students should not see any locks. Right now in 1.9.5+ they see the section/topic locks, when then click on a lock icon, they are told they do not have permission.

Seems like we all agree, if someone does not have permission to change a lock, then they should not see the icon smile


Best Chris
In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Cristiano Leoni -
Yes, it must be a bug.

I don't know if it's new or if it was there already.

It may have popped up due to a change in permissions management in the moodle core, or also by a mispalced piece of code (ie my blame).

Unfortunately the first case is more likely to me, as Moodle has changed.

Perhaps it can be fixed.

I might look in it in a 10 days, I'm leaving abroad right now.

I will keep this topic wached in case someone else can look into it and solve it
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Petra Benky -
I see the locks also as a bug. I haven't used AL before, so I am not sure if it is new or not. Can you advice me if there is possibility to report this bug and where?
In reply to Petra Benky

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Petra Benky -
Solution for this bug is available:
http://moodle.org/mod/forum/discuss.php?d=123404#p560738
Average of ratings: Useful (1)
In reply to Petra Benky

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
am using version 1.9.4 ,The option visible when locked dosent seem to be working, is this already sorted out ?
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
Can somebody please explain the usage of the "Activity completion" ,why is that used ?

moodlealcompletion.png

if i set some value in it then the module becomes inaccessible , for example i set activity completion for quiz test2 as 10 and then when i log in as student the quiz test 2 is displayed as normal text instead of a hyperlink to that module.


In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
the activity locking block is based on admins purpose alone , the block is not viewable to students ,

how can i get the number of locks pending for the student in a course ?


for example :

we have 3 quizess namely

test 1 , test 2 and test 3.

test 2 is based on test 1 completion with grade above 5

and test 3 is based on test 2 completion with grade above 5

Now in this case the admin activity locking block says 2 locks for this course.


Student 1 has completed test 1 with grade 5 but not yet attended test 2 , so in this case how can i get the remaining locks for the student 1 in that course ??

In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi Ravi. I am not sure if this is what you are meaning but in this post here I made a second video about Chardelle's Activity Locking course format where I tried to show how you could set up some locked activities - have a look and see if it is of any use.
Average of ratings: Useful (1)
In reply to Mary Cooch

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
Dear Mary Cooch ,

Tank you very much for that link it was usefull in clearing my doubts on my second post in this forum , it would be nice if you could give some ideas or solution for my first and the third post i made here regarding 1. Visible when locked is not working 3. How can i know the number of locks pending for the student at any given point of time in a course ?


I think both the above queries can be solved if i use Chardelle Busch Activity lock instead of cristiano leoni because i went through his code and was not able to understand how can i achieve the above mentioned,it has bugs,more injections on core files and the author is not replying too.

1. But Mary Cooch, can you tell me how can i make all my course formats haev this activity lock thing incorporated in them ?

which lines i should add to other formats so that i can have this activity locking thing in all course formats ?

2. Can you also tell me how can i know the number of locks pending for the student at any given point of time in a course ?
Average of ratings: Useful (1)
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Ravi: I haven't used Cristiano's version only Chardelle's. Hers is based on the topic format so when you are setting up your course, in the course admin block>course settings you choose activity locking instead of , say weekly or topic.
As for what lines to add so you have the activity locking in weeks not topics, I cannot tell you as I am not a coder.
I don't know a quick way of seeing the number of locks pending for a student short of logging in as that student and counting themsmile - but I am sure others with more knowledge will come along and make suggestions.
In reply to Mary Cooch

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
Dear Mary Cooch,

Delighted by your prompt response, now i understand you are not a coder, thanks for your help all the way.
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Chris Collman -
Picture of Documentation writers
Hi,
I am back from vacation and I am not in my 100% Moodle mode.

You asked "Activity completion" , what does it do? I think I understand what this does. First, this screen has 4 parts, it has 2 "Lock" settings (conditions to enter the activity) and 1 "Activity completion" setting (when is the current activity complete) and a Settings section that is about visibility if the "lock" setting conditions are not met.

First you will notice the "Activity Completion" section setting is only for the activity you are in. This is independent of the locking sections on this screen. In short, there is a field in the database that is switched on when this criterion is reached. In your screen shot, when the student scores 10 (with a maximum possible of 10), the field will be marked that they completed test 2. Each kind of activity may have it's own measure for "completion".

In Moodle 2.0 they put this section on its own page because it is not a condition to enter the activity (does not lock students out of this activity). It is a condition that says when this activity is complete. A forum might not be complete unless the student made 3 posts. Unless someone got a 100% (10 of a maximum of 10) on your quiz, it will not be marked complete.

The hyperlink to test2 should not have anything to do with the "Activity Completion" setting you show. The hyper link to test2 should not even be seen by a student who has not taken or scored less than 5 (of a maximum of 10) on test 1. Please note, I do not have this version of Activity Locking so my hyperlink comment is the way it should work. It sounds as if it is seen but that the student can not enter it, which says to me that they have not met the test 1 conditions for entering test 2.

You did not mention if the student sees the message to tell them that they must score 5 of 10 on test1. My guess is that they do not, because test 2 "visible when locked" setting is set to No. Thus a student has nothing to click on and trigger the message.

In summary: The Activity completion is used by other activity locks, not by the current activity. The hyper link for an activity is really determined by the other settings and has nothing to do with its Activity completion setting.

Hope this helps. I am still foggy from vacation and do not use this version of activity locking. In theory, I think I have answered your questions smile

Best Chris











In reply to Chris Collman

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
Dear Chris collman,

Thank you very much for taking efforts to reply to this posts immediately just returning from an awesome vacation that you must have had.


yeah i was confused about the functionality of the Activity completion stuff , but after watching mary coochs video it was clear , now i migrated from cristiano leoni's module to chardelle's module, but the problem is she has implemeneted it as a seperate format of course whereas i am trying to make it a part of all other standard existing course formats.


so any help regarding this will be of great use to me.

thanks in advance.
In reply to Ravishankar Somasundaram

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Husain Choolawala -

Hello,

I'm trying to add Activity Locking to our moodle (with SQL Server 2005) installation.

The lock/unlock icons appear correctly on individual activities and section, but when I click on the icon the variable names appear within double square braces. Also the table course_module_locks is not created in the moodle database.

Please advice. Thanks.

In reply to Husain Choolawala

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Ravishankar Somasundaram -
Dear Husain,

It clearly shows that the module has not been installed properly for some reason.

did you visit the notifications page and get any errors while installing ?
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by samantha serpa -

Hi, we are using Moodle 1.9.6 (Build 20091021) and I was wondering if there was any plan to create a version of the Activity Locking module for Moodle 1.9.6? If yes do you have any time frame for this?

Thanks

Sam

In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Andrew Myers -
Hey All,

Got activity locks working fine on 1.9.5. There's one thing I'm having issues with that I would like to know if it's a bug or by design.

After setting locks for activities (in my case quizes), administrators cannot edit the quizzes when editing is turned on unless they have completed the prerequisites. It seems to me that if the administrator has "moodle/site:doanything" permissions, then they should be able to do exactly that.

Looking into function islocked(...) located in lib/locklib.php, it's getting hung up on the conditional commented with //locked on access and I notice that there are no calls to has_capability(...).

For our implementation, I added has_capability("moodle/course:viewhiddenactivities", ...), which is used in other conditionals throughout the islocked(...) function.

I'm not an experienced Moodle dev and am just now becoming familiar with the permissions system. This change I made now allows users with that permission to view (and edit if editing is turned on) activities that they may not have completed prerequisites for.

An undesired side effect of this, is that the icons that show which prerequisites have been completed now all show up as the little green checkboxes whether the prerequisite has been completed or not.

Any ideas? Is this a bug or not? Does my workaround make sense or is there a better one-off solution? Thanks!

-a-
In reply to Cristiano Leoni

Activity Locking 1.9.7 - Does it exist? Topic format? If so, what is link to download?

by Luigi Leblanc -
Activity Locking 1.9.7 - Does it exist? Topic format? If so, what is link to download?
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9.5 (stable)

by Patrick Daly -
I am having a problem where Teachers and Admins cannot view the locked activity unless the prerequisites are met.

I have ensured their roles are assigned correctly, and that their roles include viewing hidden activities, but they are still locked out.

Is there a solution for this?