Commit ef7df2ae authored by Damyon Wiese's avatar Damyon Wiese
Browse files

Merge branch 'MDL-60564_master' of git://github.com/markn86/moodle

parents 4d03dbf1 8e853718
......@@ -147,20 +147,10 @@ class day_exporter extends exporter {
'navigation' => [
'type' => PARAM_RAW,
],
'popovertitle' => [
'type' => PARAM_RAW,
'default' => '',
],
'haslastdayofevent' => [
'type' => PARAM_BOOL,
'default' => false,
],
'filter_selector' => [
'type' => PARAM_RAW,
],
'new_event_button' => [
'type' => PARAM_RAW,
],
];
}
......@@ -190,8 +180,6 @@ class day_exporter extends exporter {
'previousperiod' => $this->get_previous_day_timestamp($daytimestamp),
'nextperiod' => $this->get_next_day_timestamp($daytimestamp),
'navigation' => $this->get_navigation(),
'filter_selector' => $this->get_course_filter_selector($output),
'new_event_button' => $this->get_new_event_button(),
'viewdaylink' => $this->url->out(false),
];
......@@ -277,82 +265,4 @@ class day_exporter extends exporter {
'time' => $this->calendar->time,
]);
}
/**
* Get the course filter selector.
*
* This is a temporary solution, this code will be removed by MDL-60096.
*
* @param renderer_base $output
* @return string The html code for the course filter selector.
*/
protected function get_course_filter_selector(renderer_base $output) {
global $CFG;
// TODO remove this code on MDL-60096.
if (!isloggedin() or isguestuser()) {
return '';
}
if (has_capability('moodle/calendar:manageentries', \context_system::instance()) && !empty($CFG->calendar_adminseesall)) {
$courses = get_courses('all', 'c.shortname', 'c.id, c.shortname');
} else {
$courses = enrol_get_my_courses();
}
unset($courses[SITEID]);
$courseoptions = array();
$courseoptions[SITEID] = get_string('fulllistofcourses');
foreach ($courses as $course) {
$coursecontext = \context_course::instance($course->id);
$courseoptions[$course->id] = format_string($course->shortname, true, array('context' => $coursecontext));
}
if ($this->calendar->courseid !== SITEID) {
$selected = $this->calendar->courseid;
} else {
$selected = '';
}
$courseurl = new moodle_url($this->url);
$courseurl->remove_params('course');
$select = new \single_select($courseurl, 'courseselect', $courseoptions, $selected, null);
$select->class = 'm-r-1';
$label = get_string('dayviewfor', 'calendar');
if ($label !== null) {
$select->set_label($label);
} else {
$select->set_label(get_string('listofcourses'), array('class' => 'accesshide'));
}
return $output->render($select);
}
/**
* Get the course filter selector.
*
* This is a temporary solution, this code will be removed by MDL-60096.
*
* @return string The html code for the course filter selector.
*/
protected function get_new_event_button() {
// TODO remove this code on MDL-60096.
$output = \html_writer::start_tag('div', array('class' => 'buttons'));
$output .= \html_writer::start_tag('form',
array('action' => CALENDAR_URL . 'event.php', 'method' => 'get'));
$output .= \html_writer::start_tag('div');
$output .= \html_writer::empty_tag('input',
array('type' => 'hidden', 'name' => 'action', 'value' => 'new'));
$output .= \html_writer::empty_tag('input',
array('type' => 'hidden', 'name' => 'course', 'value' => $this->calendar->courseid));
$output .= \html_writer::empty_tag('input',
array('type' => 'hidden', 'name' => 'time', 'value' => $this->calendar->time));
$attributes = array('type' => 'submit', 'value' => get_string('newevent', 'calendar'),
'class' => 'btn btn-secondary');
$output .= \html_writer::empty_tag('input', $attributes);
$output .= \html_writer::end_tag('div');
$output .= \html_writer::end_tag('form');
$output .= \html_writer::end_tag('div');
return $output;
}
}
......@@ -67,28 +67,10 @@ class week_day_exporter extends day_exporter {
protected static function define_other_properties() {
$return = parent::define_other_properties();
$return = array_merge($return, [
'timestamp' => [
'type' => PARAM_INT,
],
'neweventtimestamp' => [
'type' => PARAM_INT,
],
'viewdaylink' => [
'type' => PARAM_URL,
'optional' => true,
],
'calendareventtypes' => [
'type' => PARAM_RAW,
'multiple' => true,
],
'popovertitle' => [
'type' => PARAM_RAW,
'default' => '',
],
'haslastdayofevent' => [
'type' => PARAM_BOOL,
'default' => false,
],
]);
return $return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment