mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-71952-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
d29c6f5977
@ -55,6 +55,7 @@ if (empty($CFG->enablecalendarexport)) {
|
||||
}
|
||||
|
||||
$courseid = optional_param('course', SITEID, PARAM_INT);
|
||||
$categoryid = optional_param('category', null, PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$day = optional_param('cal_d', 0, PARAM_INT);
|
||||
$mon = optional_param('cal_m', 0, PARAM_INT);
|
||||
@ -76,32 +77,44 @@ if (!empty($day) && !empty($mon) && !empty($year)) {
|
||||
$time = time();
|
||||
}
|
||||
|
||||
$url = new moodle_url('/calendar/export.php', array('time' => $time));
|
||||
$managesubscriptionsurl = new moodle_url('/calendar/managesubscriptions.php');
|
||||
|
||||
if ($courseid != SITEID && !empty($courseid)) {
|
||||
// Course ID must be valid and existing.
|
||||
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|
||||
$courses = array($course->id => $course);
|
||||
$issite = false;
|
||||
$url->param('course', $course->id);
|
||||
$managesubscriptionsurl->param('course', $course->id);
|
||||
|
||||
navigation_node::override_active_url(new moodle_url('/course/view.php', ['id' => $course->id]));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $course->id])
|
||||
);
|
||||
} else {
|
||||
$course = get_site();
|
||||
$courses = calendar_get_default_courses();
|
||||
$issite = true;
|
||||
|
||||
if (!empty($categoryid)) {
|
||||
$managesubscriptionsurl->param('category', $categoryid);
|
||||
|
||||
navigation_node::override_active_url(new moodle_url('/course/index.php', ['categoryid' => $categoryid]));
|
||||
$PAGE->set_category_by_id($categoryid);
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
|
||||
);
|
||||
} else {
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
}
|
||||
}
|
||||
require_login($course, false);
|
||||
|
||||
$url = new moodle_url('/calendar/export.php', array('time' => $time));
|
||||
$managesubscriptionsurl = new moodle_url('/calendar/managesubscriptions.php');
|
||||
|
||||
if ($action !== '') {
|
||||
$url->param('action', $action);
|
||||
}
|
||||
|
||||
if ($course !== NULL) {
|
||||
$url->param('course', $course->id);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$managesubscriptionsurl->param('course', $course->id);
|
||||
}
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
|
||||
$calendar = new calendar_information(0, 0, 0, $time);
|
||||
@ -109,15 +122,10 @@ $calendar->set_sources($course, $courses);
|
||||
|
||||
$pagetitle = get_string('export', 'calendar');
|
||||
|
||||
// Print title and header
|
||||
if ($issite) {
|
||||
$PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
|
||||
}
|
||||
$link = new moodle_url(CALENDAR_URL.'view.php', array('view'=>'upcoming', 'course'=>$calendar->courseid));
|
||||
$PAGE->navbar->add(get_string('calendar', 'calendar'), calendar_get_link_href($link, 0, 0, 0, $time));
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'), $managesubscriptionsurl);
|
||||
$PAGE->navbar->add($pagetitle);
|
||||
|
||||
// Print title and header.
|
||||
$PAGE->set_title($course->shortname.': '.get_string('calendar', 'calendar').': '.$pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_pagelayout('standard');
|
||||
|
@ -32,8 +32,6 @@ $category = optional_param('category', 0, PARAM_INT);
|
||||
$data = [];
|
||||
$pageurl = new moodle_url('/calendar/import.php');
|
||||
$managesubscriptionsurl = new moodle_url('/calendar/managesubscriptions.php');
|
||||
$calendarurl = new moodle_url('/calendar/view.php', ['view' => 'month']);
|
||||
navigation_node::override_active_url($calendarurl);
|
||||
|
||||
if ($courseid != SITEID && !empty($courseid)) {
|
||||
$course = get_course($courseid);
|
||||
@ -41,14 +39,43 @@ if ($courseid != SITEID && !empty($courseid)) {
|
||||
$data['courseid'] = $course->id;
|
||||
$pageurl->param('course', $course->id);
|
||||
$managesubscriptionsurl->param('course', $course->id);
|
||||
navigation_node::override_active_url(new moodle_url('/course/view.php', ['id' => $course->id]));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $course->id])
|
||||
);
|
||||
} else if (!empty($category)) {
|
||||
$course = get_site();
|
||||
$pageurl->param('category', $category);
|
||||
$managesubscriptionsurl->param('category', $category);
|
||||
$data['category'] = $category;
|
||||
$data['eventtype'] = 'category';
|
||||
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'),
|
||||
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']));
|
||||
}
|
||||
|
||||
require_login($course, false);
|
||||
if (!calendar_user_can_add_event($course)) {
|
||||
throw new \moodle_exception('errorcannotimport', 'calendar');
|
||||
}
|
||||
|
||||
$heading = get_string('importcalendar', 'calendar');
|
||||
$pagetitle = $course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $heading;
|
||||
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'), $managesubscriptionsurl);
|
||||
$PAGE->navbar->add($heading);
|
||||
|
||||
// Populate the 'group' select box based on the given 'groupcourseid', if necessary.
|
||||
$groups = [];
|
||||
if (!empty($groupcourseid)) {
|
||||
@ -63,22 +90,6 @@ if (!empty($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');
|
||||
$pagetitle = $course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $heading;
|
||||
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'), $managesubscriptionsurl);
|
||||
$PAGE->navbar->add($heading);
|
||||
|
||||
$customdata = [
|
||||
'courseid' => $course->id,
|
||||
|
@ -40,14 +40,25 @@ $action = optional_param('action', '', PARAM_INT);
|
||||
$url = new moodle_url('/calendar/managesubscriptions.php');
|
||||
if ($courseid != SITEID && !empty($courseid)) {
|
||||
$url->param('course', $courseid);
|
||||
}
|
||||
if ($categoryid) {
|
||||
navigation_node::override_active_url(new moodle_url('/course/view.php', ['id' => $courseid]));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $courseid])
|
||||
);
|
||||
} else if ($categoryid) {
|
||||
$url->param('categoryid', $categoryid);
|
||||
navigation_node::override_active_url(new moodle_url('/course/index.php', ['categoryid' => $categoryid]));
|
||||
$PAGE->set_category_by_id($categoryid);
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
|
||||
);
|
||||
} else {
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', ['view' => 'month']));
|
||||
}
|
||||
navigation_node::override_active_url(new moodle_url('/calendar/view.php', array('view' => 'month')));
|
||||
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'));
|
||||
|
||||
if ($courseid != SITEID && !empty($courseid)) {
|
||||
// Course ID must be valid and existing.
|
||||
@ -63,6 +74,8 @@ if (!calendar_user_can_add_event($course)) {
|
||||
print_error('errorcannotimport', 'calendar');
|
||||
}
|
||||
|
||||
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'));
|
||||
|
||||
$importresults = '';
|
||||
|
||||
if (!empty($subscriptionid)) {
|
||||
|
@ -96,10 +96,18 @@ $course = get_course($courseid);
|
||||
|
||||
if ($iscoursecalendar && !empty($courseid)) {
|
||||
navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id)));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $course->id])
|
||||
);
|
||||
} else if (!empty($categoryid)) {
|
||||
core_course_category::get($categoryid); // Check that category exists and can be accessed.
|
||||
$PAGE->set_category_by_id($categoryid);
|
||||
navigation_node::override_active_url(new moodle_url('/course/index.php', array('categoryid' => $categoryid)));
|
||||
$PAGE->navbar->add(
|
||||
get_string('calendar', 'calendar'),
|
||||
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
|
||||
);
|
||||
} else {
|
||||
$PAGE->set_context(context_system::instance());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user