ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAssLacAnswerIndexNotExist.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Exception/ilAssLacException.php';
4 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Exception/ilAssLacFormAlertProvider.php';
5 
16 {
20  protected $question_index;
21 
25  protected $answer_index;
26 
32  {
33  $this->question_index = $question_index;
34  $this->answer_index = $answer_index;
35 
36  if ($this->getQuestionIndex() === null) {
37  $msg = sprintf(
38  'The Current Question does not have an answer with the index "%s"',
39  $this->getAnswerIndex()
40  );
41  } else {
42  $msg = sprintf(
43  'The Question with index "Q%s" does not have an answer with the index "%s" ',
44  $this->getQuestionIndex(),
45  $this->getAnswerIndex()
46  );
47  }
48 
49  parent::__construct($msg);
50  }
51 
55  public function getQuestionIndex()
56  {
57  return $this->question_index;
58  }
59 
63  public function getAnswerIndex()
64  {
65  return $this->answer_index;
66  }
67 
72  public function getFormAlert(ilLanguage $lng)
73  {
74  if ($this->getQuestionIndex() === null) {
75  return sprintf(
76  $lng->txt("ass_lac_answer_index_not_exist_cur_qst"),
77  $this->getAnswerIndex()
78  );
79  }
80 
81  return sprintf(
82  $lng->txt("ass_lac_answer_index_not_exist"),
83  $this->getQuestionIndex(),
84  $this->getAnswerIndex()
85  );
86  }
87 }
__construct($question_index, $answer_index)
$lng
language handling
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...