diff --git a/calendar/managesubscriptions.php b/calendar/managesubscriptions.php index 5171147daa7..95479ef36c8 100644 --- a/calendar/managesubscriptions.php +++ b/calendar/managesubscriptions.php @@ -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(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/calendar/managesubscriptions_form.php b/calendar/managesubscriptions_form.php index 2e49e6beae3..12c3135c1a3 100644 --- a/calendar/managesubscriptions_form.php +++ b/calendar/managesubscriptions_form.php @@ -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; - } -} \ No newline at end of file +}