Skip to content

Commit

Permalink
MDL-16660 calendar: remove get_ical_data() from form
Browse files Browse the repository at this point in the history
This code was only called in one path and so was not necessary.
  • Loading branch information
danpoltawski committed Oct 30, 2012
1 parent d618dcf commit c5a8212
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
4 changes: 2 additions & 2 deletions calendar/managesubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
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);
Expand Down Expand Up @@ -104,4 +104,4 @@
echo $renderer->subscription_details($courseid, $subscriptions, $importresults);
// Display the add subscription form.
$form->display();
echo $OUTPUT->footer();
echo $OUTPUT->footer();
20 changes: 1 addition & 19 deletions calendar/managesubscriptions_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,4 @@ public function validation($data, $files) {
}
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;
}
}
}

0 comments on commit c5a8212

Please sign in to comment.