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

In Course overview block, hidden course are not "dimmed" for teachers

    Details

    • Testing Instructions:
      Hide

      Login as a user that is assigned to multiple courses as a teacher.
      Set one of those courses to be hidden to users.
      Using a standard theme View the course overview block and check to make sure the hidden course appears "dimmed" in the interface compared with other courses in the site.

      Show
      Login as a user that is assigned to multiple courses as a teacher. Set one of those courses to be hidden to users. Using a standard theme View the course overview block and check to make sure the hidden course appears "dimmed" in the interface compared with other courses in the site.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:
      master_MDL-37968

      Description

      Usually, hidden courses are displayed to teachers but are dimmed (greyed). However, in the Course overview bloc, they are outputed as available course. In the renderer.php, there is no check on the course Visible property.

      I propose the following fix to the function course_overview of class block_course_overview_renderer :

      Just before these (line ~105):

      $attributes = array('title' => s($course->fullname));
      if ($course->id > 0) {
      				
                      $courseurl = new moodle_url('/course/view.php', array('id' => $course->id));
                      $coursefullname = format_string($course->fullname, true, $course->id);
      				
                      $link = html_writer::link($courseurl, $coursefullname, $attributes);
                      $html .= $this->output->heading($link, 2, 'title');
                  } else {
                      $html .= $this->output->heading(html_writer::link(
                          new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)),
                          format_string($course->shortname, true), $attributes) . ' (' . format_string($course->hostname) . ')', 2, 'title');
                  }
      

      add these:

      			
      $linkcss = $course->visible ? "" : "dimmed";
      $attributes = array('title' => s($course->fullname), 'class' => $linkcss);
      

      This way, we have the hidden course greyed out.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  11 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/Jul/13