Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/public/main/exercise/recalculate_all.php

61 lines
1.2 KiB

<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\TrackEExercises;
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true);
if (!isset($_REQUEST['exercise'])) {
api_not_allowed(true);
}
$exerciseId = (int) $_REQUEST['exercise'];
$is_allowedToEdit = api_is_allowed_to_edit(null, true) ||
api_is_drh() ||
api_is_student_boss() ||
api_is_session_admin();
if (!$is_allowedToEdit) {
api_not_allowed(true);
}
$result = ExerciseLib::get_exam_results_data(
0,
0,
1,
'asc',
$exerciseId,
'',
false,
null,
false,
false,
[],
false,
false,
true
);
foreach ($result as $track) {
/** @var TrackEExercises $trackedExercise */
$trackedExercise = ExerciseLib::recalculateResult(
$track['id'],
$track['user_id'],
$exerciseId
);
if (!$trackedExercise) {
Display::addFlash(
Display::return_message(get_lang('BadFormData').'<br>ID: '.$track['id'], 'warning', false)
);
}
}
$url = api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'
.api_get_cidreq()
."&exerciseId=$exerciseId";
header("Location: $url");