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. 5
      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. 3
      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. 2
      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;

@ -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.

@ -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;

@ -1816,7 +1816,7 @@ abstract class Question
*/
public function getExplanation()
{
return $this->explanationLangVar;
return get_lang($this->explanationLangVar);
}
/**

@ -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