Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Plagiarism
    • Labels:
    • Testing Instructions:
      Hide

      This can only be tested by a developer, no core code calls these functions.
      Also - the existing plagiarism plugins don't make use of this parameter (yet) - once this patch is accepted we'll patch the plugins to use the new param.

      Show
      This can only be tested by a developer, no core code calls these functions. Also - the existing plagiarism plugins don't make use of this parameter (yet) - once this patch is accepted we'll patch the plugins to use the new param.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      master_MDL-34593_add_extra_plugin_param_to_get_form_elements_module

      Description

      now that we've added hooks to various plugins we're finding the current method of obtaining the current module type is a bit fragile.

      We need to add an extra param to plagiarism_get_form_elements_module() called $plugin which contains the $module->component (frankenstyle name) - so in mod forum it would look like this:
      plagiarism_get_form_elements_module($mform, $ctx->get_course_context(), 'mod_forum');

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            danmarsden Dan Marsden added a comment -

            adding Kanika here - Kanika can you create a patch to add this to the lib/plagiarismlib.php and in the places it calls it from the modules? - thanks!

            Show
            danmarsden Dan Marsden added a comment - adding Kanika here - Kanika can you create a patch to add this to the lib/plagiarismlib.php and in the places it calls it from the modules? - thanks!
            Hide
            kanikagoyal Kanika Goyal added a comment -

            Hi Dan,
            Can I do this once all modules will be integrated? To add the extra param in all modules?

            Thanks,
            Kanika

            Show
            kanikagoyal Kanika Goyal added a comment - Hi Dan, Can I do this once all modules will be integrated? To add the extra param in all modules? Thanks, Kanika
            Hide
            danmarsden Dan Marsden added a comment -

            fine by me! - thanks.

            Show
            danmarsden Dan Marsden added a comment - fine by me! - thanks.
            Hide
            kanikagoyal Kanika Goyal added a comment -
            Show
            kanikagoyal Kanika Goyal added a comment - Hi Dan, I have added this. Here is the patch - https://github.com/kanikagoyal/moodle/compare/master_MDL-34593_add_extra_plugin_param_to_get_form_elements_module Thanks, Kanika
            Hide
            danmarsden Dan Marsden added a comment -

            cool - can you add phpdoc for the extra param and lets make it default to '' so that if other custom modules call those functions it doesn't throw a nasty error. can you also rename "$modulename" to $plugin ?

            so:
            function plagiarism_get_form_elements_module($mform, $context, $plugin = '') {

            thanks!

            Show
            danmarsden Dan Marsden added a comment - cool - can you add phpdoc for the extra param and lets make it default to '' so that if other custom modules call those functions it doesn't throw a nasty error. can you also rename "$modulename" to $plugin ? so: function plagiarism_get_form_elements_module($mform, $context, $plugin = '') { thanks!
            Hide
            kanikagoyal Kanika Goyal added a comment -

            Hi Dan,
            We cannot rename it to $plugin as it conflicts in lib/plagiarismlib.php which is using $plugin as -
            foreach($plagiarismplugins as $plugin => $dir) {

            I have updated the code to use "".
            Let me know if further modification is required.

            Thanks,
            Kanika

            Show
            kanikagoyal Kanika Goyal added a comment - Hi Dan, We cannot rename it to $plugin as it conflicts in lib/plagiarismlib.php which is using $plugin as - foreach($plagiarismplugins as $plugin => $dir) { I have updated the code to use "". Let me know if further modification is required. Thanks, Kanika
            Hide
            danmarsden Dan Marsden added a comment -

            heh - of course! - only thing missing now is a phpdoc comment in the function header to state what $modulename contains

            Show
            danmarsden Dan Marsden added a comment - heh - of course! - only thing missing now is a phpdoc comment in the function header to state what $modulename contains
            Hide
            kanikagoyal Kanika Goyal added a comment -

            done

            Show
            kanikagoyal Kanika Goyal added a comment - done
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility!

            Many thanks for your collaboration, yay!

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility! Many thanks for your collaboration, yay! Closing, ciao

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/12