Skip to content
Permalink
Browse files

Add config "allow_only_one_student_publication_per_user" see BT#15028

Students can only upload one publication
  • Loading branch information...
jmontoyaa committed Oct 31, 2018
1 parent 517f1fc commit 26d6fb48bd20122b9f4be1d360e6972712f5d4f1
Showing with 23 additions and 6 deletions.
  1. +3 −0 main/install/configuration.dist.php
  2. +8 −6 main/work/upload.php
  3. +12 −0 main/work/work_list.php
@@ -1006,6 +1006,9 @@
);*/
// $_configuration['mail_template_system'] = false;
// Students can only upload one publication
// $_configuration['allow_only_one_student_publication_per_user'] = false;
// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email
@@ -44,21 +44,23 @@
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
// @todo add an option to allow/block multiple attempts.
/*
if (!empty($workInfo) && !empty($workInfo['qualification'])) {
$onlyOnePublication = api_get_configuration_value('allow_only_one_student_publication_per_user');
if ($onlyOnePublication) {
$count = get_work_count_by_student($user_id, $work_id);
if ($count >= 1) {
Display::display_header();
api_not_allowed(true);
/*Display::display_header();
if (api_get_course_setting('student_delete_own_publication') == '1') {
echo Display::return_message(get_lang('CantUploadDeleteYourPaperFirst'), 'warning');
} else {
echo Display::return_message(get_lang('YouAlreadySentAPaperYouCantUpload'), 'warning');
}
Display::display_footer();
exit;
exit;*/
}
}*/
}
$homework = get_work_assignment_by_id($workInfo['id']);
$validationStatus = getWorkDateValidationStatus($homework);
@@ -69,6 +69,7 @@
Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsRight = '';
$onlyOnePublication = api_get_configuration_value('allow_only_one_student_publication_per_user');
if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_invitee()) {
$url = api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId;
$actionsRight = Display::url(
@@ -83,6 +84,17 @@
);
}
if ($onlyOnePublication) {
$count = get_work_count_by_student(
api_get_user_id(),
$my_folder_data['id']
);
if (!empty($count) && $count >= 1) {
$actionsRight = '';
}
}
$tpl = new Template('');
$content = Display::toolbarAction('toolbar-work', [$actionsLeft, $actionsRight]);

0 comments on commit 26d6fb4

Please sign in to comment.
You can’t perform that action at this time.