Best practice forum (Archived)

End of lesson congratulations editing

 
? ?
End of lesson congratulations editing
by ? ? - Tuesday, 29 May 2012, 3:02 PM
 

Hi there,

I was hoping someone knows how to edit the last page of lesson when you complete it:

nc0bd3.jpg

We would like to change the color of the text or better yet swap it out for an image. 

Thanks in advance, 

Matt.

This forum post has been removed
Thursday, 31 May 2012, 4:50 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: End of lesson congratulations editing
by ? ? - Monday, 4 June 2012, 8:36 PM
 

Wonderful, thanks. 

Is going to be possible to say show an image for the first 4 modules of the lesson, 

eg. Image > Congrats, please click below to continue. 

Last module in the lesson, number 5 only.

eg. Image > Congrats you have completed this lesson. 

Cheers, 

Matt.

This forum post has been removed
Tuesday, 5 June 2012, 1:44 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: End of lesson congratulations editing
by ? ? - Monday, 11 June 2012, 2:36 PM
 

Is there a way i can change the language file used for specific lessons? 

This forum post has been removed
Tuesday, 12 June 2012, 6:25 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: End of lesson congratulations editing
by ? ? - Tuesday, 12 June 2012, 9:41 PM
 

Hi Haydn, 

I have worked out a way to get the effect we are wanting but probably not the best way. 

What ive done is edit the lesson.php language file with the following changes.

Congratulations - end of lesson reached
congratulations

======================================================

<img id="normal" src="http://skills4work.ac.nz/file.php/2/Congratulations_image.png">
<img id="last" src="http://skills4work.ac.nz/file.php/2/End_Congratulations_image.png" style="display:none; text-align:center">

======================================================

Return to $a

returnto

======================================================

Return to $a

<div id="lastwording" style="text-align:center; padding:5px; display:none" class="lessonbutton standardbutton"><a href="http://skills4work.ac.nz/course/view.php?id=2">Finish</a></div>

======================================================

Added the following into the header.

function func1(){

if(location.href == 'http://skills4work.ac.nz/mod/lesson/view.php?id=5&pageid=-9')
{
document.getElementById('normal').style.display = "none";
document.getElementById('last').style.display = "";
document.getElementById('wording').innerHTML = '<a href="http://skills4work.ac.nz/course/view.php?id=2"> Finish </a>';
}
}

And then edited the file /mod/lesson/view.php

echo "<div style=\"text-align:center; padding:5px;\" id=\"wording\" class=\"lessonbutton standardbutton\"><a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".get_string('returnto', 'lesson', format_string($course->fullname, true))."</a></div>\n";

When the user visits that page URL, which is the last page in the last module, the image is changed to the "Course finished" image, rather than "Module complete" image. The button that usually says "Return to $a" changes to Finish. This is all done in the javascript by using the ID and swapping them out. However, this is quite slow and can sometimes be seen by the image flashing and button moving around resizing.

The main reason I had to make the change to the view.php code (which will now stop upgrades from being simple, i guess?) is because i couldnt just replace the wording "Return to $a" as it left a <a href> tag there and a half box was drawn. 

Forgive me if this seems to be the worst way around getting the desired effect but thats all I could think of to make it work at the time. 

So, how could this be done, without making core code changes? And if what you just mentioned above will do the same thing but using the language files, how is that done, im still a little confused of where and how i use a multi-language filter.

Thanks again, 

Matt.