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

Unexpected property theme when assign user roles to cohort

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 3.5
    • 3.5
    • Cohorts
    • MOODLE_35_STABLE
    • MOODLE_35_STABLE
    • MDL-62018-master
    • Hide

      Setup

      1. Login as admin
      2. Access to "Site administration | Users | Accounts | Cohorts" and create a cohort ("Cohort 1")
      3. Access to "Site administration | Users | Permissions | Define roles" and edit some of the existing roles (for instance, "editingteacher")
      4. Check the "User" option in the "Context types where this role may be assigned" setting.

       

      Testing scenario

      1. Login as admin
      2. Access to "Site administration | Users | Permissions | Assign user roles to cohort".
      3. Select a user ("t1", for instance), select a role ("editingteacher"), select a cohort ("Cohort 1") and click over the "Assign" button.
        • CHECK no error is shown
        • CHECK also the assigned user data is displayed in a table below the "Existing cohort role assignments"
      Show
      Setup Login as admin Access to "Site administration | Users | Accounts | Cohorts" and create a cohort ("Cohort 1") Access to "Site administration | Users | Permissions | Define roles" and edit some of the existing roles (for instance, "editingteacher") Check the "User" option in the "Context types where this role may be assigned" setting.   Testing scenario Login as admin Access to "Site administration | Users | Permissions | Assign user roles to cohort". Select a user ("t1", for instance), select a role ("editingteacher"), select a cohort ("Cohort 1") and click over the "Assign" button. CHECK no error is shown CHECK also the assigned user data is displayed in a table below the "Existing cohort role assignments"

      There is an error when you want to access to "Assign user roles to cohort". I attach a screen capture of the error.

      Stack trace:
       
          line 145 of /lib/classes/external/exporter.php: coding_exception thrown
          line 102 of /admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php: call to core\external\exporter->export()
          line 821 of /lib/tablelib.php: call to tool_cohortroles\output\cohort_role_assignments_table->col_cohortname()
          line 1514 of /lib/tablelib.php: call to flexible_table->format_row()
          line 1637 of /lib/tablelib.php: call to table_sql->build_table()
          line 91 of /admin/tool/cohortroles/index.php: call to table_sql->out()
      I think that the error is in the function *col_cohortname* located in  *admin/tool/cohortroles**/classes/output/cohort_role_assignments_table.php.*
      

      This function has an exporter instance of uses cohort_summary_exporter and this has a new param named "theme" and this param is missing in the function.
      This is the code of the function:

      protected function col_cohortname($data) {
              global $OUTPUT;
       
              $record = (object) array(
                  'id' => $data->cohortid,
                  'idnumber' => $data->cohortidnumber,
                  'description' => $data->cohortdescription,
                  'visible' => $data->cohortvisible,
                  'name' => $data->cohortname,
              );
      $context = context_helper::instance_by_id($data->cohortcontextid);
      $exporter = new \core_cohort\external\cohort_summary_exporter($record, array('context' => $context));
      ...
      

      It seems an easy fix to add 'theme' => null to the $record.

            sarjona Sara Arjona (@sarjona)
            cescobedo Carlos Escobedo
            Carlos Escobedo Carlos Escobedo
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            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 - 21 minutes
                21m

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