mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-57250_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
2956ca50fa
@ -42,10 +42,6 @@ Feature: Basic recycle bin functionality
|
||||
And I should see "Test assign" in the "Topic 1" "section"
|
||||
|
||||
Scenario: Restore a deleted course
|
||||
# TODO MDL-57250 remove extra category.
|
||||
Given the following "categories" exist:
|
||||
| name | idnumber |
|
||||
| There is a bug with navigation and we need an extra category | CAT1 |
|
||||
Given I log in as "admin"
|
||||
And I go to the courses management page
|
||||
And I click on "delete" action for "Course 2" in management course listing
|
||||
@ -54,7 +50,7 @@ Feature: Basic recycle bin functionality
|
||||
And I should see "C2 has been completely deleted"
|
||||
And I press "Continue"
|
||||
And I am on course index
|
||||
And I follow "Miscellaneous"
|
||||
And I should see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
When I navigate to "Recycle bin" in current page administration
|
||||
Then I should see "Course 2"
|
||||
|
@ -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…
x
Reference in New Issue
Block a user