Removing $fromExercise value see BT#6262

skala
Julio Montoya 13 years ago
parent 892c66df24
commit 81584e91bb
  1. 10
      main/exercice/admin.php
  2. 5
      main/exercice/question.class.php
  3. 9
      main/exercice/question_admin.inc.php
  4. 4
      main/exercice/question_list_admin.inc.php
  5. 6
      main/exercice/question_pool.php

@ -111,9 +111,6 @@ if (empty($clone_question)) {
if (empty($questionId)) { if (empty($questionId)) {
$questionId = isset($_SESSION['questionId'])?$_SESSION['questionId']:0; $questionId = isset($_SESSION['questionId'])?$_SESSION['questionId']:0;
} }
if (empty($modifyExercise)) {
$modifyExercise = isset($_GET['modifyExercise'])?$_GET['modifyExercise']:0;
}
// Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc // Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc
@ -188,13 +185,6 @@ if ($objExercise->fastEdition) {
$htmlHeadXtra[] = api_get_jqgrid_js(); $htmlHeadXtra[] = api_get_jqgrid_js();
} }
// Doesn't select the exercise ID if we come from the question pool
if (!isset($fromExercise) or !$fromExercise) {
// gets the right exercise ID, and if 0 creates a new exercise
if (!$exerciseId = $objExercise->selectId()) {
$modifyExercise = 'yes';
}
}
$nbrQuestions = $objExercise->getQuestionCount(); $nbrQuestions = $objExercise->getQuestionCount();
// Initializes the Question object // Initializes the Question object

@ -1570,11 +1570,6 @@ abstract class Question
$defaults['questionCategory'] = $this->category_list; $defaults['questionCategory'] = $this->category_list;
$defaults['parent_id'] = $this->parent_id; $defaults['parent_id'] = $this->parent_id;
//Came from he question pool
if (isset($_GET['fromExercise'])) {
$form->setDefaults($defaults);
}
if (!empty($_REQUEST['myid'])) { if (!empty($_REQUEST['myid'])) {
$form->setDefaults($defaults); $form->setDefaults($defaults);
} else { } else {

@ -37,7 +37,14 @@ if (is_object($objQuestion)) {
$objQuestion->submitText = get_lang('AddQuestionToExercise'); $objQuestion->submitText = get_lang('AddQuestionToExercise');
} }
if (!isset($_GET['fromExercise'])) { /*if (!isset($_GET['fromExercise'])) {
$objQuestion->setDefaultQuestionValues = true;
}*/
// This condition depends of the exercice/question_create.php page that sets the "isContent" value
if (isset($_REQUEST['newQuestion']) && $_REQUEST['newQuestion'] == 'yes' &&
(isset($_REQUEST['isContent']) && $_REQUEST['isContent'] == '1')
) {
$objQuestion->setDefaultQuestionValues = true; $objQuestion->setDefaultQuestionValues = true;
} }

@ -140,7 +140,7 @@ if (!$inATest) {
if (is_array($questionList)) { if (is_array($questionList)) {
foreach ($questionList as $id) { foreach ($questionList as $id) {
//To avoid warning messages // To avoid warning messages
if (!is_numeric($id)) { if (!is_numeric($id)) {
continue; continue;
} }
@ -148,7 +148,7 @@ if (!$inATest) {
$question_class = get_class($objQuestionTmp); $question_class = get_class($objQuestionTmp);
$clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>'; $clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
$edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&fromExercise='.$exerciseId.'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>'; $edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
if ($objExercise->edit_exercise_in_lp == true) { if ($objExercise->edit_exercise_in_lp == true) {
$delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>'; $delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
} }

@ -1,4 +1,8 @@
<?php <?php
// A new question pool code was added
exit;
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
@ -14,7 +18,7 @@
* Code * Code
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
exit;
use \ChamiloSession as Session; use \ChamiloSession as Session;
$language_file = 'exercice'; $language_file = 'exercice';

Loading…
Cancel
Save