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

lib/tablelib.php: Make flexible_table class better extendable

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_35_STABLE
    • MOODLE_35_STABLE
    • patch-2
    • Hide
      1. Create a course with over 100 participants (for example use "Make a test course")
      2. View course participants
      3. Make sure you can filter participants by clicking the letters in the initials bar (both first and last names)
      Show
      Create a course with over 100 participants (for example use "Make a test course") View course participants Make sure you can filter participants by clicking the letters in the initials bar (both first and last names)

      I'm currently writing a plugin in which I extend the class flexible_table. The base class has an option to display two "initials bars" that can be used for filtering by the initial of the first name or surname. You can either display both initials bars or none.

      However, I want to be able to let my users filter only by the initial of the surname, not the first name. I want to display only one of the two initials bars. This is possible by deriving from flexible_table and overriding the print_initials_bar method. But then I need to use get_initial_last to get the currently selected initial. However, that method is deprecated since Moodle 3.3. I can't access $prefs from the base class directly because it's private.

      I would like to have some non-deprecated way of achieving this without having too much redundant code in the end. I don't mind having to override one method. My suggestion would be to either:

      • make get_initial_last (and get_inital_first) protected and non-deprecated (reduces visibility of these methods; may break something)
      • make $prefs protected
      • change the class flexible_table itself to allow both bars to be enabled individually (changes the public interface; may break something)

      What would be the "best" solution? Does anyone have another suggestion?

        1. MDL-60681_Verified1.PNG
          55 kB
          Gladys Basiana
        2. MDL-60681_Verified2.PNG
          55 kB
          Gladys Basiana
        3. MDL-60681_Verified3.PNG
          41 kB
          Gladys Basiana

            tschroeder Tim Schroeder
            do-you-even-curl do-you-even-curl
            Marina Glancy Marina Glancy
            Andrew Lyons Andrew Lyons
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

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