Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I have not seen AL for 1.8.2, but since 1.9 is making some (good) changes to the gradebook, my question is will AL 2.0 for 1.8.2 work on Moodle 1.9?.
Ed.-
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
you will find all the versions of activity locking in that table. 2 versions exist for 1.8.2 and 1.8.2+.
The only thing that I am sure is that version for 1.8.2 will not works for 1.9 because it use a modified version of moodlelib.php the most modified file of Moodle.
I hope it may help,
Bernard
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Hi Coy,
sure it is possible to apply old changes to new 1.9 code but more Moodle evolve more you will loose functionnalities. For example activities locking don't support new roles, you will have to use depreciated functions to make works or to insert new roles functions to make it compatible with recent Moodle. Something with new gradebook.
Chardelle is adapting the certificate and activity locking for 1.9. You will see here how difficult it is. Maybe there is place for collaboration!
If you wait a little then the new Moodle 2.0, according to the roadmap, should integrate conditionnals activities not as a hack but as a new core feature.
I hope it may help,
Bernard
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Download
If anyone wants to give it a test, that would be great.
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
first thanks for that revamp of activity locking.
I just test it on a fresh new 1.9 beta 3. Here are some preliminary comments done with "standard" roles by a guy who don't know new roles:
1 - The icons lock.gif and unlock.gif seams to be inverted compared to previous versions.
2 - In course/lib.php at line 1486 the icon closed.gif should be used instead of lock.gif
3 - The new lock type Forum post make all the activities disappear in a course starting with the locked activity and all succeeding activities. Same thing for the admin. Maybe i didn't set the roles properly!
4 - Due to the extra possibilities of your version, do you want to give it a new version number ? If so, which number should be good to add to that table?
5 - May I suggest to start a new thread. All the enhancements surely merit it!
Thanks gain, I will be pleased to test it more if you confirm that I did a good usage of the roles.
Salutations from Québec with a lot of snow,
Bernard
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Thanks for testing.
1. That's a moodle thing--the lock and unlock icons are now in core moodle pix/t folder--and for some reason they are reversed. I actually renamed mine.
2. I did that on purpose--I just think a lock icon makes more sense and looks cuter

3. I can't duplicate this. What types of activities disappear, what type of activity are you locking?(I haven't tested with all of them). Roles shouldn't have anything to do with it-I've just added the core moodle roles to replace the deprecated code--e.g. can manage activities instead of isteacher.
4&5. Whatever you want to do is fine with me.
Not too much snow here in the foothills--but lots in the Rockies for skiing

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I have upgrade from 1.82 to 1.9 with conditional access with AL.
I Have upgrade with your new file to 1.9
All as fine until today when I was trying to add a new condition. When I click in the lock symbol to add condition, then show this error:
The coursemodule object you gave to grade_exists() isn't set up correctly. Either instance () or courseid (4) field isn't set.
In all activities show the same messange.
Do you know why and how to solve?
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Activity Locking is not conceived to be upgradable nor backupable. For Moodle 1.9, use the version adapted and enhenced by Chardelle, a couple of posts before that post.
Let us know if it works after an upgrade.
I hope it may help,
Bernard
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I tried to drop table and fields of the old AL an resintall again.
The messagen persists:
The coursemodule object you gave to grade_exists() isn't set up correctly. Either instance () or courseid (4) field isn't set.
In every try to add conditional access I see that message.
It is related to some settings in Grade?
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
1.9 Beta 3 (2007101506)
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Reply to your questions:
Are you locking activities with grades?
Quiz
Have you tried locking a non-graded item?
Yes, the error is in all items. Also in the topic
Are these activities that were added to the course before you upgraded to 1.9?
yes, right all the activities was added in 1.8+ and then I upgrade to 1.9 with all the course activities
If so, have you tried it with newly added activities?
Yes and the error is the same
Any more info you have will help.
attach the print screen error
Thanks

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Do you have news for me?
Can you help me solve this problem, please?
Thanks :)
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
maybe my previous post was not clear but:
Activity Locking is not conceived to be upgradable nor backupable
To make it work and to save time to all you have to :
1 - create a backup of your courses
2 - create a fresh new install ( not an upgrade ) of Moodle
3 - restore your courses in the new Moodle
4 - try the restored courses to verify their functionality
5 - install the new appropriate Activity locking code
6 - go to notification admin link to create tables automatically
7 - try to link something in your existing courses.
If the message persist :
8 - note it precisely as you did before to see if the instance() and course () reflect the realty:
course should be your course id ( 4 ) in your example
instance should'nt be empty () as you got it.
9 - create a new course with only 2 resources with simple name ( without any accentuated letters like Questionàrio)
10 - try to link these 2 resources
11 - let us know the results : success or the new error message with the 2 instance() and course () values.
I hope it may help,
Bernard
p.s. If you are interested to check the code the function grade_get_grade_items_for_activity of lib/gradelib.php generated that error message.
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Chardele, I send the grade_items table. Here I see all the quiz, but not other activities like forum, web pages, etc. But I think only quiz should be there because is grade, right?
I send in attach the lock.php so you can see if it´s the latest.
let me know If you need more files or tables that can help
if it was possible to put this working without a fresh install...I would be very very happy
grade_items table
id |
courseid |
categoryid |
itemname |
itemtype |
itemmodule |
iteminstance |
itemnumber |
iteminfo |
idnumber |
calculation |
gradetype |
grademax |
grademin |
scaleid |
outcomeid |
gradepass |
multfactor |
plusfactor |
aggregationcoef |
sortorder |
display |
decimals |
hidden |
locked |
locktime |
needsupdate |
timecreated |
timemodified |
2 |
4 |
1 |
Teste do Caderno 1 |
mod |
quiz |
3 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
2 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784517 |
4 |
4 |
1 |
Teste do Caderno 2 |
mod |
quiz |
4 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
4 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784517 |
5 |
4 |
1 |
Teste do Caderno 3 |
mod |
quiz |
5 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
5 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
6 |
4 |
1 |
Teste do Caderno 4 |
mod |
quiz |
6 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
6 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
8 |
4 |
1 |
Teste do Caderno 5 |
mod |
quiz |
7 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
8 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784517 |
9 |
4 |
1 |
Teste do Caderno 6 |
mod |
quiz |
8 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
9 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
10 |
4 |
1 |
Teste do Caderno 7 |
mod |
quiz |
9 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
10 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
11 |
4 |
1 |
Teste do Caderno 8 |
mod |
quiz |
10 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
11 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
12 |
4 |
1 |
Teste do Caderno 9 |
mod |
quiz |
11 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
12 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
13 |
4 |
1 |
Teste do Caderno 10 |
mod |
quiz |
12 |
0 |
NULL |
NULL |
NULL |
1 |
20.00000 |
0.00000 |
NULL |
NULL |
0.00000 |
1.00000 |
0.00000 |
0.00000 |
13 |
0 |
NULL |
0 |
0 |
0 |
0 |
1198784472 |
1198784518 |
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I create a new one, and the AL have no errors in grade and non graded activities

What that means?
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Try: going into the old quiz to edit, then just save it again. Like Bernard suggested, maybe try importing or b/u and restore the quizzes into a new course.
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I tryed to import this course to a new one, but when is creating the 4th quiz categorie (there are 10) it gives me this error:
Could not restore categories and questions!
Any ideia?

Thanks!
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
1. 1.9 is still beta, so there may still be some problems.
2. if you do get errors while importing, you might want to put it in the tracker.
3. the gradebook API is changing (again), so this AL code is going to change also, and will not work if you upgrade to the latest 1.9.
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
I have changed my gradelib.php
function grade_get_grade_items_for_activity($cm) {
// if (!isset($cm->instance) || !isset($cm->courseid)) {
// error("The coursemodule object you gave to grade_exists() isn't set up correctly. Either instance ($cm->instance) or courseid ($cm->courseid) field isn't set.");
// }
I´ve comented the line that show the error, and now the AL is working fine. No error and I have only changed that. Tell me, there any problem to leave the file like this?
I think the problem is finally solved!
thanks!
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9
Hi Chardelle,
I'm running Moodle 1.9.2. Is there a stable version of AL for this version of Moodle?
I couldn't get the 1.8 version on the Modules and Plugins download page to work with 1.9.2
Thanks