Fix exercise question label + format code + fix behat test

pull/3064/head
Julio 6 years ago
parent 378e17017c
commit 6183a2e909
  1. 1
      public/main/exercise/Annotation.php
  2. 3
      public/main/exercise/Draggable.php
  3. 3
      public/main/exercise/MatchingDraggable.php
  4. 21
      public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php
  5. 5
      public/main/exercise/ReadingComprehension.php
  6. 3
      public/main/exercise/UniqueAnswerImage.php
  7. 3
      public/main/exercise/calculated_answer.class.php
  8. 2
      public/main/exercise/exercise.class.php
  9. 2
      public/main/exercise/exercise_admin.php
  10. 135
      public/main/exercise/fill_blanks.class.php
  11. 5
      public/main/exercise/freeanswer.class.php
  12. 3
      public/main/exercise/global_multiple_answer.class.php
  13. 5
      public/main/exercise/hotspot.class.php
  14. 2
      public/main/exercise/multiple_answer.class.php
  15. 3
      public/main/exercise/multiple_answer_combination.class.php
  16. 3
      public/main/exercise/multiple_answer_combination_true_false.class.php
  17. 3
      public/main/exercise/multiple_answer_true_false.class.php
  18. 5
      public/main/exercise/oral_expression.class.php
  19. 38
      public/main/exercise/question.class.php
  20. 3
      public/main/exercise/question_admin.inc.php
  21. 22
      public/main/exercise/question_list_admin.inc.php
  22. 2
      public/main/exercise/unique_answer.class.php
  23. 3
      public/main/exercise/unique_answer_no_option.class.php
  24. 4
      tests/behat/features/toolExercise.feature

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -9,7 +10,7 @@
class Draggable extends Question
{
public $typePicture = 'ordering.png';
public $explanationLangVar = 'Draggable';
public $explanationLangVar = 'Sequence ordering';
/**
* Class constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -9,7 +10,7 @@
class MatchingDraggable extends Question
{
public $typePicture = 'matchingdrag.png';
public $explanationLangVar = 'MatchingDraggable';
public $explanationLangVar = 'Match by dragging';
/**
* Class constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -7,8 +8,6 @@ use ChamiloSession as Session;
* Class MultipleAnswerTrueFalseDegreeCertainty
* This class allows to instantiate an object of type MULTIPLE_ANSWER
* (MULTIPLE CHOICE, MULTIPLE ANSWER), extending the class question.
*
* @package chamilo.exercise
*/
class MultipleAnswerTrueFalseDegreeCertainty extends Question
{
@ -19,7 +18,7 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
const LEVEL_DARKRED = 5;
public $typePicture = 'mccert.png';
public $explanationLangVar = 'MultipleAnswerTrueFalseDegreeCertainty';
public $explanationLangVar = 'Multiple answer true/false/degree of certainty';
public $optionsTitle;
public $options;
@ -831,17 +830,17 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
$colWidth = $widthTable / 5;
$html .= '<tr>
<td class="firstLine borderRight '.$classGlobalChart.'"
colspan="2"
<td class="firstLine borderRight '.$classGlobalChart.'"
colspan="2"
style="width:'.($colWidth * 2).'px; line-height: 15px; font-size:'.$textSize.'%;">'.
sprintf(get_lang('Incorrect answers: %s'), $nbResponsesInc).'
</td>
<td class="firstLine borderRight '.$classGlobalChart.'"
<td class="firstLine borderRight '.$classGlobalChart.'"
style="width:'.$colWidth.'px; line-height: 15px; font-size :'.$textSize.'%;">'.
sprintf(get_lang('Ignorance: %s'), $nbResponsesIng).'
</td>
<td class="firstLine '.$classGlobalChart.'"
colspan="2"
<td class="firstLine '.$classGlobalChart.'"
colspan="2"
style="width:'.($colWidth * 2).'px; line-height: 15px; font-size:'.$textSize.'%;">'.
sprintf(get_lang('Correct answers: %s'), $nbResponsesCor).'
</td>
@ -1147,8 +1146,8 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
$tblAnswerOption = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$courseId = api_get_course_int_id();
$optionId = (int) $optionId;
$sql = "SELECT position
FROM $tblAnswerOption
$sql = "SELECT position
FROM $tblAnswerOption
WHERE c_id = $courseId AND id = $optionId";
$res = Database::query($sql);
@ -1232,7 +1231,7 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
$tableTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$exeId = (int) $exeId;
$sql = "SELECT exe_exo_id
$sql = "SELECT exe_exo_id
FROM $tableTrackEExercise
WHERE exe_id=".$exeId;
$res = Database::query($sql);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -6,13 +7,11 @@
*
* This class allows to instantiate an object of type READING_COMPREHENSION
* extending the class question
*
* @package chamilo.exercise
*/
class ReadingComprehension extends UniqueAnswer
{
public $typePicture = 'reading-comprehension.png';
public $explanationLangVar = 'ReadingComprehension';
public $explanationLangVar = 'Reading comprehension';
/**
* Defines the different speeds of scrolling for the reading window,

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -11,7 +12,7 @@ use ChamiloSession as Session;
class UniqueAnswerImage extends UniqueAnswer
{
public $typePicture = 'uaimg.png';
public $explanationLangVar = 'UniqueAnswerImage';
public $explanationLangVar = 'Unique answer image';
/**
* UniqueAnswerImage constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Webit\Util\EvalMath\EvalMath;
@ -12,7 +13,7 @@ use Webit\Util\EvalMath\EvalMath;
class CalculatedAnswer extends Question
{
public $typePicture = 'calculated_answer.png';
public $explanationLangVar = 'CalculatedAnswer';
public $explanationLangVar = 'Calculated question';
/**
* Constructor.

@ -8435,7 +8435,7 @@ class Exercise
'legacy_main',
false,
'_self',
['class' => 'btn btn-secondary', 'icon' => 'fa fa-pen']
['class' => 'btn btn-secondary', 'icon' => 'fa fa-pen', 'title' => get_lang('Edit')]
);
$myRowAction->setRouteParameters(

@ -200,7 +200,7 @@ if ($form->validate()) {
Display::return_icon('back.png', get_lang("Back to").' '.get_lang('Learning paths'), '', ICON_SIZE_MEDIUM)."</a>";
} else {
echo '<a href="exercise.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('Back toTestsList'), '', ICON_SIZE_MEDIUM).
Display::return_icon('back.png', get_lang('Back to test list'), '', ICON_SIZE_MEDIUM).
'</a>';
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -14,7 +15,7 @@ class FillBlanks extends Question
public const FILL_THE_BLANK_SEVERAL_ANSWER = 2;
public $typePicture = 'fill_in_blanks.png';
public $explanationLangVar = 'FillBlanks';
public $explanationLangVar = 'Fill blanks or form';
/**
* Constructor.
@ -63,40 +64,40 @@ class FillBlanks extends Question
}
}
echo '<script>
var firstTime = true;
var originalOrder = new Array();
echo '<script>
var firstTime = true;
var originalOrder = new Array();
var blankSeparatorStart = "'.$blankSeparatorStart.'";
var blankSeparatorEnd = "'.$blankSeparatorEnd.'";
var blankSeparatorStartRegexp = getBlankSeparatorRegexp(blankSeparatorStart);
var blankSeparatorEndRegexp = getBlankSeparatorRegexp(blankSeparatorEnd);
var blanksRegexp = "/"+blankSeparatorStartRegexp+"[^"+blankSeparatorStartRegexp+"]*"+blankSeparatorEndRegexp+"/g";
CKEDITOR.on("instanceCreated", function(e) {
if (e.editor.name === "answer") {
if (e.editor.name === "answer") {
//e.editor.on("change", updateBlanks);
e.editor.on("change", function(){
updateBlanks();
});
}
});
function updateBlanks()
{
var answer;
{
var answer;
if (firstTime) {
var field = document.getElementById("answer");
answer = field.value;
} else {
answer = CKEDITOR.instances["answer"].getData();
}
// disable the save button, if not blanks have been created
$("button").attr("disabled", "disabled");
$("#defineoneblank").show();
var blanks = answer.match(eval(blanksRegexp));
var fields = "<div class=\"form-group \">";
$("#defineoneblank").show();
var blanks = answer.match(eval(blanksRegexp));
var fields = "<div class=\"form-group \">";
fields += "<label class=\"col-sm-2 control-label\"></label>";
fields += "<div class=\"col-sm-8\">";
fields += "<table class=\"data_table\">";
@ -107,34 +108,34 @@ class FillBlanks extends Question
if (blanks != null) {
for (var i=0; i < blanks.length; i++) {
// remove forbidden characters that causes bugs
blanks[i] = removeForbiddenChars(blanks[i]);
blanks[i] = removeForbiddenChars(blanks[i]);
// trim blanks between brackets
blanks[i] = trimBlanksBetweenSeparator(blanks[i], blankSeparatorStart, blankSeparatorEnd);
// if the word is empty []
if (blanks[i] == blankSeparatorStartRegexp+blankSeparatorEndRegexp) {
break;
}
// get input size
var inputSize = 100;
var inputSize = 100;
var textValue = blanks[i].substr(1, blanks[i].length - 2);
var btoaValue = textValue.hashCode();
if (firstTime == false) {
var element = document.getElementById("samplesize["+i+"]");
var element = document.getElementById("samplesize["+i+"]");
if (element) {
inputSize = document.getElementById("sizeofinput["+i+"]").value;
inputSize = document.getElementById("sizeofinput["+i+"]").value;
}
}
}
if (document.getElementById("weighting["+i+"]")) {
var value = document.getElementById("weighting["+i+"]").value;
} else {
var value = "1";
}
var value = "1";
}
var blanksWithColor = trimBlanksBetweenSeparator(blanks[i], blankSeparatorStart, blankSeparatorEnd, 1);
fields += "<tr>";
fields += "<td>"+blanksWithColor+"</td>";
fields += "<td><input class=\"form-control\" style=\"width:60px\" value=\""+value+"\" type=\"text\" id=\"weighting["+i+"]\" name=\"weighting["+i+"]\" /></td>";
@ -145,31 +146,31 @@ class FillBlanks extends Question
fields += "<input id=\"sizeofinput["+i+"]\" type=\"hidden\" value=\""+inputSize+"\" name=\"sizeofinput["+i+"]\" />";
fields += "</td>";
fields += "</tr>";
// enable the save button
$("button").removeAttr("disabled");
$("#defineoneblank").hide();
}
}
}
document.getElementById("blanks_weighting").innerHTML = fields + "</table></div></div>";
$(originalOrder).each(function(i, data) {
if (firstTime == false) {
value = data.value;
var d = $("input.sample[data-btoa=\'"+value+"\']");
var id = d.attr("id");
value = data.value;
var d = $("input.sample[data-btoa=\'"+value+"\']");
var id = d.attr("id");
if (id) {
var sizeInputId = id.replace("samplesize", "sizeofinput");
var sizeInputId = id.replace("samplesize", "sizeofinput");
var sizeInputId = sizeInputId.replace("[", "\\\[");
var sizeInputId = sizeInputId.replace("]", "\\\]");
$("#"+sizeInputId).val(data.width);
var sizeInputId = sizeInputId.replace("]", "\\\]");
$("#"+sizeInputId).val(data.width);
d.outerWidth(data.width+"px");
}
}
});
updateOrder(blanks);
updateOrder(blanks);
if (firstTime) {
firstTime = false;
@ -177,7 +178,7 @@ class FillBlanks extends Question
}
}
window.onload = updateBlanks;
window.onload = updateBlanks;
String.prototype.hashCode = function() {
var hash = 0, i, chr, len;
if (this.length === 0) return hash;
@ -188,35 +189,35 @@ class FillBlanks extends Question
}
return hash;
};
function updateOrder(blanks)
function updateOrder(blanks)
{
originalOrder = new Array();
originalOrder = new Array();
if (blanks != null) {
for (var i=0; i < blanks.length; i++) {
// remove forbidden characters that causes bugs
blanks[i] = removeForbiddenChars(blanks[i]);
blanks[i] = removeForbiddenChars(blanks[i]);
// trim blanks between brackets
blanks[i] = trimBlanksBetweenSeparator(blanks[i], blankSeparatorStart, blankSeparatorEnd);
// if the word is empty []
if (blanks[i] == blankSeparatorStartRegexp+blankSeparatorEndRegexp) {
break;
}
}
var textValue = blanks[i].substr(1, blanks[i].length - 2);
var btoaValue = textValue.hashCode();
if (firstTime == false) {
var element = document.getElementById("samplesize["+i+"]");
var element = document.getElementById("samplesize["+i+"]");
if (element) {
inputSize = document.getElementById("sizeofinput["+i+"]").value;
originalOrder.push({ "width" : inputSize, "value": btoaValue });
originalOrder.push({ "width" : inputSize, "value": btoaValue });
}
}
}
}
}
function changeInputSize(coef, inIdNum)
{
if (firstTime) {
@ -225,7 +226,7 @@ class FillBlanks extends Question
} else {
answer = CKEDITOR.instances["answer"].getData();
}
var blanks = answer.match(eval(blanksRegexp));
var currentWidth = $("#samplesize\\\["+inIdNum+"\\\]").width();
var newWidth = currentWidth + coef * 20;
@ -233,7 +234,7 @@ class FillBlanks extends Question
newWidth = Math.min(newWidth, 600);
$("#samplesize\\\["+inIdNum+"\\\]").outerWidth(newWidth);
$("#sizeofinput\\\["+inIdNum+"\\\]").attr("value", newWidth);
updateOrder(blanks);
}
@ -247,7 +248,7 @@ class FillBlanks extends Question
outTxt = outTxt.replace(/&nbsp;/g, " ");
outTxt = outTxt.replace(/^ +/, "");
outTxt = outTxt.replace(/ +$/, "");
return outTxt;
}
@ -298,11 +299,11 @@ class FillBlanks extends Question
result = result.replace(inSeparatorStart, "");
result = result.replace(inSeparatorEnd, "");
result = result.trim();
if (addColor == 1) {
var resultParts = result.split("|");
var partsToString = "";
resultParts.forEach(function(item, index) {
var partsToString = "";
resultParts.forEach(function(item, index) {
if (index == 0) {
item = "<b><font style=\"color:green\"> " + item +"</font></b>";
}
@ -313,10 +314,10 @@ class FillBlanks extends Question
});
result = partsToString;
}
return inSeparatorStart+result+inSeparatorEnd;
}
</script>';
// answer
@ -889,15 +890,15 @@ class FillBlanks extends Question
// we got the less recent attempt first
$sql = 'SELECT * FROM '.$tblTrackEAttempt.' tea
LEFT JOIN '.$tblTrackEExercise.' tee
ON
tee.exe_id = tea.exe_id AND
tea.c_id = '.$courseId.' AND
exe_exo_id = '.$testId.'
WHERE
tee.c_id = '.$courseId.' AND
question_id = '.$questionId.' AND
tea.user_id IN ('.implode(',', $studentsIdList).') AND
tea.tms >= "'.$startDate.'" AND
ON
tee.exe_id = tea.exe_id AND
tea.c_id = '.$courseId.' AND
exe_exo_id = '.$testId.'
WHERE
tee.c_id = '.$courseId.' AND
question_id = '.$questionId.' AND
tea.user_id IN ('.implode(',', $studentsIdList).') AND
tea.tms >= "'.$startDate.'" AND
tea.tms <= "'.$endDate.'"
ORDER BY user_id, tea.exe_id;
';
@ -1256,8 +1257,8 @@ class FillBlanks extends Question
}
if ($hideExpectedAnswer) {
$correctAnswerHtml = "<span
class='feedback-green'
$correctAnswerHtml = "<span
class='feedback-green'
title='".get_lang('Note: This test has been setup to hide the expected answers.')."'> &#8212; </span>";
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -6,14 +7,12 @@
* This class allows to instantiate an object of type FREE_ANSWER,
* extending the class question.
*
* @package chamilo.exercise
*
* @author Eric Marguin
*/
class FreeAnswer extends Question
{
public $typePicture = 'open_answer.png';
public $explanationLangVar = 'FreeAnswer';
public $explanationLangVar = 'Open question';
/**
* Constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -9,7 +10,7 @@ use ChamiloSession as Session;
class GlobalMultipleAnswer extends Question
{
public $typePicture = 'mcmagl.png';
public $explanationLangVar = 'GlobalMultipleAnswer';
public $explanationLangVar = 'Combination true/false/don\'t-know';
/**
* GlobalMultipleAnswer constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -9,13 +10,11 @@
* extending the class question
*
* @author Eric Marguin
*
* @package chamilo.exercise
*/
class HotSpot extends Question
{
public $typePicture = 'hotspot.png';
public $explanationLangVar = 'HotSpot';
public $explanationLangVar = 'Image zones';
/**
* HotSpot constructor.

@ -14,7 +14,7 @@ use ChamiloSession as Session;
class MultipleAnswer extends Question
{
public $typePicture = 'mcma.png';
public $explanationLangVar = 'MultipleSelect';
public $explanationLangVar = 'Multiple answer';
/**
* Constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -15,7 +16,7 @@ use ChamiloSession as Session;
class MultipleAnswerCombination extends Question
{
public $typePicture = 'mcmac.png';
public $explanationLangVar = 'MultipleSelectCombination';
public $explanationLangVar = 'Exact Selection';
/**
* Constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -8,8 +9,6 @@
* extending the class question
*
* @author Eric Marguin
*
* @package chamilo.exercise
*/
class MultipleAnswerCombinationTrueFalse extends MultipleAnswerCombination
{

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -13,7 +14,7 @@ use ChamiloSession as Session;
class MultipleAnswerTrueFalse extends Question
{
public $typePicture = 'mcmao.png';
public $explanationLangVar = 'MultipleAnswerTrueFalse';
public $explanationLangVar = 'Multiple answer true/false/don\'t know';
public $options;
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -7,13 +8,11 @@
* extending the class question.
*
* @author Eric Marguin
*
* @package chamilo.exercise
*/
class OralExpression extends Question
{
public $typePicture = 'audio_question.png';
public $explanationLangVar = 'OralExpression';
public $explanationLangVar = 'Oral expression';
public $available_extensions = ['wav', 'ogg'];
private $sessionId;
private $userId;

@ -901,8 +901,8 @@ abstract class Question
$sql = "SELECT question_order
FROM $table
WHERE
c_id = $courseId AND
question_id = $id AND
c_id = $courseId AND
question_id = $id AND
exercice_id = $exerciseId";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
@ -911,8 +911,8 @@ abstract class Question
$sql = "UPDATE $table
SET question_order = question_order-1
WHERE
c_id = $courseId AND
exercice_id = $exerciseId AND
c_id = $courseId AND
exercice_id = $exerciseId AND
question_order > ".$row['question_order'];
Database::query($sql);
}
@ -920,8 +920,8 @@ abstract class Question
$sql = "DELETE FROM $table
WHERE
c_id = $courseId AND
question_id = $id AND
c_id = $courseId AND
question_id = $id AND
exercice_id = $exerciseId";
Database::query($sql);
@ -962,7 +962,7 @@ abstract class Question
// if the question must be removed from all exercises
if (!$deleteFromEx) {
//update the question_order of each question to avoid inconsistencies
$sql = "SELECT exercice_id, question_order
$sql = "SELECT exercice_id, question_order
FROM $TBL_EXERCISE_QUESTION
WHERE c_id = $courseId AND question_id = ".$id;
@ -973,8 +973,8 @@ abstract class Question
$sql = "UPDATE $TBL_EXERCISE_QUESTION
SET question_order = question_order-1
WHERE
c_id = $courseId AND
exercice_id = ".intval($row['exercice_id'])." AND
c_id = $courseId AND
exercice_id = ".intval($row['exercice_id'])." AND
question_order > ".$row['question_order'];
Database::query($sql);
}
@ -995,8 +995,8 @@ abstract class Question
// remove the category of this question in the question_rel_category table
$sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
WHERE
c_id = $courseId AND
WHERE
c_id = $courseId AND
question_id = ".$id;
Database::query($sql);
@ -1098,7 +1098,7 @@ abstract class Question
$newQuestionId = Database::insert($questionTable, $params);
if ($newQuestionId) {
$sql = "UPDATE $questionTable
$sql = "UPDATE $questionTable
SET id = iid
WHERE iid = $newQuestionId";
Database::query($sql);
@ -1112,7 +1112,7 @@ abstract class Question
unset($item['iid']);
$id = Database::insert($TBL_QUESTION_OPTIONS, $item);
if ($id) {
$sql = "UPDATE $TBL_QUESTION_OPTIONS
$sql = "UPDATE $TBL_QUESTION_OPTIONS
SET id = iid
WHERE iid = $id";
Database::query($sql);
@ -1760,7 +1760,7 @@ abstract class Question
// Get the max position
$sql = "SELECT max(position) as max_position
FROM $tbl_quiz_question q
FROM $tbl_quiz_question q
INNER JOIN $tbl_quiz_rel_question r
ON
q.id = r.question_id AND
@ -1783,7 +1783,7 @@ abstract class Question
$question_id = Database::insert($tbl_quiz_question, $params);
if ($question_id) {
$sql = "UPDATE $tbl_quiz_question
$sql = "UPDATE $tbl_quiz_question
SET id = iid WHERE iid = $question_id";
Database::query($sql);
@ -1816,7 +1816,7 @@ abstract class Question
*/
public function getExplanation()
{
return $this->explanationLangVar;
return get_lang($this->explanationLangVar);
}
/**
@ -2059,10 +2059,10 @@ abstract class Question
$result = $em
->createQuery('
SELECT e
SELECT e
FROM ChamiloCourseBundle:CQuizRelQuestion qq
JOIN ChamiloCourseBundle:CQuiz e
WHERE e.iid = qq.exerciceId AND qq.questionId = :id
JOIN ChamiloCourseBundle:CQuiz e
WHERE e.iid = qq.exerciceId AND qq.questionId = :id
')
->setParameters(['id' => (int) $this->id])
->getResult();

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -6,8 +7,6 @@
* It is included from the script admin.php.
*
* @author Olivier Brouckaert
*
* @version $Id: question_admin.inc.php 22126 2009-07-15 22:38:39Z juliomontoya $
*/
if (isset($_GET['editQuestion'])) {
$objQuestion = Question::read($_GET['editQuestion']);

@ -4,8 +4,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.exercise
*
* @author Olivier Brouckaert & Julio Montoya & Hubert Borderiou 21-10-2011 (Question by category)
* QUESTION LIST ADMINISTRATION
*
@ -175,7 +173,6 @@ if (!$inATest) {
$questionList = $objExercise->getQuestionForTeacher($start, $length);
$paginator = new Knp\Component\Pager\Paginator();
$pagination = $paginator->paginate([]);
$pagination->setTotalItemCount($nbrQuestions);
$pagination->setItemNumberPerPage($length);
$pagination->setCurrentPageNumber($page);
@ -305,18 +302,17 @@ if (!$inATest) {
'.$move.' '.cut($title, 42).'
</a>';
// Question type
$typeImg = $objQuestionTmp->getTypePicture();
$typeExpl = $objQuestionTmp->getExplanation();
$questionType = Display::return_icon($typeImg, $typeExpl);
$questionType = Display::return_icon(
$objQuestionTmp->getTypePicture(),
$objQuestionTmp->getExplanation()
);
// Question category
$txtQuestionCat = Security::remove_XSS(
$questionCategory = Security::remove_XSS(
TestCategory::getCategoryNameForQuestion($objQuestionTmp->id)
);
if (empty($txtQuestionCat)) {
$txtQuestionCat = '-';
if (empty($questionCategory)) {
$questionCategory = '-';
}
// Question level
@ -340,9 +336,9 @@ if (!$inATest) {
<span class="visible-xs-inline">'.get_lang('Type').' </span>'
.$questionType.'
</div>
<div class="category col-sm-2 col-xs-12" title="'.$txtQuestionCat.'">
<div class="category col-sm-2 col-xs-12" title="'.$questionCategory.'">
<span class="visible-xs-inline">'.get_lang('Category').' </span>'
.cut($txtQuestionCat, 42).'
.cut($questionCategory, 42).'
</div>
<div class="level text-right col-sm-1 col-xs-6">
<span class="visible-xs-inline">'.get_lang('Difficulty').' </span>'

@ -18,7 +18,7 @@ use ChamiloSession as Session;
class UniqueAnswer extends Question
{
public $typePicture = 'mcua.png';
public $explanationLangVar = 'UniqueSelect';
public $explanationLangVar = 'Multiple choice';
/**
* Constructor.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -14,7 +15,7 @@ use ChamiloSession as Session;
class UniqueAnswerNoOption extends Question
{
public $typePicture = 'mcuao.png';
public $explanationLangVar = 'UniqueAnswerNoOption';
public $explanationLangVar = 'Unique answer with unknown';
/**
* Constructor.

@ -31,7 +31,7 @@ Feature: Exercise tool
| exercise_title | Exercise 1 |
And I fill in ckeditor field "exerciseDescription" with "Exercise description"
And I press "submitExercise"
Then I should see "Exercise added"
Then I should see "Test added"
Scenario: Edit an exercise
Given I am on "/main/exercise/exercise.php?cid=1"
@ -44,7 +44,7 @@ Feature: Exercise tool
Scenario: Add question "Multiple choice" to exercise created "Exercise 1"
Given I am on "/main/exercise/exercise.php?cid=1"
And I follow "Exercise 1"
And I follow "Edit"
And I follow "Add questions"
And I follow "Multiple choice"
When I fill in the following:
| questionName | Multiple choice |

Loading…
Cancel
Save