Quiz/Section Heading/Description Query

Quiz/Section Heading/Description Query

by William Scott -
Number of replies: 4

Hi,

First of all, I'm using Moodle 2.7.1 (Build: 20140714).

I would like to know if there is a way of getting the information stored in the topic / topic heading, into a quiz description via php/etc.

See the attached image as an example.

  • In the image I typed in that.

Or even better, to precede the activity name if the Section/Topic name was to also be displayed.

Is this possible?

Attachment q1.jpg
Average of ratings: -
In reply to William Scott

Re: Quiz/Section Heading/Description Query

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I think the easiest think would be to just manually type the information you want into the Description field in the quiz setting.

If you really want to do this automatically, you might be able to do this by overriding the quiz renderer. See http://docs.moodle.org/dev/Overriding_a_renderer in the developer docs.

In reply to Tim Hunt

Re: Quiz/Section Heading/Description Query

by William Scott -

Thanks smile

Now I just need to figure out how to do it! lol

In reply to Tim Hunt

Re: Quiz/Section Heading/Description Query

by William Scott -

Any guidance regarding this? I can't seem to wrap my head around it very well.

Obviously the part I am looking for is under /mod/quiz/renderer.php but the course topic name/description is under /course/renderer.php.

In reply to William Scott

Re: Quiz/Section Heading/Description Query

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You probably need to override the view_page method in the quiz renderer. Or perhaps view_information.

You can get the information about sections using

$modinfo = get_fast_modinfo($course);

or

$modinfo = get_fast_modinfo($quiz->course);

That returns a big data structure that includes the information you need.