Add config "allow_only_one_student_publication_per_user" see BT#15028

Students can only upload one publication
pull/2729/head
Julio 8 years ago
parent 517f1fc727
commit 26d6fb48bd
  1. 3
      main/install/configuration.dist.php
  2. 14
      main/work/upload.php
  3. 12
      main/work/work_list.php

@ -1006,6 +1006,9 @@ VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1,
);*/
// $_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 @@ $token = Security::get_token();
$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 @@ $actionsLeft = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_
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 (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_in
);
}
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]);

Loading…
Cancel
Save