adding a new activity completion condition

adding a new activity completion condition

{$a->নাম} - {$a->তারিখ} দ্বারা
Number of replies: 2

Hi everyone,

I was wondering if it is possible to add a new activity completion condition to my plugins without doing any core hacks (by developing a new plugin to do so)?

Attachment completion.png
রেটিং এর গড়: -
In reply to Martin H

Re: adding a new activity completion condition

{$a->নাম} - {$a->তারিখ} দ্বারা
Core developers এর ছবি Documentation writers এর ছবি Particularly helpful Moodlers এর ছবি Peer reviewers এর ছবি Plugin developers এর ছবি

I think there are just two a few parts to implementing this:

  1. In the editing form for your activity, you need to add some extra settings to the code so that teachers can configure it. E.g. https://github.com/moodle/moodle/blob/master/mod/quiz/mod_form.php#L592
  2. Oh, and then another small function in the same class https://github.com/moodle/moodle/blob/master/mod/quiz/mod_form.php#L621
  3. In guess in some cases you may also need some extra validation.
  4. Then the second main part, in lib.php, to determine whether a user has completed the activity based on those settings https://github.com/moodle/moodle/blob/master/mod/quiz/lib.php#L1835

Official docs about this at https://docs.moodle.org/dev/Activity_completion_API#Custom_completion_rules

In reply to Tim Hunt

Re: adding a new activity completion condition

{$a->নাম} - {$a->তারিখ} দ্বারা

Thanks Tim for your reply.

But I don't want to add a new completion condition to just a single activity. I want the new condition to be available to "all" activities (and specially to the quiz activity).