General developer forum

For Essay type question need to disable Editor after submiting the question in moodle quiz

 
Tim at Lone Pine Koala Sanctuary
Re: For Essay type question need to disable Editor after submiting the question in moodle quiz
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Essay qustions cannot use 'immediate feedback' because Moodle cannot grade the response. Therefore, whatever behaviour you select in the quiz settings, essay questions will use 'manual graded' behaviour (which is not an option in the UI, but exists behind the scenes.)

https://github.com/moodle/moodle/tree/master/question/behaviour/manualgraded

The way the code-flow works is that when a question is started, the question object is asked "This quiz wants to use X behaviour, please make an instance of the appropriate behaviour for your question type". For essay the logic is this:

https://github.com/moodle/moodle/blob/master/question/type/essay/question.php#L55

Here is another example of the kind of thing that can be done

https://github.com/moodle/moodle/blob/master/question/type/questionbase.php#L736

So, the correct way to implement what you are trying to do is to make a new behaviour "manualgraded_with_check". Then, change the make_behaviour method in the essay question type to use that behaviour, instead of manualgraded, when the preferred behaviour is one like immediate feedback.

(Probably the best way to determine "when the preferred behaviour is one like immediate feedback" is to call question_engine::can_questions_finish_during_the_attempt($preferredbehaviour).)

 
Average of ratings: -