Allow edit orphan questions see BT#15534

pull/3173/head
Julio Montoya 6 years ago
parent 533a143bf6
commit fc709ca68e
  1. 5
      main/admin/questions.php
  2. 4
      main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php
  3. 4
      main/exercise/UniqueAnswerImage.php
  4. 6
      main/exercise/global_multiple_answer.class.php
  5. 4
      main/exercise/multiple_answer.class.php
  6. 4
      main/exercise/multiple_answer_combination.class.php
  7. 4
      main/exercise/multiple_answer_true_false.class.php
  8. 6
      main/exercise/unique_answer.class.php
  9. 4
      main/exercise/unique_answer_no_option.class.php

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CQuizQuestion;
use ChamiloSession as Session;
use Doctrine\Common\Collections\Criteria;
use Knp\Component\Pager\Paginator;
@ -15,6 +16,10 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
Session::erase('objExercise');
Session::erase('objQuestion');
Session::erase('objAnswer');
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
$form = new FormValidator('admin_questions', 'get');

@ -211,7 +211,9 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
}
}
if ($objEx->edit_exercise_in_lp === true) {
if ($objEx->edit_exercise_in_lp === true ||
(empty($this->exerciseList) && empty($objEx->id))
) {
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'), 'class="btn btn-danger minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'), 'class="btn btn-primary plus"');
//$text and $class defined in calling script

@ -249,7 +249,9 @@ class UniqueAnswerImage extends UniqueAnswer
global $text;
$buttonGroup = [];
if ($objExercise->edit_exercise_in_lp == true) {
if ($objExercise->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($objExercise->id))
) {
//setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);

@ -174,11 +174,13 @@ class GlobalMultipleAnswer extends Question
global $text;
if ($obj_ex->edit_exercise_in_lp) {
if ($obj_ex->edit_exercise_in_lp ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
// setting the save button here and not in the question class.php
$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
$form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
$form->addButtonSave($text, 'submitQuestion');
// setting the save button here and not in the question class.php
}
$renderer->setElementTemplate('{element} ', 'lessAnswers');

@ -153,7 +153,9 @@ class MultipleAnswer extends Question
$buttonGroup = [];
global $text;
if ($obj_ex->edit_exercise_in_lp == true) {
if ($obj_ex->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
// setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);

@ -153,7 +153,9 @@ class MultipleAnswerCombination extends Question
$form->addText('weighting[1]', get_lang('Score'), false, ['value' => 10]);
global $text;
if ($obj_ex->edit_exercise_in_lp == true) {
if ($obj_ex->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
// setting the save button here and not in the question class.php
$buttonGroup = [
$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true),

@ -217,7 +217,9 @@ class MultipleAnswerTrueFalse extends Question
}
global $text;
if ($obj_ex->edit_exercise_in_lp == true) {
if ($obj_ex->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
// setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);

@ -276,8 +276,10 @@ class UniqueAnswer extends Question
global $text;
$buttonGroup = [];
//ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) {
if ($obj_ex->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
//setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);

@ -254,7 +254,9 @@ class UniqueAnswerNoOption extends Question
global $text;
//ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) {
if ($obj_ex->edit_exercise_in_lp == true ||
(empty($this->exerciseList) && empty($obj_ex->id))
) {
//setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);

Loading…
Cancel
Save