Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60223

Subplugins do not maintain the original activity when implementing get_shortcuts()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 3.1.8, 3.2.5, 3.3
    • LTI External tool
    • MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
    • Hide

      1. Download the lti subplugin attached in this entry and place it in mod/lti/source

      2. Let Moodle install the plugin

      3. Go to a course, turn editing on and click on "Add an activity or resource". Check that the original External Tool activity does not appear in the list of activities anymore. Only the new LTI activity (called Sarlab) appears.

      4. Get the change in /course/lib.php described in this issue description (available from https://github.com/Ravenink/moodle/tree/MDL-60223).

      5. Repeat step 3 and see that both the original LTI activity and the new one (Sarlab) appear in the activity chooser.

      Show
      1. Download the lti subplugin attached in this entry and place it in mod/lti/source 2. Let Moodle install the plugin 3. Go to a course, turn editing on and click on "Add an activity or resource". Check that the original External Tool activity does not appear in the list of activities anymore. Only the new LTI activity (called Sarlab) appears. 4. Get the change in /course/lib.php described in this issue description (available from https://github.com/Ravenink/moodle/tree/MDL-60223 ). 5. Repeat step 3 and see that both the original LTI activity and the new one (Sarlab) appear in the activity chooser.

      If two or more items (returned by a plugin and its sub-plugins) in https://github.com/moodle/moodle/blob/master/course/lib.php#L689 have the same link url, that line of code would assign them the same name too. This was causing that only the last item would appear in the activity chooser. Replacing "? $modname : $modname" by "? $modname : $item->name" in the previously mentioned line of code, the items get different names and thus, we fix this issue.

      NEW ADDITIONAL INFO:

      The use case here is:

          1. I have an external tool activity subplugin that links to the same url as Moodle's external tool activity (so I don't have to reimplement all the LTI funcionality in my subplugin). This subplugin is still useful though because I can write a ltisource_pluginname_before_launch() function in the subplugins lib.php to, for example, rename the user roles the activity passes to the external tool based on the capabilities defined during the installation by this subplugin (see next, also included in the attached example).

      function ltisource_sarlab_before_launch() {
        global $USER;

        $context = context_system::instance();

        if (has_capability('ltisource/sarlab:createexp', $context, $USER)) {
          $role = 'Designer';
        } else if (has_capability('ltisource/sarlab:editexp', $context, $USER)) {
          $role = 'Manager';
        } else {
          $role = 'Unauthorized';
        }

        $params = array('roles' => $role);

        return $params;
      }

          2. I want to keep Moodle's original external tool activity, so it must still appear in the activity chooser with its original name.

          3. The new subplugin activity must also appear in the activity chooser so I can add a new LTI activity that connects to the external tool to which I want to send the custom user roles.

            Unassigned Unassigned
            ravenink Luis de la Torre
            Marina Glancy Marina Glancy
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.