Courses lists upgrade to 2.5: Difference between revisions
Line 18: | Line 18: | ||
'''Site Administration -> Appearence -> Navigation''' | '''Site Administration -> Appearence -> Navigation''' | ||
* Sort my courses ($CFG->navsortmycoursessort): This is a new setting that defines sorting criterion for enrolled courses both in navigation menu and 'My courses' list on frontpage. Hidden courses are shown in the end of the list (if user can see them). | |||
'''Site Administration -> Front page -> Front page settings''' | '''Site Administration -> Front page -> Front page settings''' |
Revision as of 02:58, 25 March 2013
There are significant changes in course-related functions and UI in 2.5. This document is aimed to assist migration from 2.4 to 2.5. This is NOT a complete documentation on 2.5 features.
Site administrators
Course management pages
Pages that display lists of courses and course categories do not have editing mode any more: /course/index.php, /course/category.php, /course/search.php. Courses and categories can be managed on /course/manage.php. Swithching editing mode on and off will not make changes. Although we tried to keep button to jump to manage page at the same place. Site Administration -> Courses -> Add/edit courses links to new management page as well.
Administrative settings
Some settings that changed their behaviour in Moodle 2.5:
Site Administration -> Appearence -> Courses
- Course contacts ($CFG->coursecontacts): Please note that only users enrolled in the course are shown as course contacts in Moodle 2.5
- Courses per page ($CFG->coursesperpage): This number now affects pagination for both subcategories and courses on course category page, limits the number of subcategories and/or courses in categories list or combo list on frontpage and pagination of course search results.
Site Administration -> Appearence -> Navigation
- Sort my courses ($CFG->navsortmycoursessort): This is a new setting that defines sorting criterion for enrolled courses both in navigation menu and 'My courses' list on frontpage. Hidden courses are shown in the end of the list (if user can see them).
Site Administration -> Front page -> Front page settings
(The following settings make no effect if your site has custom front page or front page is redirected to /my/)
- Front page ($CFG->frontpage):
- Front page items when logged in ($CFG->frontpageloggedin):
- Maximum category depth ($CFG->maxcategorydepth): this number affects both categories list and combo list. Do not set it high because now users are able to expand subcategories with Javascript sending AJAX requests to the server
Plugin developers
The following functions are deprecated in Moodle 2.5. Their code is moved to /lib/deprecatedlib.php . The most of them are unlikely to be used outside of moodle core but if your plugin uses them please use new functions from coursecat class or functions from core_course_renderer.
Moodle 2.4 | Moodle 2.5 |
---|---|
Theme developers
All course listings are now performed through the same renderer functions.
There are significant changes to CSS classes used. Go through your .css files in the themes and look for the following styles:
.coursebox
.courseboxes
.course_category_tree
.categorylist
table.category_subcategories
.categorybox
.categoryboxcontent
- page-course-info
- page-course-enrol /* also this is now #page-enrol-index */
- page-course-index
- page-course-category
If you found any of those unfortunately you will need to do changes to your theme.
Also if your theme overrides core_course_renderer::course_category_tree() or core_course_renderer::course_category_tree_category() you will also need to make changes.
Pages that are affected by the new renderer functions
To test your theme make sure that your site has several course categories with courses. Also some courses have summaries. Some courses should have enrollment methods other than manual (i.e. self enrollment). Some courses should have enrolled users with roles listed in $CFG->coursecontact. See screenshots attached to MDL-37009
Pages and responsible renderer functions:
- Courses lists on frontpage (see $CFG->frontpage, $CFG->frontpageloggedin) - core_course_renderer::courses_list_frontpage()
- List of courses where user is enrolled (please note, this is no longer recommended setting, use 'my' page instead!)
- List of all available courses
- Categories list ($CFG->maxcategorydepth will affect how many subcategories levels to display)
- Combo list ($CFG->maxcategorydepth will affect how many subcategories levels to display)
- View courses (/course/index.php, /course/category.php) - core_course_renderer::course_category()
- Category is empty
- Category has only subcategories
- Category has only subcategories and there are more than $CFG->coursesperpage of them
- Category has only courses and there are less courses than $CFG->courseswithsummarieslimit
- Category has only courses and there are more than $CFG->courseswithsummarieslimit but less than $CFG->coursesperpage
- Category has only courses and there are more than $CFG->coursesperpage
- Category has both courses and categories and at least one of the lists is bigger than $CFG->coursesperpage (make sure to click "more" link for both courses and categories list).
- Search courses - core_course_renderer::search_courses()
- No courses found
- Less than $CFG->coursesperpage courses found
- More than $CFG->coursesperpage courses found
- Courses with tag - core_course_renderer::tagged_courses()
- Enable tag functionality, tag some courses with the same tag, add Tags block, click on tag name, the list of tagged courses is displayed (this is very similar to search results)
- Course information (.course-info-box) - core_course_renderer::course_info_box()
- If course has self enrollment, when student clicks on course name he is redirected to /enrol/index.php
- In collapsed courses listing there is an "i" icon next to the course name, click on it, /course/info.php is opened
Hint. To change $CFG->xxx type xxx in the search box in Administration block.
New renderer functions
One course: core_course_renderer::coursecat_coursebox()
How to use | What you get (HTML/CSS) |
---|---|
This function is used to render courses lists, print course information and/or display courses and categories trees in many places.
To print information about one course on php page:
Remember that function print_course() is deprecated in 2.5. |
|
List of courses: core_course_renderer::coursecat_courses()
How to use | What you get (HTML/CSS) |
---|---|
Also is already used in many course listings.
To print custom list of courses on php page:
|
CSS classes
|
List of subcategories: core_course_renderer::coursecat_subcategories()
How to use | What you get (HTML/CSS) |
---|---|
Can be used only as part of tree | CSS classes
|
Courses and categories tree: core_course_renderer::coursecat_tree()
How to use | What you get (HTML/CSS) |
---|---|
Can be called as $renderer->render($coursecat) but since the class coursecat_renderable is defined inside /course/renderer.php it is not recommended to use it from outside of the class.
Used in functions:
|
|
Changes in CSS
Pages, displaying information about one course only
- /course/info.php
- /enrol/index.php (in Moodle 2.4 had url /course/enrol.php)
Moodle 2.4 | Moodle 2.5 |
---|---|
|
|
Courses lists
- search results
- tagged courses
- list of enrolled or available courses on the front page
- category page where number of courses is less than $CFG->courseswithsummarieslimit
Moodle 2.4 | Moodle 2.5 |
---|---|
|
|
CSS directives replacements | |
Moodle 2.4 | Moodle 2.5 |
.coursebox > .info > ul.teachers > li | .coursebox > .content > ul.teachers > li |
.coursebox > .summary | .coursebox > .content > .summary |
.coursebox > .summary > p.category | .coursebox > .content > div.coursecat (could not use word 'category' any more because it might cause CSS confusions) |
.coursebox > .summary > .enrolmenticons | .coursebox > .info > .enrolmenticons |
Combo list on frontpage
Moodle 2.4 | Moodle 2.5 |
---|---|
|
|
CSS directives replacements | |
Moodle 2.4 | Moodle 2.5 |
.course_category_tree .courses. > .course | .course_category_tree .courses. > .coursebox (or .coursebox.collapsed) |
.course_category_tree .courses. > .course > .course-info | .course_category_tree .courses. > .coursebox > .info > .enrolmenticons,
.course_category_tree .courses. > .coursebox > .moreinfo |
.course_category_tree .courses. > .course > .course_link | .course_category_tree .courses. > .coursebox > .info > .name > a |
.course_category_tree .category > .category_label > .category_link | .course_category_tree .category > .info > .name > a |
.course_category_tree .category > .subcategories | .course_category_tree .category > .content > .subcategories |
.course_category_tree .category > .courses | .course_category_tree .category > .content > .courses |
Categories lists
Moodle 2.4 | Moodle 2.5 |
---|---|
Categories list on the frontpage
|
|
Categories list on /course/index.php
|
|
CSS directives replacements | |
Moodle 2.4 | Moodle 2.5 |
.categorylist > .category div.name > a | .course_category_tree .subcategories > .category > div.info > .name > a (Note that now courses are nested inside category and if directive just say .category .name it will also be applied to names of the courses inside category!) |
.categorylist > .category .image | does not exist anymore, if you want to add an icon for category add it as background for .category > .info > .name > a |
.categorylist .indentation | does not exist anymore, all subcategories and courses are nested div's now |
.categorylist .course | .course_category_tree .courses. > .coursebox |
Browsing category
Moodle 2.4 | Moodle 2.5 |
---|---|
Category view with subcategories
|
|
Category view with paginated courses
or category with more than $CFG->courseswithsummarieslimit courses
| |
CSS directives replacements | |
Moodle 2.4 | Moodle 2.5 |
.courseboxes | .course_category_tree.category-browse |
table.category_subcategories | .course_category_tree .subcategories (no more tables!) |
also see styles for Listings of courses |