MDL-59392 calendar: Deprecate old event filters
This commit is contained in:
@@ -1981,88 +1981,6 @@ function calendar_top_controls($type, $data) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a filter control element.
|
||||
*
|
||||
* @param moodle_url $url of the filter
|
||||
* @param int $type constant defining the type filter
|
||||
* @return string html content of the element
|
||||
*/
|
||||
function calendar_filter_controls_element(moodle_url $url, $type) {
|
||||
global $OUTPUT;
|
||||
|
||||
switch ($type) {
|
||||
case CALENDAR_EVENT_GLOBAL:
|
||||
$typeforhumans = 'global';
|
||||
$class = 'calendar_event_global';
|
||||
break;
|
||||
case CALENDAR_EVENT_COURSE:
|
||||
$typeforhumans = 'course';
|
||||
$class = 'calendar_event_course';
|
||||
break;
|
||||
case CALENDAR_EVENT_GROUP:
|
||||
$typeforhumans = 'groups';
|
||||
$class = 'calendar_event_group';
|
||||
break;
|
||||
case CALENDAR_EVENT_USER:
|
||||
$typeforhumans = 'user';
|
||||
$class = 'calendar_event_user';
|
||||
break;
|
||||
}
|
||||
|
||||
if (calendar_show_event_type($type)) {
|
||||
$icon = $OUTPUT->pix_icon('t/hide', get_string('hide'));
|
||||
$str = get_string('hide' . $typeforhumans . 'events', 'calendar');
|
||||
} else {
|
||||
$icon = $OUTPUT->pix_icon('t/show', get_string('show'));
|
||||
$str = get_string('show' . $typeforhumans . 'events', 'calendar');
|
||||
}
|
||||
$content = \html_writer::start_tag('li', array('class' => 'calendar_event'));
|
||||
$content .= \html_writer::start_tag('a', array('href' => $url, 'rel' => 'nofollow'));
|
||||
$content .= \html_writer::tag('span', $icon, array('class' => $class));
|
||||
$content .= \html_writer::tag('span', $str, array('class' => 'eventname'));
|
||||
$content .= \html_writer::end_tag('a');
|
||||
$content .= \html_writer::end_tag('li');
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the controls filter for calendar.
|
||||
*
|
||||
* Filter is used to hide calendar info from the display page.
|
||||
*
|
||||
|
||||
* @param moodle_url $returnurl return-url for filter controls
|
||||
* @return string $content return filter controls in html
|
||||
*/
|
||||
function calendar_filter_controls(moodle_url $returnurl) {
|
||||
$groupevents = true;
|
||||
|
||||
$seturl = new \moodle_url('/calendar/set.php', array('return' => base64_encode($returnurl->out_as_local_url(false)),
|
||||
'sesskey' => sesskey()));
|
||||
$content = \html_writer::start_tag('ul');
|
||||
|
||||
$seturl->param('var', 'showglobal');
|
||||
$content .= calendar_filter_controls_element($seturl, CALENDAR_EVENT_GLOBAL);
|
||||
|
||||
$seturl->param('var', 'showcourses');
|
||||
$content .= calendar_filter_controls_element($seturl, CALENDAR_EVENT_COURSE);
|
||||
|
||||
if (isloggedin() && !isguestuser()) {
|
||||
if ($groupevents) {
|
||||
// This course MIGHT have group events defined, so show the filter.
|
||||
$seturl->param('var', 'showgroups');
|
||||
$content .= calendar_filter_controls_element($seturl, CALENDAR_EVENT_GROUP);
|
||||
}
|
||||
$seturl->param('var', 'showuser');
|
||||
$content .= calendar_filter_controls_element($seturl, CALENDAR_EVENT_USER);
|
||||
}
|
||||
$content .= \html_writer::end_tag('ul');
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the representation day.
|
||||
*
|
||||
|
||||
@@ -50,24 +50,6 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
return html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces the content for the filters block (pretend block)
|
||||
*
|
||||
* @param int $courseid
|
||||
* @param int $day
|
||||
* @param int $month
|
||||
* @param int $year
|
||||
* @param int $view
|
||||
* @param int $courses
|
||||
* @return string
|
||||
*/
|
||||
public function fake_block_filters($courseid, $day, $month, $year, $view, $courses) {
|
||||
$returnurl = $this->page->url;
|
||||
$returnurl->param('course', $courseid);
|
||||
return html_writer::tag('div', calendar_filter_controls($returnurl),
|
||||
array('class' => 'calendar_filters filters'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces the content for the three months block (pretend block)
|
||||
*
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Sets the events filter for the calendar view.
|
||||
*
|
||||
* @package core_calendar
|
||||
* @copyright 2003 Jon Papaioannou ([email protected])
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once('../config.php');
|
||||
require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
|
||||
$var = required_param('var', PARAM_ALPHA);
|
||||
$return = clean_param(base64_decode(required_param('return', PARAM_RAW)), PARAM_LOCALURL);
|
||||
$courseid = optional_param('id', -1, PARAM_INT);
|
||||
if ($courseid != -1) {
|
||||
$return = new moodle_url($return, array('course' => $courseid));
|
||||
} else {
|
||||
$return = new moodle_url($return);
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
// Do not call require_sesskey() since this page may be accessed without session (for example by bots).
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
$url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return->out_as_local_url(false)), 'course' => $courseid, 'var'=>$var, 'sesskey'=>sesskey()));
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
switch($var) {
|
||||
case 'showgroups':
|
||||
calendar_set_event_type_display(CALENDAR_EVENT_GROUP);
|
||||
break;
|
||||
case 'showcourses':
|
||||
calendar_set_event_type_display(CALENDAR_EVENT_COURSE);
|
||||
break;
|
||||
case 'showglobal':
|
||||
calendar_set_event_type_display(CALENDAR_EVENT_GLOBAL);
|
||||
break;
|
||||
case 'showuser':
|
||||
calendar_set_event_type_display(CALENDAR_EVENT_USER);
|
||||
break;
|
||||
}
|
||||
|
||||
redirect($return);
|
||||
+18
-17
@@ -136,11 +136,6 @@ $string['gotocalendar'] = 'Go to calendar';
|
||||
$string['group'] = 'Group';
|
||||
$string['groupevent'] = 'Group event';
|
||||
$string['groupevents'] = 'Group events';
|
||||
$string['hidecourseevents'] = 'Hide course events';
|
||||
$string['hideglobalevents'] = 'Hide global events';
|
||||
$string['hidegroupsevents'] = 'Hide group events';
|
||||
$string['hidemoduleevents'] = 'Hide module events';
|
||||
$string['hideuserevents'] = 'Hide user events';
|
||||
$string['eventtypeglobal'] = 'global';
|
||||
$string['eventtypesite'] = 'global';
|
||||
$string['eventtypecourse'] = 'course';
|
||||
@@ -205,10 +200,6 @@ $string['repeatweeksl'] = 'Repeat weekly, creating altogether';
|
||||
$string['repeatweeksr'] = 'events';
|
||||
$string['sat'] = 'Sat';
|
||||
$string['saturday'] = 'Saturday';
|
||||
$string['showcourseevents'] = 'Show course events';
|
||||
$string['showglobalevents'] = 'Show global events';
|
||||
$string['showgroupsevents'] = 'Show group events';
|
||||
$string['showuserevents'] = 'Show user events';
|
||||
$string['shown'] = 'shown';
|
||||
$string['siteevents'] = 'Site events';
|
||||
$string['spanningevents'] = 'Events underway';
|
||||
@@ -229,14 +220,6 @@ $string['todayplustitle'] = 'Today {$a}';
|
||||
$string['tomorrow'] = 'Tomorrow';
|
||||
$string['tt_deleteevent'] = 'Delete event';
|
||||
$string['tt_editevent'] = 'Edit event';
|
||||
$string['tt_hidecourse'] = 'Course events are shown (click to hide)';
|
||||
$string['tt_hideglobal'] = 'Global events are shown (click to hide)';
|
||||
$string['tt_hidegroups'] = 'Group events are shown (click to hide)';
|
||||
$string['tt_hideuser'] = 'User events are shown (click to hide)';
|
||||
$string['tt_showcourse'] = 'Course events are hidden (click to show)';
|
||||
$string['tt_showglobal'] = 'Global events are hidden (click to show)';
|
||||
$string['tt_showgroups'] = 'Group events are hidden (click to show)';
|
||||
$string['tt_showuser'] = 'User events are hidden (click to show)';
|
||||
$string['tue'] = 'Tue';
|
||||
$string['tuesday'] = 'Tuesday';
|
||||
$string['typeclose'] = 'Close event';
|
||||
@@ -264,3 +247,21 @@ $string['youcandeleteallrepeats'] = 'This event is part of a repeating event ser
|
||||
|
||||
// Deprecated since Moodle 3.2.
|
||||
$string['for'] = 'for';
|
||||
|
||||
// Deprecated since Moodle 3.4.
|
||||
$string['tt_hidecourse'] = 'Course events are shown (click to hide)';
|
||||
$string['tt_hideglobal'] = 'Global events are shown (click to hide)';
|
||||
$string['tt_hidegroups'] = 'Group events are shown (click to hide)';
|
||||
$string['tt_hideuser'] = 'User events are shown (click to hide)';
|
||||
$string['tt_showcourse'] = 'Course events are hidden (click to show)';
|
||||
$string['tt_showglobal'] = 'Global events are hidden (click to show)';
|
||||
$string['tt_showgroups'] = 'Group events are hidden (click to show)';
|
||||
$string['tt_showuser'] = 'User events are hidden (click to show)';
|
||||
$string['hidecourseevents'] = 'Hide course events';
|
||||
$string['hideglobalevents'] = 'Hide global events';
|
||||
$string['hidegroupsevents'] = 'Hide group events';
|
||||
$string['hideuserevents'] = 'Hide user events';
|
||||
$string['showcourseevents'] = 'Show course events';
|
||||
$string['showglobalevents'] = 'Show global events';
|
||||
$string['showgroupsevents'] = 'Show group events';
|
||||
$string['showuserevents'] = 'Show user events';
|
||||
|
||||
@@ -63,3 +63,19 @@ sectionusedefaultname,core
|
||||
registermoochtips,core_hub
|
||||
monthnext,core_access
|
||||
monthprev,core_access
|
||||
tt_hidecourse,core_calendar
|
||||
tt_hideglobal,core_calendar
|
||||
tt_hidegroups,core_calendar
|
||||
tt_hideuser,core_calendar
|
||||
tt_showcourse,core_calendar
|
||||
tt_showglobal,core_calendar
|
||||
tt_showgroups,core_calendar
|
||||
tt_showuser,core_calendar
|
||||
hidecourseevents,core_calendar
|
||||
hideglobalevents,core_calendar
|
||||
hidegroupsevents,core_calendar
|
||||
hideuserevents,core_calendar
|
||||
showcourseevents,core_calendar
|
||||
showglobalevents,core_calendar
|
||||
showgroupsevents,core_calendar
|
||||
showuserevents,core_calendar
|
||||
|
||||
Reference in New Issue
Block a user