|
|
|
@ -62,9 +62,7 @@ if (!$is_allowedToEdit) { |
|
|
|
api_not_allowed(true); |
|
|
|
api_not_allowed(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (empty($exerciseId)) { |
|
|
|
$exerciseId = isset($_GET['exerciseId']) ? (int) $_GET['exerciseId'] : '0'; |
|
|
|
$exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']) : '0'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* stripslashes POST data */ |
|
|
|
/* stripslashes POST data */ |
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
|
|
@ -81,11 +79,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0; |
|
|
|
$newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0; |
|
|
|
|
|
|
|
$modifyAnswers = isset($_GET['modifyAnswers']) ? $_GET['modifyAnswers'] : 0; |
|
|
|
if (empty($modifyAnswers)) { |
|
|
|
|
|
|
|
$modifyAnswers = isset($_GET['modifyAnswers']) ? $_GET['modifyAnswers'] : 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$editQuestion = isset($_GET['editQuestion']) ? $_GET['editQuestion'] : 0; |
|
|
|
$editQuestion = isset($_GET['editQuestion']) ? $_GET['editQuestion'] : 0; |
|
|
|
|
|
|
|
|
|
|
|
if (empty($modifyQuestion)) { |
|
|
|
if (empty($modifyQuestion)) { |
|
|
|
@ -169,7 +163,12 @@ if (!is_object($objExercise)) { |
|
|
|
|
|
|
|
|
|
|
|
// creation of a new exercise if wrong or not specified exercise ID |
|
|
|
// creation of a new exercise if wrong or not specified exercise ID |
|
|
|
if ($exerciseId) { |
|
|
|
if ($exerciseId) { |
|
|
|
$objExercise->read($exerciseId, $showPagination > 0 ? false : true); |
|
|
|
$parseQuestionList = $showPagination > 0 ? false : true; |
|
|
|
|
|
|
|
if ($editQuestion) { |
|
|
|
|
|
|
|
$parseQuestionList = false; |
|
|
|
|
|
|
|
$showPagination = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$objExercise->read($exerciseId, $parseQuestionList); |
|
|
|
} |
|
|
|
} |
|
|
|
// saves the object into the session |
|
|
|
// saves the object into the session |
|
|
|
Session::write('objExercise', $objExercise); |
|
|
|
Session::write('objExercise', $objExercise); |
|
|
|
@ -285,21 +284,21 @@ if (api_is_in_gradebook()) { |
|
|
|
$interbreadcrumb[] = ['url' => 'exercise.php?'.api_get_cidreq(), 'name' => get_lang('Exercises')]; |
|
|
|
$interbreadcrumb[] = ['url' => 'exercise.php?'.api_get_cidreq(), 'name' => get_lang('Exercises')]; |
|
|
|
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) { |
|
|
|
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) { |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
"url" => "admin.php?exerciseId=".$objExercise->id.'&'.api_get_cidreq(), |
|
|
|
'url' => "admin.php?exerciseId=".$objExercise->id.'&'.api_get_cidreq(), |
|
|
|
"name" => $objExercise->selectTitle(true), |
|
|
|
'name' => $objExercise->selectTitle(true), |
|
|
|
]; |
|
|
|
]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
"url" => "#", |
|
|
|
'url' => '#', |
|
|
|
"name" => $objExercise->selectTitle(true), |
|
|
|
'name' => $objExercise->selectTitle(true), |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// shows a link to go back to the question pool |
|
|
|
// shows a link to go back to the question pool |
|
|
|
if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) { |
|
|
|
if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) { |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
"url" => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), |
|
|
|
'url' => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), |
|
|
|
"name" => get_lang('QuestionPool'), |
|
|
|
'name' => get_lang('QuestionPool'), |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -370,7 +369,6 @@ if ($inATest) { |
|
|
|
if ($objExercise->added_in_lp()) { |
|
|
|
if ($objExercise->added_in_lp()) { |
|
|
|
echo Display::return_message(get_lang('AddedToLPCannotBeAccessed'), 'warning'); |
|
|
|
echo Display::return_message(get_lang('AddedToLPCannotBeAccessed'), 'warning'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($editQuestion && $objQuestion->existsInAnotherExercises()) { |
|
|
|
if ($editQuestion && $objQuestion->existsInAnotherExercises()) { |
|
|
|
echo Display::return_message( |
|
|
|
echo Display::return_message( |
|
|
|
Display::returnFontAwesomeIcon('exclamation-triangle"') |
|
|
|
Display::returnFontAwesomeIcon('exclamation-triangle"') |
|
|
|
@ -416,7 +414,6 @@ if ($newQuestion || $editQuestion) { |
|
|
|
$objExercise->edit_exercise_in_lp = true; |
|
|
|
$objExercise->edit_exercise_in_lp = true; |
|
|
|
require 'question_admin.inc.php'; |
|
|
|
require 'question_admin.inc.php'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($editQuestion) { |
|
|
|
if ($editQuestion) { |
|
|
|
// Question preview if teacher clicked the "switch to student" |
|
|
|
// Question preview if teacher clicked the "switch to student" |
|
|
|
if ($studentViewActive && $is_allowedToEdit) { |
|
|
|
if ($studentViewActive && $is_allowedToEdit) { |
|
|
|
|