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:
Dan Poltawski
2012-10-30 14:56:39 +08:00
parent d618dcf3c9
commit c5a82120ac
2 changed files with 3 additions and 21 deletions
+2 -2
View File
@@ -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();
+1 -19
View File
@@ -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;
}
}
}