Skip to content

Commit

Permalink
Exercise: add hide expected answer for PDF export BT#17914
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 27, 2020
1 parent 6440eb4 commit 984140b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main/exercise/exercise.class.php
Expand Up @@ -94,7 +94,7 @@ class Exercise
public $currentBlockedCategories;
public $hideComment;
public $hideNoAnswer;

public $hideExpectedAnswer;

/**
* Constructor of the class.
Expand Down Expand Up @@ -138,6 +138,7 @@ public function __construct($courseId = 0)
$this->preventBackwards = 0;
$this->hideComment = false;
$this->hideNoAnswer = false;
$this->hideExpectedAnswer = false;

if (!empty($courseId)) {
$courseInfo = api_get_course_info_by_id($courseId);
Expand Down Expand Up @@ -8253,6 +8254,10 @@ public function showExpectedChoice()
*/
public function showExpectedChoiceColumn()
{
if ($this->hideExpectedAnswer) {
return false;
}

if (!in_array($this->results_disabled, [
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
])
Expand Down
3 changes: 3 additions & 0 deletions main/inc/lib/exercise.lib.php
Expand Up @@ -4599,6 +4599,9 @@ public static function displayQuestionListByAttempt(
$objExercise->feedback_type = 2;
$objExercise->hideComment = true;
$objExercise->hideNoAnswer = true;
$objExercise->results_disabled = 0;
$objExercise->hideExpectedAnswer = true;
$show_results = true;
}

if ('embeddable' !== $origin &&
Expand Down

0 comments on commit 984140b

Please sign in to comment.