Customize course view page

Customize course view page

by Mitesh Patel -
Number of replies: 3

I am using Moodle 2.5.7.

I have a course with 5 quizzes in it. I want to change the way quiz links appear when students goes to the course.

Currently it displays all activities in a course, which is fine. But I also want to display a green tick or red cross next to each quiz based on their last attempt. The tick/cross will only show next to quiz, not to any other activity.

What is the best way to achieve this? Do I need to edit Moodle core file or is there any other way e.g plugin or something.

Average of ratings: -
In reply to Mitesh Patel

Re: Customize course view page

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Can't you already do that with the Activity completion settings? (You might need to tweak the icon in your theme, if you want a green tick, instead of the standard icon)



In reply to Davo Smith

Re: Customize course view page

by Mitesh Patel -

Thank you for your reply Davo.

I didn't think of "Activity completion", thanks for pointing it out.

But I think it wouldn't work, as determining when to show cross/tick is different.

We have 2 extra fields in quiz settings. 

1: Compliance period (which can be 3,6,12,... months) 

2: Compliance % (which can be 50%,60%,70%... and so on)

What I want is, to show a green tick if a user has completed the quiz with more than x% in last y% months. Where x = Compliance period and y = Compliance % set in the quiz settings screen.

Can this be achieved with "Activity completion"? What else can be done to achieve this?

In reply to Mitesh Patel

Re: Customize course view page

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I keep forgetting that 'quiz' doesn't have a 'mark complete when a certain grade is achieved' setting. It really should have (although I'm sure the use of different grading scales makes that hard to implement generally).

No activities, that I'm aware of, give you the ability to mark something as complete, based on when the grade was achieved.

The best way to implement this, that I can think of, would be to turn on 'passed when submitted' for the quiz, then have a local script subscribe to the 'attempt_submitted' event (Moodle 2.7?) and manually set the completion status to pass or fail, as appropriate. You would then need a cron script to check this and set it to 'fail', if the grade was awarded too long ago.

I'm not quite sure if that can be made to work, certainly it wouldn't be easy to add configuration to the quiz settings page that way (you'd have to have either hard-coded, fixed settings for all quizzes, or you'd have to have an external settings page listing all quizzes).

The alternative, would be to edit the quiz module, to provide custom completion rules - https://docs.moodle.org/dev/Activity_completion_API is probably a good starting point.