mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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
|
@ -42,10 +42,6 @@ Feature: Basic recycle bin functionality
|
||||||
And I should see "Test assign" in the "Topic 1" "section"
|
And I should see "Test assign" in the "Topic 1" "section"
|
||||||
|
|
||||||
Scenario: Restore a deleted course
|
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"
|
Given I log in as "admin"
|
||||||
And I go to the courses management page
|
And I go to the courses management page
|
||||||
And I click on "delete" action for "Course 2" in management course listing
|
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 should see "C2 has been completely deleted"
|
||||||
And I press "Continue"
|
And I press "Continue"
|
||||||
And I am on course index
|
And I am on course index
|
||||||
And I follow "Miscellaneous"
|
And I should see "Course 1"
|
||||||
And I should not see "Course 2"
|
And I should not see "Course 2"
|
||||||
When I navigate to "Recycle bin" in current page administration
|
When I navigate to "Recycle bin" in current page administration
|
||||||
Then I should see "Course 2"
|
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
|
// And the object has been loaded for us no need for another DB call
|
||||||
$category = $PAGE->category;
|
$category = $PAGE->category;
|
||||||
} else {
|
} 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_url('/course/index.php');
|
||||||
$PAGE->set_context(context_system::instance());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$PAGE->set_pagelayout('coursecategory');
|
$PAGE->set_pagelayout('coursecategory');
|
||||||
|
|
|
@ -1554,15 +1554,21 @@ class core_course_renderer extends plugin_renderer_base {
|
||||||
$this->page->set_title("$site->shortname: $strcategories");
|
$this->page->set_title("$site->shortname: $strcategories");
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
// Print the category selector
|
||||||
$output .= html_writer::start_tag('div', array('class' => 'categorypicker'));
|
if (coursecat::count_all() > 1) {
|
||||||
$select = new single_select(new moodle_url('/course/index.php'), 'categoryid',
|
$output .= html_writer::start_tag('div', array('class' => 'categorypicker'));
|
||||||
coursecat::make_categories_list(), $coursecat->id, null, 'switchcategory');
|
$select = new single_select(new moodle_url('/course/index.php'), 'categoryid',
|
||||||
$select->set_label(get_string('categories').':');
|
coursecat::make_categories_list(), $coursecat->id, null, 'switchcategory');
|
||||||
$output .= $this->render($select);
|
$select->set_label(get_string('categories').':');
|
||||||
$output .= html_writer::end_tag('div'); // .categorypicker
|
$output .= $this->render($select);
|
||||||
|
$output .= html_writer::end_tag('div'); // .categorypicker
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print current category description
|
// Print current category description
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue