How to get Quiz id in quiz page (just get course module id)

Re: How to get Quiz id in quiz page (just get course module id)

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

That page can work with either $q or $id, and very rapidly computes the other from the one it has. That is a very common pattenr in the Moodle code for all activity modules. In the course_modules table, the instance column has the quiz.id.

In reply to Tim Hunt

Ynt: Re: How to get Quiz id in quiz page (just get course module id)

by Tansu PANCAR -
Hello Tim,
I have a problem about Restrict Access function in Moodle. We are using many restrictions in our course based on comletion and grades and I am trying to tabulate restriction structure for previous courses.

Within Moodle, when I edit an activity and add restrictions for Grade and Completion. I can see the id`s of both items (the quiz whose access is restricted(mod/quiz/view.php?id=39438) and the prerequisite item (mod/quiz/view.php?id=38594))
When I check the mdl_course_modules table and investigate the availability column, for the completion restriction everything is clear, I can see the restriction from the query:
id availability
39438 {"op":"&","c":[{"type":"completion","cm":38594,"e":1}],"showc":[true]}

But when I add a restriction on grade to be minimum 75 for the same quiz:
id availability
39438 {"op":"&","c":[{"type":"grade","id":7981,"min":75}],"showc":[true]}


I couldn`t understand the meaning of id:7981,
When I check, mdl_course_modules table, I find the instance as 6684

From mdl_quiz table, when I check for id 6684, I see the correct quiz, not a quiz with ID 7981.
In reply to Tansu PANCAR

Re: Ynt: Re: How to get Quiz id in quiz page (just get course module id)

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 am guesing, but for grade restrictions, it is probably the grade_item id.
In reply to Tim Hunt

Ynt: Re: Ynt: Re: How to get Quiz id in quiz page (just get course module id)

by Tansu PANCAR -
Hello Tim,
Thanks for the quick reply.
It is in the mdl_grade_items table as you said.