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

Add foundation for tool placements

XMLWordPrintable

    • MOODLE_500_STABLE
    • MDL-84415-main
    • Hide

      Upgrade test (unit tested, this is just a sanity check of the real upgrade process)

      1. Make sure you have a site with at least one configured tool, and that the tool has been used in at least one course (i.e. we have an LTI activity somewhere).
      2. Checkout 07881a5772 (release before the feature branch)
      3. Run the upgrade and confirm there aren't any errors.
      4. Via the DB, get the lti instance ids:

      select id from mdl_lti;
      

      5. Via the DB, get the lti_resource_link ids:

      select id from mdl_lti_resource_link;
      

      6. Verify you see the exact same list of ids for both queries above. Everything must match.
      7. Run

      select * from mdl_lti_placement_type;
      

      8. Verify you see the single 'mod_lti:activityplacement' placement type has been loaded in during site upgrade.
      9. Add an incorrectly formatted placement type to mod/lti/db/lti.php (e.g not of the format COMPONENT:TYPENAME) and bump the version number + run upgrade.
      10. You should see debugging called during upgrade. Depening on the value of the following CFG vars for your site:

      $CFG->debug_developer_debugging_as_error = false;
      $CFG->debug_developer_use_pretty_exceptions = false;
      

      you'll either get an exception, or a debugging notice during upgrade.
      11. Again, in the DB, run:

      select * from mdl_lti_placement_type;
      

      12. Verify you DO NOT see the badly formatted placement type. I.e. it should have been reported and skipped during site upgrade.

      Install test:

      1. checkout a fresh site, and apply this patch BEFORE install.
      2. Run the install.
      3. When install completes, run, via your DB:

      select * from mdl_lti_placement_type;
      

      4. Verify you see the single 'mod_lti:activityplacement' placement type has been loaded in during site install.

      Show
      Upgrade test (unit tested, this is just a sanity check of the real upgrade process) 1. Make sure you have a site with at least one configured tool, and that the tool has been used in at least one course (i.e. we have an LTI activity somewhere). 2. Checkout 07881a5772 (release before the feature branch) 3. Run the upgrade and confirm there aren't any errors. 4. Via the DB, get the lti instance ids: select id from mdl_lti; 5. Via the DB, get the lti_resource_link ids: select id from mdl_lti_resource_link; 6. Verify you see the exact same list of ids for both queries above. Everything must match. 7. Run select * from mdl_lti_placement_type; 8. Verify you see the single 'mod_lti:activityplacement' placement type has been loaded in during site upgrade. 9. Add an incorrectly formatted placement type to mod/lti/db/lti.php (e.g not of the format COMPONENT:TYPENAME) and bump the version number + run upgrade. 10. You should see debugging called during upgrade. Depening on the value of the following CFG vars for your site: $CFG->debug_developer_debugging_as_error = false; $CFG->debug_developer_use_pretty_exceptions = false; you'll either get an exception, or a debugging notice during upgrade. 11. Again, in the DB, run: select * from mdl_lti_placement_type; 12. Verify you DO NOT see the badly formatted placement type. I.e. it should have been reported and skipped during site upgrade. Install test: 1. checkout a fresh site, and apply this patch BEFORE install. 2. Run the install. 3. When install completes, run, via your DB: select * from mdl_lti_placement_type; 4. Verify you see the single 'mod_lti:activityplacement' placement type has been loaded in during site install.
    • Hide

      Fails against automated checks.

      Checked MDL-84415 using repository: https://github.com/snake/moodle

      • main [branch: MDL-84415-main | CI Job]
        • Warn: The MDL-84415-main branch at https://github.com/snake/moodle has not been rebased recently (>20 days ago).
        • Error: The MDL-84415-main branch at https://github.com/snake/moodle does not apply clean to origin/main
        • Error: Merge conflict(s) in file(s):
        • Error: course/lib.php
        • Error: course/tests/externallib_test.php
        • Error: lib/classes/navigation/views/secondary.php
        • Error: lib/db/upgrade.php
        • Error: lib/navigationlib.php
        • Error: theme/boost/style/moodle.css
        • Error: theme/classic/style/moodle.css
        • Error: version.php

      Should these errors be fixed?

      Built on: Fri Mar 7 03:51:49 UTC 2025

      Show
      Fails against automated checks. Checked MDL-84415 using repository: https://github.com/snake/moodle main [branch: MDL-84415-main | CI Job ] Warn: The MDL-84415 -main branch at https://github.com/snake/moodle has not been rebased recently (>20 days ago). Error: The MDL-84415 -main branch at https://github.com/snake/moodle does not apply clean to origin/main Error: Merge conflict(s) in file(s): Error: course/lib.php Error: course/tests/externallib_test.php Error: lib/classes/navigation/views/secondary.php Error: lib/db/upgrade.php Error: lib/navigationlib.php Error: theme/boost/style/moodle.css Error: theme/classic/style/moodle.css Error: version.php Should these errors be fixed? Built on: Fri Mar 7 03:51:49 UTC 2025
    • 5
    • Team Alpha - Sprint 1 I1-2025, Team Alpha - Sprint 2 I1-2025

      We've gotten to the point where we need to introduce a basic implementation for tool placements, so that we can start to properly build out some of the placement-specific functionality.

      Some examples of issues that start to touch on placements are:

      • MDL-83954 (the tool placement needs to be passed through deep linking and core needs to ask the placement implementation to participate in access control checks)
      • [MDL-83509, MDL-81864]: Soon, resource links will be tied to specific placements (or, at least will be created via them). We need the relevant placements data structures to support this link between resource links and placements. Backup and restore also needs to be aware of the placement structures so it can properly restore placements when restoring course tools (site tools are not backed up nor restored).

      This issue is scoped with adding the initial placements implementation.

      At the high level, this involves adding the foundations for the 'placement type' and 'placement' concepts:

        • A 'placement type' is just a unique string, e.g. 'mod_lti:activityplacement' and represents the potential use of the LTI tool somewhere. Somewhere the LTI tool appears, basically (e.g. as an activity, in course navigation, in the editor, etc). Components can advertise placement types if they use LTI somehow, and core can also advertise placements for any tool uses that may live in core code.
        • A 'placement' is a mapping of tool:placementtype and can be thought of as additional configuration for the tool. A placement is configured as part of tool configuration as a way to say "This tool can be used in <some area>". A tool can support many placements, depending on where it's expected to be used.

      More specifically, this includes:

      • New tables for placement type and placement
      • Add the mechanism for components to register their placement types with core_ltix
      • Add the placement type 'mod_lti:activityplacement' to mod_lti (+ make sure it's registered with core_ltix)
      • Add an upgrade step to add a placement (a tool:placementtype map) between every tool and the 'mod_lti:activityplacement' placement type. This is essential because, up until now, a tool is assumed to have been usable as an activity, and we need to maintain this. This is a data-only change. No UI needed yet.

      I think there's also a few separate pieces of work needed to:

      • Add some minimal UI, allowing placements to be configured at the tool config screens.
      • automatically enable/check the 'mod_lti:activityplacement' for any new tools being created (or provide form defaults during creation).

      but I think these can be done in related issues. For this issue, it's more around the data structures and basic registration mechanism.

            jaked Jake Dallimore
            jaked Jake Dallimore
            Mihail Geshoski Mihail Geshoski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 4 hours, 30 minutes
                1w 4h 30m

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