'session_list.php', 'name' => get_lang('Session list')];
set_time_limit(0);
$inserted_in_course = [];
// Display the header.
Display::display_header($tool_name);
echo '
';
if (!empty($error_message)) {
echo Display::return_message($error_message, 'normal', false);
}
$form = new FormValidator(
'import_sessions',
'post',
api_get_self(),
null,
['enctype' => 'multipart/form-data']
);
$form->addElement('file', 'import_file', get_lang('Import marks in an assessment'));
$form->addElement('checkbox', 'remove_old_relationships', null, get_lang('Remove previous relationships'));
//$form->addElement('checkbox', 'send_email', null, get_lang('Send a mail to users'));
$form->addButtonImport(get_lang('Import session(s)'));
if ($form->validate()) {
if (isset($_FILES['import_file']['tmp_name']) && !empty($_FILES['import_file']['tmp_name'])) {
$values = $form->exportValues();
$sendMail = isset($values['send_email']) ? true : false;
$removeOldRelationships = isset($values['remove_old_relationships']) ? true : false;
$result = SessionManager::importSessionDrhCSV(
$_FILES['import_file']['tmp_name'],
$sendMail,
$removeOldRelationships
);
Display::addFlash(Display::return_message($result, 'info', false));
header('Location: '.api_get_self());
exit;
} else {
$error_message = get_lang('No file was sent');
}
}
$form->display();
?>
bold are mandatory.').')'; ?> :
Username;SessionName;
drh1;Session 1;
drh2;Session 2;