Nolink hack to put in every new lesson question

Nolink hack to put in every new lesson question

'mei a Chris Collman - 'aho
Number of replies: 4
Hi,
Looking to "adjust" lesson code so when I create a multiple choice question, the nolink html code gets inserted. It is getting tedious blocking the glossary entries links, which we do want to appear in Branch Tables but not in our questions.

It would be even better if there was an adjustment which would remove the glossary links anytime a student (or everybody for that matter) looked at a multiple choice question.

We created lessons and then realized that the glossary was giving away the answers to the questions. We send them back for a review if they missed a question.

Thanks Chris
Average of ratings: -
In reply to Chris Collman

Re: Nolink hack to put in every new lesson question

'mei a Joseph Rézeau - 'aho
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Chris,
The very same question is being asked regularly in the Quiz forum. I have suggested that the Quiz settings page/the Questions edit page should have a setting for enabling/disabling glossary links. That was back in May, 2006 and you took part in that discussion, Chris...wink
Ditto for the Lesson activity, then.
Joseph
In reply to Joseph Rézeau

Re: Nolink hack to put in every new lesson question

'mei a Chris Collman - 'aho
Hi Joseph,
I thought there WAS a switch in Quiz to turn off linking from Glossary in 1.9 or something, oops. I vaguely remember that discussion, I was just a little wet moodle then big grin.

Lesson-Quiz. Yes, while some of us would like to have an lesson interface with the question bank, did you say 2.0 ? evil

Well I guess I will have to follow your thoughtful links and refresh my memory, before the next power surge wipes it out again.

What about addpage.php in /mod/lesson/action . Looks like that is where a new question page is built. How to I insert text into the HTML code in contents on a LESSON_MULTICHOICE qtype ? Sorry being pushyMalimali

Thanks for all the work you do. Best Chris


In reply to Chris Collman

FYI;: Nolink hack to put in every new lesson question

'mei a Chris Collman - 'aho
Paul Evans wrote in part on 11 October 2004, 06:41 PM:
So, try this out if you like: edit the file filter.php in /mod/glossary. Locate function glossary_dynamic_link, which is right near the top and right after the line with 'global $CFG' put

// Nolink for quizzes (or any other word in the path you like)
 // $_SERVER['REQUEST_URI'] looks like e.g. : /mysite/mod/quiz/view.php?id=21
 if (strpos($_SERVER['REQUEST_URI'], "/quiz/")) {
 return $text;
 }

Paul in 12 October 2004, added
Also, notice that you can put anything in for the match, so you can make it finer grained by making the match longer e.g. '/quiz/foo.php' instead of just '/quiz/'.

2004 was way BC (before Chris was moodleing). I see Glossary still has a filter.php . Maybe it will still work. The real questions is can I figure out how to get it granular enough to recognize a specific type of lesson page, not just a call from lesson.php or ./lesson/view.php or what ever.


In reply to Chris Collman

Re: FYI;: Nolink hack to put in every new lesson question

'mei a Chris Collman - 'aho
Ok sports fans,
In 1.9 I found mod/glossary/filter.php. Right under global $CFG'
I put:

if (strpos($_SERVER['REQUEST_URI'], "/quiz/")) {
return $text;

Sweet, still works to turn off quiz. Somehow I don't think there is a call for viewing a lesson page type.

In other news, I see that the HTML tool automatically puts some code </br> I think. Humm, create a second tool just for questions, insert the nolink code there. That might even handle the answers nolinks as well. Oh well, the life of an ignorant hacker is never easy Malimali