mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-74595 calendar: consistent breadcrumbs navigating site calendar.
Take #3, see also 7a529cc8 and 81b0d053.
This commit is contained in:
parent
ceb41588d2
commit
1dba7152d0
@ -106,7 +106,7 @@ if ($courseid != SITEID && !empty($courseid)) {
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
|
||||
);
|
||||
} else {
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
$PAGE->navbar->add(get_string('calendar', 'calendar'), new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
}
|
||||
}
|
||||
require_login($course, false);
|
||||
|
@ -33,15 +33,18 @@ $data = [];
|
||||
$pageurl = new moodle_url('/calendar/import.php');
|
||||
$managesubscriptionsurl = new moodle_url('/calendar/managesubscriptions.php');
|
||||
|
||||
if ($courseid != SITEID && !empty($courseid)) {
|
||||
$headingstr = $calendarstr = get_string('calendar', 'calendar');
|
||||
|
||||
if (!empty($courseid) && $courseid != SITEID) {
|
||||
$course = get_course($courseid);
|
||||
$data['eventtype'] = 'course';
|
||||
$data['courseid'] = $course->id;
|
||||
$pageurl->param('course', $course->id);
|
||||
$managesubscriptionsurl->param('course', $course->id);
|
||||
$headingstr .= ": {$course->shortname}";
|
||||
navigation_node::override_active_url(new moodle_url('/course/view.php', ['id' => $course->id]));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
$calendarstr,
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $course->id])
|
||||
);
|
||||
} else if (!empty($category)) {
|
||||
@ -53,12 +56,16 @@ if ($courseid != SITEID && !empty($courseid)) {
|
||||
navigation_node::override_active_url(new moodle_url('/course/index.php', ['categoryid' => $category]));
|
||||
$PAGE->set_category_by_id($category);
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
$calendarstr,
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $category])
|
||||
);
|
||||
} else {
|
||||
$course = get_site();
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
$PAGE->navbar->add($calendarstr, new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
}
|
||||
|
||||
if (!empty($groupcourseid)) {
|
||||
$pageurl->param('groupcourseid', $groupcourseid);
|
||||
}
|
||||
|
||||
require_login($course, false);
|
||||
@ -67,15 +74,15 @@ if (!calendar_user_can_add_event($course)) {
|
||||
}
|
||||
|
||||
$heading = get_string('importcalendar', 'calendar');
|
||||
$pagetitle = $course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $heading;
|
||||
$pagetitle = $course->shortname . ': ' . $calendarstr . ': ' . $heading;
|
||||
|
||||
$PAGE->set_secondary_navigation(false);
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_heading($headingstr);
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'), $managesubscriptionsurl);
|
||||
$PAGE->navbar->add($heading);
|
||||
$PAGE->navbar->add($heading, $pageurl);
|
||||
|
||||
// Populate the 'group' select box based on the given 'groupcourseid', if necessary.
|
||||
$groups = [];
|
||||
@ -89,25 +96,13 @@ if (!empty($groupcourseid)) {
|
||||
}
|
||||
$data['groupcourseid'] = $groupcourseid;
|
||||
$data['eventtype'] = 'group';
|
||||
$pageurl->param('groupcourseid', $groupcourseid);
|
||||
}
|
||||
if (!empty($category)) {
|
||||
$pageurl->param('category', $category);
|
||||
$managesubscriptionsurl->param('category', $category);
|
||||
$data['category'] = $category;
|
||||
$data['eventtype'] = 'category';
|
||||
}
|
||||
|
||||
$heading = get_string('importcalendar', 'calendar');
|
||||
$headingstr = get_string('calendar', 'core_calendar');
|
||||
$headingstr = ($courseid != SITEID && !empty($courseid)) ? "{$headingstr}: {$COURSE->shortname}" : $headingstr;
|
||||
$pagetitle = $course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $heading;
|
||||
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($headingstr);
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add($heading, $pageurl);
|
||||
$renderer = $PAGE->get_renderer('core_calendar');
|
||||
|
||||
$customdata = [
|
||||
|
@ -48,7 +48,7 @@ if ($courseid != SITEID && !empty($courseid)) {
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
|
||||
);
|
||||
} else {
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
$PAGE->navbar->add(get_string('calendar', 'calendar'), new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
}
|
||||
|
||||
$PAGE->set_url($url);
|
||||
|
@ -19,7 +19,12 @@ Feature: Import and edit calendar events
|
||||
Given I log in as "teacher1"
|
||||
And I view the calendar for "1" "2016"
|
||||
And I click on "Import or export calendars" "link"
|
||||
And "Calendar" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Import or export calendars" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And I press "Import calendar"
|
||||
And "Calendar" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Import or export calendars" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Import calendar" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Calendar name | Test Import |
|
||||
| Import from | Calendar file (.ics) |
|
||||
|
@ -19,7 +19,12 @@ Feature: Export calendar events
|
||||
Scenario: Viewing calendar export options
|
||||
Given I follow "Full calendar"
|
||||
When I click on "Import or export calendars" "link"
|
||||
And "Calendar" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Import or export calendars" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And I click on "Export calendar" "button"
|
||||
And "Calendar" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Import or export calendars" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Export calendar" "text" should exist in the ".breadcrumb" "css_element"
|
||||
Then I should see "All events"
|
||||
And I should see "Events related to courses"
|
||||
And I should see "Events related to groups"
|
||||
|
Loading…
x
Reference in New Issue
Block a user