MDL-16660 calendar: remove get_ical_data() from form
This code was only called in one path and so was not necessary.
This commit is contained in:
@@ -70,7 +70,7 @@ if (!empty($formdata)) {
|
||||
if ($formdata->importfrom == CALENDAR_IMPORT_FROM_FILE) {
|
||||
// Blank the URL if it's a file import.
|
||||
$formdata->url = '';
|
||||
$calendar = $form->get_ical_data();
|
||||
$calendar = $form->get_file_content('importfile');
|
||||
$ical = new iCalendar();
|
||||
$ical->unserialize($calendar);
|
||||
$importresults = calendar_import_icalendar_events($ical, $courseid, $subscriptionid);
|
||||
@@ -104,4 +104,4 @@ echo $OUTPUT->header();
|
||||
echo $renderer->subscription_details($courseid, $subscriptions, $importresults);
|
||||
// Display the add subscription form.
|
||||
$form->display();
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
@@ -112,22 +112,4 @@ class calendar_addsubscription_form extends moodleform {
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ical content either from the uploaded file, or from the URL.
|
||||
*
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
public function get_ical_data() {
|
||||
$formdata = $this->get_data();
|
||||
switch ($formdata->importfrom) {
|
||||
case CALENDAR_IMPORT_FROM_FILE:
|
||||
$calendar = $this->get_file_content('importfile');
|
||||
break;
|
||||
case CALENDAR_IMPORT_FROM_URL:
|
||||
$calendar = download_file_content($formdata->importurl);
|
||||
break;
|
||||
}
|
||||
return $calendar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user