$PAGE->set_title($data->name); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($data->name)); /// Groups needed for Add entry tab $currentgroup = groups_get_activity_group($cm); $groupmode = groups_get_activity_groupmode($cm); if (!($formdata = $form->get_data())) { /// Upload records section. Only for teachers and the admin. echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide'); require_once 'import_form.php'; echo $OUTPUT->heading(get_string('uploadrecords', 'data'), 3); $form = new mod_data_import_form(new moodle_url('/mod/data/import.php')); $formdata = new stdClass(); $formdata->d = $data->id; $form->set_data($formdata); $form->display(); echo $OUTPUT->box_end(); echo $OUTPUT->footer(); die; } else { // Large files are likely to take their time and memory. Let PHP know // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); raise_memory_limit(MEMORY_EXTRA); $iid = csv_import_reader::get_new_iid('moddata'); $cir = new csv_import_reader($iid, 'moddata'); $readcount = $cir->load_csv_content($form->get_file_content('recordsfile'), $formdata->encoding, $formdata->fielddelimiter); if (empty($readcount)) { print_error('csvfailed', 'data', "{$CFG->wwwroot}/mod/data/edit.php?d={$data->id}");