Exercise: Fix delete question when it was imported from other exercise in different course - refs GH#4555

pull/4591/head
Borja Sánchez 3 years ago
parent 31635d10ca
commit fdb5df8e09
  1. 14
      main/exercise/question_list_admin.inc.php

@ -327,23 +327,18 @@ if (!$inATest) {
['class' => 'btn btn-default btn-sm'] ['class' => 'btn btn-default btn-sm']
); );
$delete_link = null; $delete_link = null;
if ($objExercise->edit_exercise_in_lp == true) { if ($objExercise->edit_exercise_in_lp) {
$delete = false; $delete = true;
$questionInOtherQuizs = true; $questionInOtherQuizs = true;
$results = Question::countQuizzesUsingQuestion($id); $results = Question::countQuizzesUsingQuestion($id);
if ($results > 1) { if ($results > 1) {
$masterExerciseId = Question::getMasterQuizForQuestion($id); $masterExerciseId = Question::getMasterQuizForQuestion($id);
if ($masterExerciseId == $exerciseId) { if ($masterExerciseId !== $exerciseId) {
$delete = true;
$questionInOtherQuizs = true;
} else {
$questionInOtherQuizs = false; $questionInOtherQuizs = false;
} }
} else {
$delete = true;
} }
if ($delete) {
$delete_link = Display::url( $delete_link = Display::url(
Display::return_icon( Display::return_icon(
'delete.png', 'delete.png',
@ -364,7 +359,6 @@ if (!$inATest) {
] ]
); );
} }
}
if ($limitTeacherAccess && !api_is_platform_admin()) { if ($limitTeacherAccess && !api_is_platform_admin()) {
$delete_link = ''; $delete_link = '';

Loading…
Cancel
Save