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

Create API for report bulk actions

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_402_STABLE
    • Hide
      1. Edit reportbuilder/classes/local/systemreports/reports_list.php as follows:

        --- a/reportbuilder/classes/local/systemreports/reports_list.php
        +++ b/reportbuilder/classes/local/systemreports/reports_list.php
        @@ -67,6 +67,13 @@ class reports_list extends system_report {
                 // Select fields required for actions, permission checks, and row class callbacks.
                 $this->add_base_fields('rb.id, rb.name, rb.source, rb.type, rb.usercreated, rb.contextid');
         
        +        $this->set_checkbox_toggleall(static function(stdClass $row): array {
        +            return [
        +                $row->id,
        +                $row->name,
        +            ];
        +        });
        +
                 // Limit the returned list to those reports the current user can access.
                 [$where, $params] = audience::user_reports_list_access_sql('rb');
                 $this->add_base_condition_sql($where, $params);
        

      2. Log in as admin
      3. Navigate to Reports from user menu
      4. Create three new reports
      5. Navigate back to Reports listing page
      6. Confirm the table header contains a Select all checkbox for toggling all/none of the row checkboxes
      7. Confirm each report row has a checkbox
      8. Use your browser developer tools to inspect the checkbox of the report rows
      9. Confirm the checkbox value attribute is equal to the corresponding report ID
      10. Confirm the checkbox label element text is equal to the corresponding report name
      Show
      Edit reportbuilder/classes/local/systemreports/reports_list.php as follows: --- a/reportbuilder/classes/local/systemreports/reports_list.php +++ b/reportbuilder/classes/local/systemreports/reports_list.php @@ -67,6 +67,13 @@ class reports_list extends system_report { // Select fields required for actions, permission checks, and row class callbacks. $this->add_base_fields('rb.id, rb.name, rb.source, rb.type, rb.usercreated, rb.contextid'); + $this->set_checkbox_toggleall(static function(stdClass $row): array { + return [ + $row->id, + $row->name, + ]; + }); + // Limit the returned list to those reports the current user can access. [$where, $params] = audience::user_reports_list_access_sql('rb'); $this->add_base_condition_sql($where, $params); Log in as admin Navigate to Reports from user menu Create three new reports Navigate back to Reports listing page Confirm the table header contains a Select all checkbox for toggling all/none of the row checkboxes Confirm each report row has a checkbox Use your browser developer tools to inspect the checkbox of the report rows Confirm the checkbox value attribute is equal to the corresponding report ID Confirm the checkbox label element text is equal to the corresponding report name

      We should create a new API in Report Builder to allow to have bulk actions in system reports. Sometimes is useful to select several rows at once and apply some report action instead of going one by one.

            pholden Paul Holden
            davidcarrillo David Carrillo
            Carlos Castillo Carlos Castillo
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 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 - 4 hours, 54 minutes
                4h 54m

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