I cannot help you with this but wanted to ask a question.
Is this going to be a block that a teacher/admin could put content or a script in and can be given any name (similar to phpNuke)? Of course in phpNuke you do not have multiple instances of phpNukes like you do courses in Moodle.
WP1
Re: Code to make block have a different title for each course ?

I very like your "faith calendar", and i'd like to use it in my site.
but the truth is that i need only it's "hebrew section", that is, the hebrew date. and i got into your code.... but didn't succeed to take the other two dates away and leave only the hebrew one. could you please send me the correct code to do that?
thanx so much,
daniEl
Re: Code to make block have a different title for each course ?

Re: Code to make block have a different title for each course ?
Hi Jan,
I tried your block last week and thought it was great. This feature is a great way to add stickiness to courses. The new changes you have made will make it much more useable, but a couple of things: You might already be aware of a problem, but, I just uploaded the newest version and when I clicked on the "Change settings for this block" link I get this error message: Could not insert new record in database
Also, so we can keep track as you make changes, would you please add a version/date to your php files (and give yourself credit by adding your name too!) .
Chardelle
Re: Code to make block have a different title for each course ?
What you want to do is edit your block's constructor (the function with the same name as the block), and instead of setting $this->title unconditionally, set it according to the $course parameter. $course is a db record of the course your block is going to be displayed in. You can see an actual example of this in the course_summary block, which has a different title depending on whether it's being displayed on the front page or in another course.
An important tip here is to remember that sometimes (when Moodle creates a block not to display it, but for internal testing purposes), $course may be NULL. You should take this into account and not write code like the following:
if($course->id == 2) { ... }
but instead do:
if(!empty($course) && $course->id == 2) { ... }
to avoid PHP warnings if $course is NULL and thus $course->id is not defined. Finally, it's very important to make absolutely sure that there is an unconditional branch that ensures your block is given a title no matter what $course is.
Re: Code to make block have a different title for each course ?
Re: Code to make block have a different title for each course ?
Thanks for this. It will be great for both content and language courses. I will add a "mot du jour" block next semester.
Best,
Steven
PS It appeared the database was updated when I installed the latest version. But I'm still getting the same warning. Any ideas?
Re: Code to make block have a different title for each course ?
Re: Code to make block have a different title for each course ?
I'm excited about getting your contribution operational. So my gratitude extends to you. For next term, I'd love to have the students create an on-going lexicon as part of their homework.
Back to the topic at hand; I do see the link for changing settings, but when I click on it, the "could not create new item in database" warning stops the process (as Chardelle noted above). The version is your 8/15 file, so I'm not sure what exactly the problem is. I will post a screenshot of my database.
Love your profile picture. Thanks again, and next time I'm in Belgium the ale is on me.
Steven
PS Well, there is no mdl_block_quote, which explains things. Can I create a new table by pasting the contents of the mysql.php file?
Re: Code to make block have a different title for each course ?
Thanks so much for doing this Jan!
Best,
Steven
Re: Code to make block have a different title for each course ?
Many thanks for this code!
Nicolas
PS Pay attention that your files have DOS line endings!
Re: Code to make block have a different title for each course ?

