Moodle
  1. Moodle
  2. MDL-37968

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

    Details

    • Rank:
      47744

      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.

        Issue Links

          Activity

          Hide
          Jean-Daniel Descoteaux 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
          Jean-Daniel Descoteaux 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 added a comment -

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

          Show
          Ellio M added a comment - The same issue exists for our installation. Confirming that your code change has successfully rectified it.
          Hide
          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
          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
          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
          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
          Heiko Schach added a comment -

          Here's the patch.

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

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

          Show
          Dan Marsden added a comment - pushing up for integration - thanks to Heiko and Jean-Daniel for the patches and report.
          Hide
          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
          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
          Dan Marsden added a comment -

          rebased.

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

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

          Show
          Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks a lot Dan
          Hide
          Petr Škoda added a comment -

          works fine, thanks

          Show
          Petr Škoda added a comment - works fine, thanks
          Hide
          Marina Glancy added a comment -

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

          Closing as fixed!

          Show
          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: