Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Eduardo Hernandez -
Number of replies: 25
Hello People,

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.-
Average of ratings: -
In reply to Eduardo Hernandez

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Bernard Boucher -
Hi Eduardo,
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

Average of ratings: Useful (1)
In reply to Bernard Boucher

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Coy Detherage -
So is it possible for me that I can modify those codes in moodlelib.php for 1.9? If so, can you tell me how can I do it? I am pretty good with php.
In reply to Coy Detherage

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Bernard Boucher -

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

In reply to Bernard Boucher

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
Here is the link to the activity locking files for 1.9.

Download

If anyone wants to give it a test, that would be great.
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Bernard Boucher -
Bonjour Chardelle,
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



In reply to Bernard Boucher

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
Hi Bernard,
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 cutersmile than an open box. It also helps to differentiate the locks from the activity completion open boxes. However, I forgot about changing my core pix until you mentioned it in 1--so its really an open lock instead of a closed one, isn't it--yikes, we'll have to change that.
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 skiingcool
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Hi!

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?



In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Bernard Boucher -
Hi Unformatted wink,
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

In reply to Bernard Boucher

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Yes, i´m using that version.

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?
In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
Please let me know the (date) version of moodle you are using
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
I´m using this one:

1.9 Beta 3 (2007101506)
In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
The moodlelib and course lib files have changed since I posted the above zip, so, try replacing them with the ones in this zip. If that doesn't help, some more questions. Are you locking activities with grades? Have you tried locking a non-graded item? Are these activities that were added to the course before you upgraded to 1.9? If so, have you tried it with newly added activities? Any more info you have will help.
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Hi Chardelle and thanks for the update. But the error is still there...

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 smile
In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Hi Chardelle!

Do you have news for me?
Can you help me solve this problem, please?

Thanks :)

In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Bernard Boucher -
Hi Unformatted wink,
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.


In reply to Bernard Boucher

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
I'm rather stumped as to why the code is not picking up the mod instance. Another thing to do is if you have access to your db, if you could check the grade_items table and see if your activities are listed in that table. Also, if you want, send me your lock.php file so I can check to make sure it's the latest code.


In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Thanks Bernard, for your explanation. That will be a hard work...but if have to be...

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 smile



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



In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
I see that your activities are all quizzes in the same course. Could you do a little more testing. Try creating a new course and add some activities other than a quiz, both graded, and non-graded, like a lesson or assignment and a resource or label, then try locking those and let us know what happens.
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
yes, I have only one course.

I create a new one, and the AL have no errors in grade and non graded activities pensativo

What that means?
In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
Maybe the new gradebook code isn't getting upgraded for the old quizzes? I don't have any upgraded code to test.
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.

In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
I tryed to edit and save, but the problem persists.

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? misturado

Thanks!
In reply to unformatted :)

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Chardelle Busch -
Picture of Core developers
A couple of notes:

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.
In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by unformatted :) -
Hi!

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! smile

thanks!

In reply to Chardelle Busch

Re: Conditional activities: Will AL 2.0 for 1.8.2 work for 1.9

by Nicola Bennett -

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