Moodle
  1. Moodle
  2. MDL-9014

Improve display of block course_list

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Inactive
    • Affects Version/s: 1.7, 1.8, 1.9, 2.0
    • Fix Version/s: None
    • Component/s: Blocks
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Why: This few modifications to this block make it easier for those users that are enroled in many courses to find them using this block.

      How: It adds an extra line with the category name which the course belongs to, sorting them alphabetically inside.

      Code:
      /blocks/course_list/block_course_list.php:

      37 if (empty($CFG->disablemycourses) and
      38 !empty($USER->id) and
      39 !(has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) and $adminseesall) and
      40 !isguest()) { // Just print My Courses
      41 if ($courses = get_my_courses($USER->id,'category ASC, fullname ASC')) { //mu: Get courses sorted by category
      42 foreach ($courses as $course) {
      43 if ($course->id == SITEID)

      { 44 continue; 45 }

      46 if($cat == $course->category)

      { //mu: If I'm inside the same category, don't print category's name 47 $linkcss = $course->visible ? "" : " class=\"dimmed\" "; 48 $this->content->items[]="<a $linkcss title=\"$course->shortname\" ". 49 "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>"; 50 $this->content->icons[]=$icon; 51 continue; 52 }

      53 $cat = $course->category;
      54 $catname = get_record('course_categories', 'id', $cat);
      55 $this->content->items[] = "<strong>".$catname->name."</strong>";
      56 $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
      57 $this->content->icons[]='';
      58 $this->content->items[]="<a $linkcss title=\"$course->shortname\" ".
      59 "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
      60 $this->content->icons[]=$icon;
      61 }
      62 $this->title = get_string('mycourses');
      63 $this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
      64 if ($this->content->items)

      { // make sure we don't return an empty list 65 return $this->content; 66 }

      67 }
      68 }

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Martin Dougiamas added a comment -

            I like the concept. Currently the sorting sucks because it ignores category completely.

            Really the categories should be sorted to match their real sortorder in the category listing, but this would add even more database load on top of what this already does.

            Can someone come up with a nice way to sort categories and courses? It has to be efficient too (one SQL would be nice).

            Show
            Martin Dougiamas added a comment - I like the concept. Currently the sorting sucks because it ignores category completely. Really the categories should be sorted to match their real sortorder in the category listing, but this would add even more database load on top of what this already does. Can someone come up with a nice way to sort categories and courses? It has to be efficient too (one SQL would be nice).
            Hide
            Marina Glancy added a comment -

            We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible.

            ==BLK2YIMP20141121==

            Show
            Marina Glancy added a comment - We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible. ==BLK2YIMP20141121==
            Hide
            Pablo Etcheverry added a comment -

            Hi Marina! Looks like it gathered interest, but the final solution is implemented in MDL-35570, which is still open...

            Show
            Pablo Etcheverry added a comment - Hi Marina! Looks like it gathered interest, but the final solution is implemented in MDL-35570 , which is still open...

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: