mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-57250_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
2956ca50fa
3 changed files with 25 additions and 14 deletions
|
@ -37,9 +37,18 @@ if ($categoryid) {
|
|||
// And the object has been loaded for us no need for another DB call
|
||||
$category = $PAGE->category;
|
||||
} else {
|
||||
$categoryid = 0;
|
||||
// Check if there is only one category, if so use that.
|
||||
if (coursecat::count_all() == 1) {
|
||||
$category = coursecat::get_default();
|
||||
|
||||
$categoryid = $category->id;
|
||||
$PAGE->set_category_by_id($categoryid);
|
||||
$PAGE->set_pagetype('course-index-category');
|
||||
} else {
|
||||
$PAGE->set_context(context_system::instance());
|
||||
}
|
||||
|
||||
$PAGE->set_url('/course/index.php');
|
||||
$PAGE->set_context(context_system::instance());
|
||||
}
|
||||
|
||||
$PAGE->set_pagelayout('coursecategory');
|
||||
|
|
|
@ -1554,15 +1554,21 @@ class core_course_renderer extends plugin_renderer_base {
|
|||
$this->page->set_title("$site->shortname: $strcategories");
|
||||
}
|
||||
} else {
|
||||
$this->page->set_title("$site->shortname: ". $coursecat->get_formatted_name());
|
||||
$title = $site->shortname;
|
||||
if (coursecat::count_all() > 1) {
|
||||
$title .= ": ". $coursecat->get_formatted_name();
|
||||
}
|
||||
$this->page->set_title($title);
|
||||
|
||||
// Print the category selector
|
||||
$output .= html_writer::start_tag('div', array('class' => 'categorypicker'));
|
||||
$select = new single_select(new moodle_url('/course/index.php'), 'categoryid',
|
||||
coursecat::make_categories_list(), $coursecat->id, null, 'switchcategory');
|
||||
$select->set_label(get_string('categories').':');
|
||||
$output .= $this->render($select);
|
||||
$output .= html_writer::end_tag('div'); // .categorypicker
|
||||
if (coursecat::count_all() > 1) {
|
||||
$output .= html_writer::start_tag('div', array('class' => 'categorypicker'));
|
||||
$select = new single_select(new moodle_url('/course/index.php'), 'categoryid',
|
||||
coursecat::make_categories_list(), $coursecat->id, null, 'switchcategory');
|
||||
$select->set_label(get_string('categories').':');
|
||||
$output .= $this->render($select);
|
||||
$output .= html_writer::end_tag('div'); // .categorypicker
|
||||
}
|
||||
}
|
||||
|
||||
// Print current category description
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue