Fixing question title when adding a question using the question pool

skala
Julio Montoya 14 years ago
parent 2319baada3
commit e61192bb75
  1. 37
      main/exercice/question.class.php
  2. 10
      main/exercice/question_pool.php

@ -1037,26 +1037,35 @@ abstract class Question
// hidden values
$form->addElement('hidden','myid',$_REQUEST['myid']);
switch($answerType) {
case 1: $this->question = get_lang('langDefaultUniqueQuestion'); break;
case 2: $this->question = get_lang('langDefaultMultipleQuestion'); break;
case 3: $this->question = get_lang('langDefaultFillBlankQuestion'); break;
case 4: $this->question = get_lang('langDefaultMathingQuestion'); break;
case 5: $this->question = get_lang('langDefaultOpenQuestion'); break;
case 9: $this->question = get_lang('langDefaultMultipleQuestion'); break;
}
if (!isset($_GET['fromExercise'])) {
switch($answerType) {
case 1: $this->question = get_lang('langDefaultUniqueQuestion'); break;
case 2: $this->question = get_lang('langDefaultMultipleQuestion'); break;
case 3: $this->question = get_lang('langDefaultFillBlankQuestion'); break;
case 4: $this->question = get_lang('langDefaultMathingQuestion'); break;
case 5: $this->question = get_lang('langDefaultOpenQuestion'); break;
case 9: $this->question = get_lang('langDefaultMultipleQuestion'); break;
}
}
$form->addElement('html','</div>');
// default values
$defaults = array();
$defaults['questionName'] = $this -> question;
$defaults['questionDescription'] = $this -> description;
$defaults['questionLevel'] = $this -> level;
$defaults['questionName'] = $this -> question;
$defaults['questionDescription'] = $this -> description;
$defaults['questionLevel'] = $this -> level;
//Came from he question pool
if (isset($_GET['fromExercise'])) {
$form->setDefaults($defaults);
}
if (!empty($_REQUEST['myid'])) {
$form -> setDefaults($defaults);
$form->setDefaults($defaults);
} else {
if ($isContent == 1) {
$form -> setDefaults($defaults);
$form->setDefaults($defaults);
}
}
}

@ -244,8 +244,7 @@ if($is_allowedToEdit) {
echo get_lang('AnswerType');
echo ' : <select name="answerType">';
//answer type
if (!isset($answerType)) $answerType = -1;
{
if (!isset($answerType)) $answerType = -1; {
for ($answer_type = -1; $answer_type <=9; $answer_type++) {
$selected ='';
if ($answer_type!=0) {
@ -267,7 +266,7 @@ if($is_allowedToEdit) {
<button class="save" type="submit" name="name" value="<?php echo get_lang('Ok') ?>"><?php echo get_lang('Filter') ?></button>
<?php
echo '<a href="admin.php?',api_get_cidreq(),'&exerciseId=',$fromExercise,'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList')),get_lang('GoBackToQuestionList'),'</a>';
echo '<a href="admin.php?',api_get_cidreq(),'&exerciseId='.$fromExercise.'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList')),get_lang('GoBackToQuestionList'),'</a>';
/*if(!empty($fromExercise)) {
echo '<a href="admin.php?',api_get_cidreq(),'&exerciseId=',$fromExercise,'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList')),get_lang('GoBackToQuestionList'),'</a>';
} else {
@ -430,7 +429,8 @@ if($is_allowedToEdit) {
$i=1;
$session_id = api_get_session_id();
while ($row = Database::fetch_array($result)) {
while ($row = Database::fetch_array($result,'ASSOC')) {
// if we come from the exercise administration to get a question,
// don't show the questions already used by that exercise
@ -448,7 +448,7 @@ if($is_allowedToEdit) {
if (api_get_session_id() == 0 ){
echo '<td align="center"> <input type="checkbox" value="'.$row['id'].'" name="recup[]"/></td>';
}
echo ' <td><a href="admin.php?',api_get_cidreq(),'&editQuestion=',$row['id'],'&fromExercise=',$fromExercise,'">',$row['question'],'</a></td>';
echo ' <td><a href="admin.php?',api_get_cidreq(),'&editQuestion=',$row['id'],'&fromExercise='.$fromExercise.'&answerType='.$row['type'].'">',$row['question'],'</a></td>';
echo ' <td align="center" >';
if (empty($fromExercise)) {
echo '<a href="admin.php?'.api_get_cidreq().'&amp;editQuestion=',$row['id'],'"><img src="../img/edit.gif" border="0" alt="',get_lang('Modify'),'"></a>',

Loading…
Cancel
Save