Activities linking in meantime for Moodle 1.4

Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Number of replies: 46

Hi moodlers,
first thanks to Martin and all others developpers for Moodle 1.4.

You will find attached some moodle's modified files permitting some activities linking for Moodle 1.4 with all it addons.

Same old lazy codeblush with fresh new fileswink

Please don't try these on a production system, experiment before.


The linking is not intended to replace nor to be compatible with the Moodle Quiz most wanted feature or activity linking http://moodle.org/bugs/bug.php?op=show&bugid=297 .

In the meantime, it may be usefull to someone.

A readme file is included for the installation.

What you get:

1 - Only quiz, lesson and resource modules may be dependants ( locked or linked ) of one other module.

2 - Any module may be the predecessor or the activator of the linked module.

3 - If a quiz if choosen as a predecessor it must be fully graded ( 100 % ) to unlock linked activity. If you use Alvin Trick you can choose the grade you want to unlock.

4 - All others modules ( even if they are gradables ) have only to be "viewed" by the student to unlock the linked module.

What you loose:

You will not be able , when in editing mode, to "moveto" a hidden module. If you really need to move an hidden module, show it, move it and hide it and link it again. That is the cost to pay!

How to use it ( Teacher ):

A - Hide the module you want to be dependant.

B - Try to move it. Instead of the message "moveto" you will have "predecessor" before each other module in the course.

C - Click on the desired predessesor. It fullname will appear at the right of the linked module.

D - If you want to remove the link show the linked module.

E - Modules hidden but not linked are treated as before.

How to use it ( Student ):

F - All modules are treated as before if they are not linked.

G - Linked modules without the predecessor's condition realised appears dimmed with the predessessor name in parenthesis (Timothy suggestion ).

H - As soon as the predecessor is done ( at that moment quiz grade or view of all others modules )

The dimmed linked module appears normal ( not dimmed ) as if it was not linked.

I - If a student try to type in the address bar the link to the quiz or the ressource a message indicate the name of the predessesor and the required grade for quiz.

Your comments are welcome.

Thank you for your testing time and have a good try,

Bernard

Average of ratings: -
In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Will Muenchow -

You read my mind! I just did a search for an update on the act linking! Thankssmile

Will

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Susanne Vitzthum -
Hello Bernard,

thanks for this nice little tool big grin

Just installed it - as far as I can appraise it, it's really helpful and works fine.

Some thoughts & feedback:

1. Sometimes the displaying of the word 'predecessor' ist a bit confusing, I cannot recognize always, where it belongs to ...

2. Is it possible to make the linking work also for whole themes? For example, I'm using the theme format in a course and want to enable theme number 2 after theme number 1 has been viewed/processed. Maybe this could be a future improvement ... wink

regards,
Susanne
In reply to Susanne Vitzthum

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi Susanne,
welcome to the dark sideevil of Moodle.

1 - You are right: the word predecessor is displayed even before labels, wich can't be linked! I will correct that for next release, maybe moodle 1.4.1.

2 - Depending what you call "theme format", maybe "course topic format" it is already possible to use, for example the last quiz of the previous topic as the predecessor of many ( lesson, quiz, resource ) activities of the next topic.
But it is long to make all these links, but it works.

I am working on an another way of linking: "calendar event dependance".
Now it works only for quiz at home. But I will add others modules and also courses sections ( weeks and topics ).

Thanks for yours feedbacks,

Bernard

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Bonjour Bernard,

I just tried your activity linking--c'est fantastique.  Mais..... I was hoping to get it to work for the Certificate module that Hugo has made (http://moodle.org/mod/forum/discuss.php?d=9766).  I tried adding:

require_once("../../lib/linklib.php");//bb

and

if (!$cm->visible and !isteacher($course->id)) {
        islinked($cm); //bb
 }

to the certificate view.php file, mais alors, a user can still open the certificate if they  have not taken the required quiz, even though the link is dimmed.  Is there anything else I need to do to the files to make it so a user gets the "you cannot access..." message if they click on the link before the requirement (predecessor). 

Merci,

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Bonjour Chardelle,

I just installshy Hugo certificate module and modify the view.php as you stated and that works correctlysmile as supposed.

The require_once("../../lib/linklib.php");//bb is at line 7 and

if (!$cm->visible and !isteacher($course->id)) {
islinked($cm); //bb
}

just before if (isteacher($course->id)) {

I tested it on a "plain modified thoughtful moodle 1.4" 24083100

The certificate is the only module that require activity linking, I hope it will work for it everywherebig grin

I hope the attached file will work on your site.

À la prochaine,

Bernard



p.s. Thanks Hugo for the "Martinized" module. I will have to take Martinizing habits!
In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Merci beaucoup Bernard,

Je ne sais pas, I must have had things in the wrong location in the file.  I just tried yours et voila c'est bon! 

I am going to work on the theme/styles stuff since it (course view I think) is picking up icons from the course pix, rather than the theme pix and the font in the "error" window is not from the styles?  Will let you know if I get that worked out. 

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Bonjour Chardelle,
                            as an auditive people I never notice that the style was partly lost in the error message.

I added some  print_header();  just before the notice() functions calls in linklib.php et voilàwink

À la prochaine,

Bernard


In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by W Page -
Chardelle & Bernard
Attachment hummingbirds.gif
In reply to W Page

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
I will have to activate the renamed WP1 filterevil

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers
Are those hummingbirds fighting? wink
In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by W Page -
Don't you dare activate that filter Bernard!!!

I don't really understand French (At least that is what it looked like), but all those phrases sure looked kinda friendlyyyyyy...

Made me blush... blush

wink evil evil smile

WP1


In reply to W Page

Re: Activities linking in meantime for Moodle 1.4

by W Page -
Hi Bernard and Chardelle!

Please do not pay any attention to my meanderings  Just having fun. smile

From time to time I try to help someone on the Forums with my limited Spanish.

WP1
In reply to W Page

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Actually WP,

We were speaking in code.

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Okay,

In case anyone is interested, here is Bernard's folder with the new and improved linklib.php and it includes the view.php for the certificate.  Please note, I just realized the certificate file is one that has been modified by me so check it first--the date has been added and the line spacing changed to accommodate it. 

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by W Page -

Thanks Chardelle,

I will definately check this out this weekend.

I know the ability to back up topics or activities independent to the rest of the course is on Eloy's list.  When that occurs it will be really nice to have this script so folks can actually swap and share educational theme "units" or "Moodle Courselets" [as Martin has dubbed them] with one another.

WP1

In reply to W Page

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Hi Bernard,

I was hoping you could help me yet once again.  I have been messing around with this all morning and can't figure it out.  After making the print_header change in linklib.php, I now can't view the certificate--it just comes up in garbage.  It is strange since I thought I tested this and it worked before, but now I get an error message.  It appears that the print_header in linklib.php is conflicting with another "header" function in a certificate file (see below).  Is there maybe another way to get the "theme" to work without using the print_header function?  (Because everything does work without the print_header function--it just doesn't pick up the custom pix and some of the fonts are not right).

Thanks again,

Chardelle

I get this message:

Warning: Cannot modify header information - headers already sent by (output started at /home/onlineco/public_html/demo/lib/linklib.php:448) in /home/onlineco/public_html/demo/mod/certificate/class.pdf.php on line 1916

Warning: Cannot modify header information - headers already sent by (output started at /home/onlineco/public_html/demo/lib/linklib.php:448) in /home/onlineco/public_html/demo/mod/certificate/class.pdf.php on line 1917

Warning: Cannot modify header information - headers already sent by (output started at /home/onlineco/public_html/demo/lib/linklib.php:448) in /home/onlineco/public_html/demo/mod/certificate/class.pdf.php on line 1919

and this is the header code in the class.pdf.php file:

on line 1916:  header("Content-type: application/pdf");

on line 1917:  header("Content-Length: ".strlen(ltrim($tmp)));

on line 1919: header("Content-Disposition: inline; filename=".$fileName);

 

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Bonjour Chardelle,

Bad messagesmixed

I just re-download linklib.php and view.php from the forums and these seems to work well here on an 1.4.1, without header problem.

Retry to download files and tell me if there are circonstances where they don't work.

À la prochaine,

Bernard

p.s. I will repakage it for 1.4.1 or maybe 1.4.2 after finishing that

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Bonsoir Bernard,

Well, you are busy! 

The only problem I had was opening the certificate, other than that it works fine.  (I did upgrade to 1.4.1+ but I don't know if that is the problem)   I found that the certificate does work if I delete the first print_header line in the linklib file.  The other print_header lines aren't a problem, so at least the font in the notice windows is correct.  The only problem is the icons on the course page.  I was just wondering if you knew of some way other than the print_header function to get the course view to pick up the icons from the theme folder (If not, I can just put my custom icons into the moodle pix folder) smile.

Merci beaucoup,

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Hi Again,

Okay, I just figured out that only in the topics sections (not in the blocks) the added activities are picking up the icons from the module folders, not from the theme pix. Hmmm.   So, maybe there is a problem with the format.php file:

print_section_link($course, $thissection, $mods, $modnamesused); //bb

I don't know, it's just a guess, but like I said, I can just put my custom icons in the mod folders--but then, the different resource links (flash, pdf, etc.) will not be picked up. 

Chardelle

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Bonsoir Chardelle,

I just download and install the lastest 1.4.1+ (2004083101) on a fresh new database and all work fine here with the two files : linklib.php and view.php from the posts.

Icons are there, certificated appear correctly to the student and activity linking works fine also.

Happy for me but sorry for you!

Maybe a file is corrupted. A reinstall should be donesad

I hope it will help you,

Bernard




Attachment certificate1.png
In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Tony Hursh -
Chardelle, that often happens when an extraneous blank line creeps into a PHP file. Check the linklib.php file and make sure you don't have any extra blank lines before the opening PHP tag or after the closing one.

In reply to Tony Hursh

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Oh Tony,

That is exactly what it was!  (I somehow had a blank line after the closing tag) Thanks so much, this is very good information to know. 

And thank you too Bernard!  Ca va.

Chardelle

PS: anyone wanting more info on making a certificate contingent upon a quiz see this post in the Business Uses course:  http://moodle.org/mod/forum/discuss.php?d=12421 

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Tony Hursh -
Great! I think everyone who tinkers with PHP has probably been bitten by that at one time or another. I know I have. smile

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
 Bonjour Chardelle,
                    very happy for youbig grin

As a non php programmeur ( only cut and paste and adapt other codeblush ) I am very surprised that a so powerfull and stable language have that weakness with insignificants errors messagesangry  in that particular case.

À la prochaine,

Bernard

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Hello Bernard and Others!!!

I have been trying to install the activity linking code for about two hours now. After installing all of the files and trying to set a certificate to activiated when a quiz is selected I get the following message:


Warning: Invalid argument supplied for foreach() in /home/newed/public_html/campus/lib/datalib.php on line 907

bbbbb id= 194 linkid= 106 Could not update the resource

Any help is greatly apprechiated.

Ralph
In reply to Ralph Blakeslee

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi Ralph,
             that message appears generally if all the 4 new fields are not added as required in step 2 in the readme:

2 - Add 4 fields to course_modules table
 
      linkid int(11) NOT NULL default '0',

      linkgrade int(11) NOT NULL default '0',

      linkname varchar(20) NOT NULL default '',

      linkfullname int(10) NOT NULL default '0',

Check very carefully the names of the fields and their types.

If problem persist, try to link a resource to your quiz instead of a certificate and let me know the  result.

Have a good debug,

Bernard

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Hi Ralph,

Here's more instructions on creating the tables.

Go to phpmyadmin (should be a link to it from your cpanel).  If you have more than one database, choose the one moodle is in.  Then click on the course_modules link on the left side. 

Toward the bottom of that page, you will see:  "Add new field"  change the number to 4 and click go.

Now add the 4 new fields with the info and save changes.  You should end up with the table looking like this:

Attachment table.gif
In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Hi Chardelle,

That is how I created the tables, but I must of missed something. I will double check tomorrow.

BTW – I was cleaning up my MS Outlook file folder and found the email you sent me sometime ago regarding 2CheckOut. For some reason Outlook sent it to my delete folder. I tried to respond, but your email bounced back! Thanks for the info. I think I will stick with PayPal, since it seems that it is not necessary to have any account with them to make payments.

Thanks again!

Ralph

PS – One last thing, what program did you use to capture the screen shot of phpmyadmin?

RB
In reply to Ralph Blakeslee

Re: Activities linking in meantime for Moodle 1.4

by Chardelle Busch -
Picture of Core developers

Hi Ralph,

Thanks for the update.  I moved my site to a new server on Friday, so you must have caught my email during the transition--its back up now.

For the screenshot, I have Macromedia MX so I use the photo editing (Fireworks) program it has.  I simply hit shift/print screen on my keyboard, then paste into Fireworks and cut down to size, etc.  This is also how I created all of the screenshots for my Getting Started course which I recently updated.

BTW, will you update us in the Business Uses course on your last post concerning certificate/quiz linking...

And if you continue to have problems, let me know, it works great for me.

CB

In reply to Chardelle Busch

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Thanks Chardelle. I have been using a little free program called Gadwin Print Screen.

Regarding the Business Uses posting: Were you referring to coder I had hired to link the quiz with my own certificate?

Ralph
In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Thanks Bernard! I will double check those table settings.

Ralph
In reply to Ralph Blakeslee

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Chardelle & Bernard:

Thanks so much for your help. Upon further inspection I found that I had placed the fields in the wrong table! That's what happens when you are trying to work at 4:30 AM!!!!!

Do either of you have any experience with passing parameters into a html based resource? I would like to pass into resource-html document the students last name, first name and the course title. I see that Moodle allows me to do this, but I am clueless as to how to set this up in my html document.

Again, thanks! You're the best!

Ralph
In reply to Ralph Blakeslee

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi Ralph,
             I am happy to see that activities linking is working for you.

For the passing of parameters, the best way, if you want to have higher chances to get an answer, is to precise your problem in the other forum.

One good way is to post the final html file you want to have and specifying what part of it should be "parameterized".   That way the question will be more clear.

I hope it may help,

Bernard


In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Ralph Blakeslee -
Bernard,

Thank you for your response. I have posted it several other forums (I am afraid that people might think I am a pain in the neck!!!) This is the missing piece of the puzzle before I can start using my site, so I am getting a little desperate!

I did not think of posting the html document along with my question. I think I will do that now.

Again, thanks for the help with the activity linking question.

Ralph
In reply to Ralph Blakeslee

Re: Activities linking in meantime for Moodle 1.4

by Paolo Oprandi -
I am in the process of adding this very helpful alteration.

However, I would like to check I have everything right.

First, I will explain what I want ideally:

I want students to do a lesson, which then releases a quiz.

(I am not sure if I need to do this as the lesson functionality may provide it for me, but I was having troubles with the lesson gradings.)

It all seems to work okay, except when I do the lesson followed by the quiz, the quiz grades don't seem to be recorded? Has anyone else had this experience?

Anyway thanks for this addition,

Paolo

p.s. Also the lesson has to be graded, right?
In reply to Paolo Oprandi

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi Paolo,
             I just retested it and it works fine with the lesson module too, if your version of activity linking correspond to your Moodle version. ( 1.4 and later for the lesson )

If the problem persist, please specify your versions.

Have a good testing,

Bernard


In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by David Gagnon -
I have done a few modifications to the linklib.php file that may come in handy.

1. Corrected the sql string so that a user that has taken a lesson multiple times will have their best score used for the release.

2. Restored the linked item completely when it is made available. It was previously useable, but displayed only as grey.

Sorry this was not done on the 7a version!

David Gagnon
In reply to David Gagnon

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi David,
              thanks for the modifications.
I will release it for 1.4.2 with yours changes and some enhancements in a couple of weeks probably.

Thanks,

Bernard

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Jay S -
My feet are still kind of wet, so bare with me.

I need some instructions on how to install the activity locking and the certificates. I cannot figure it out.
In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Paolo Oprandi -
Sorry for not getting back to you about this... It has never worked as I expected it. I will try David's upgrade and carry on testing it over Christmas.

I use moodle v1.4.1 and betalinking 0.7... Going to upgrade to 1.4.3 when it comes out.

Thanks, Paolo
In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Teresa Gibbison -
Hi Bernard

I'm relatively new to Moodle and would like to thank you for your linking files.  I have successfully used this on my personal test site and the team would now like to use linking on our production site.  What is the reasoning and/or pitfalls of doing this?

Our tertiary education institution currently has WebCT and will most probably move online courses to Moodle for next year - the biggest loss would be 'selective release' or linking activities, which is used extensively in our existing courses.

Thanks
Teresa
In reply to Teresa Gibbison

Re: Activities linking in meantime for Moodle 1.4

by Timothy Takemoto -
Dear Teresa
There are various discussions going on at once about selective release/activity linking. Releasing activities depending upon user action events is related to releasing activities depending upon calendar events.
http://moodle.org/mod/forum/discuss.php?d=16215
http://moodle.org/mod/forum/discuss.php?d=12511
http://moodle.org/mod/forum/discuss.php?d=9697
Perhaps there might be someway of getting everyone together in the hope that we might pool 15,000 USD?

Tim
In reply to Teresa Gibbison

Re: Activities linking in meantime for Moodle 1.4

by Bernard Boucher -
Hi Teresa,
the pitfallssad :
  • you are not sure that it will be available for next Moodle versions
  • it is not "backupable" with normal Moodle backup ( but you loose no activities, only the links to the predessessor )
  • each activity linked require approximatively the processing equivalent to 2 non linked activities

the reasoning:
  • in some occasions it is good to link activities
  • to replace WebCTwink
  • if you experience big problems on your production system copy the original php files and you will revert to a normal Moodle

I use it since one year, only at a small scale, 120 students, 2 courses , 6 groups and 2 teachers with about 5% of linked courses modules ( 10/225 ) and no problem of fiability.


Maybe others that are using it may post their "numbers" and their comments.


Have a good cogitation,


Bernard

In reply to Bernard Boucher

Re: Activities linking in meantime for Moodle 1.4

by Brent Eaton -
I was able to get the activity linking system to work with minimal effort, which is an accomplishment for a moodlenoob.  One issue, though:

I installed lesson_cdc (which works well by itself).  I cannot get a quiz to link to it.  You stated that  a "lesson" could link, but do I need to modify any code to get lesson_cdc to work in 1.4.3+ ?

Thanks for your help!

Brent