Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64999 block_myoverview: Replace / accompany the time-based course filter with a semantic course filter based on custom course fields
  3. MDL-66017

An admin can specify a course custom field as a filter for users to select in their Dashboard course overview

    XMLWordPrintable

    Details

      Description

      As a subtask of MDL-64999, this issue is about implementing the following improvement:

      • Add a setting "block_myoverview | displaygroupingcustomfield" as a checkbox setting to
        /admin/settings.php?section=blocksettingmyoverview.
        • Ideally, this setting is added between "block_myoverview | displaygroupingfuture" and "block_myoverview | displaygroupingstarred"
      • Add a setting "block_myoverview | customfiltergrouping" as a singleselect setting to /admin/settings.php?section=blocksettingmyoverview.
        • This setting is dependant with hide_if from ""block_myoverview | displaygroupingcustomfield" and only shown if this setting is shown.
        • This setting shows the titles of all existing custom course fields in the system.
        • This setting should ideally not have a particular custom course field selected, the admin should be urged to actively select one.
        • If there aren't any custom course fields in the system, it might be useful to show an explanation what custom course fields are and where they can be created and configured.
        • The admin can select one of the existing custom course fields.
      • If the admin has enabled "block_myoverview | displaygroupingcustomfield" and has selected a custom course field in "block_myoverview | customfiltergrouping", the course filter in block_myoverview gets new filter options:
        • These new filter options are added after the "Past" filter option
        • These new filter options are preceeded by a divider line
        • The filter options are user-dependent. For a particular user, the set of filter options is collected with this algorithm:
          • Collect the value of the custom course field of all courses which the user is enrolled into into a list.
          • Remove duplicates from the list
          • Generate output for the value of the custom course fields as not all course field types can be output directly. For now, a reasonable output could be:
            • Checkbox fields: Output "<Field name>: Yes" or "<Field name>: No"
            • Date and time fields: Output the timestamp as date string based on the local language pack
            • Dropdown menu fields: Output as defined in the course field
            • Short text fields: Output as defined in the course field
            • Text area fields: Output as defined in the course field, but shorten to a reasonable length and add an ellipsis.
          • Sort the list by a reasonable order for the particular custom course field type. For now, a reasonable order could be:
            • Checkbox fields: Order by "Enabled, disabled"
            • Date and time fields: Order by ascending time stamp
            • Dropdown menu fields: Order by their given order in the field definition from top to bottom
            • Short text fields: Order by ascending alphabet
            • Text area fields: Order by ascending alphabet
          • Add one course filter option per list entry to the course filter dropdown.
          • If there are courses where the custom field is empty or not set, add a filter option saying "No <Field name>" to the course filter.
      • Add a webservice, in addition to or as an enhancement of core_course_get_enrolled_courses_by_timeline_classification, which provided a course list filtered by a custom course field value.
      • The user will then be able to filter his courses in block_myoverview based on the custom course field values. Apart from the filter results, this filter will exactly behave like the other existing filter options.

      See a mockup to illustrate the proposal where

      • block_myoverview | displaygroupinginprogress would be enabled
      • block_myoverview | displaygroupingpast would be enabled
      • block_myoverview | displaygroupingfuture would be enabled
      • block_myoverview | displaygroupingcustomfield would be enabled
      • block_myoverview | customfiltergrouping would be set to a custom course field with "Dropdown menu field" type which contains a list of lecture terms

      See a mockup to illustrate the proposal where

      • block_myoverview | displaygroupinginprogress would be disabled
      • block_myoverview | displaygroupingpast would be disabled
      • block_myoverview | displaygroupingfuture would be disabled
      • block_myoverview | displaygroupingcustomfield would be enabled
      • block_myoverview | customfiltergrouping would be set to a custom course field with "Dropdown menu field" type which contains a list of lecture terms

      Notes:

      • The new block setting and the new filtering options should be covered with Behat tests

      It might make sense to create follow-up issues for these areas:

      • Add admin settings to let the admin better control the output of the course field values
      • Add admin settings to let the admin control the ordering of the course field values
      • Add support to even add values of multiple custom fields to the course filter dropdown
      • Deal with the case that a user's courses will have many (say 10+) different custom course field values which would let the list of filter options grow very long. Solution approaches could be:
        • Only create options for the first 10 field values (which is bad usability and not really deterministic)
        • Let the admin configure the particular custom field values of all existing custom field values which should appear in the filter (which has to be managed consistently)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                10 Vote for this issue
                Watchers:
                19 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 5 hours, 15 minutes
                  3d 5h 15m