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

          Issue Links

            Activity

            Hide
            jackdaniels JD added a comment -

            I setup my git repository following the http://docs.moodle.org/dev/Git_for_developers. Hopefully, I did everything ok. I is easier to post a diff than copying-pasting lines of code... however, I don't know the next step, I don't seem to be able to change the status of this bug to ask for a peer review.

            Show
            jackdaniels JD added a comment - I setup my git repository following the http://docs.moodle.org/dev/Git_for_developers . Hopefully, I did everything ok. I is easier to post a diff than copying-pasting lines of code... however, I don't know the next step, I don't seem to be able to change the status of this bug to ask for a peer review.
            Hide
            ellio_m Ellio M added a comment -

            The same issue exists for our installation. Confirming that your code change has successfully rectified it.

            Show
            ellio_m Ellio M added a comment - The same issue exists for our installation. Confirming that your code change has successfully rectified it.
            Hide
            sstrauss@haverford.edu Sharon Strauss added a comment -

            I just want to comment that I think this is a major bug. Faculty need a quick way to identify whether students can see a course. Note that, as of today, 6 people have voted this important.

            Show
            sstrauss@haverford.edu Sharon Strauss added a comment - I just want to comment that I think this is a major bug. Faculty need a quick way to identify whether students can see a course. Note that, as of today, 6 people have voted this important.
            Hide
            schach Heiko Schach added a comment - - edited

            Indeed this bug is very annoying for teachers as in course overview there currently is no way of figuring out if a course is available to students or not.

            Before Moodle 2.4 dimming was handled by the print_overview() function in course/lib.php.

            Jean-Daniel's fix works as expected.
            This bug can also be fixed by adding three lines copied from the print_overview() function in course/lib.php to blocks/course_overview/renderer.php.

            Show
            schach Heiko Schach added a comment - - edited Indeed this bug is very annoying for teachers as in course overview there currently is no way of figuring out if a course is available to students or not. Before Moodle 2.4 dimming was handled by the print_overview() function in course/lib.php. Jean-Daniel's fix works as expected. This bug can also be fixed by adding three lines copied from the print_overview() function in course/lib.php to blocks/course_overview/renderer.php.
            Hide
            schach Heiko Schach added a comment -

            Here's the patch.

            Show
            schach Heiko Schach added a comment - Here's the patch.
            Hide
            danmarsden Dan Marsden added a comment -

            pushing up for integration - thanks to Heiko and Jean-Daniel for the patches and report.

            Show
            danmarsden Dan Marsden added a comment - pushing up for integration - thanks to Heiko and Jean-Daniel for the patches and report.
            Hide
            poltawski Dan Poltawski added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            poltawski Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            danmarsden Dan Marsden added a comment -

            rebased.

            Show
            danmarsden Dan Marsden added a comment - rebased.
            Hide
            poltawski Dan Poltawski added a comment -

            Integrated to master, 25 and 24 - thanks a lot Dan

            Show
            poltawski Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks a lot Dan
            Hide
            skodak Petr Skoda added a comment -

            works fine, thanks

            Show
            skodak Petr Skoda added a comment - works fine, thanks
            Hide
            marina Marina Glancy added a comment -

            Thanks for your awesome work! This has now become a part of Moodle.

            Closing as fixed!

            Show
            marina Marina Glancy added a comment - Thanks for your awesome work! This has now become a part of Moodle. Closing as fixed!

              People

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

                Dates

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