ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssLacExpressionNotSupportedByQuestion.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 $expression;
21 
25  protected $question_index;
26 
32  {
33  $this->expression = $expression;
34  $this->question_index = $question_index;
35 
36  if( $this->getQuestionIndex() === null )
37  {
38  $msg = sprintf(
39  'The expression "%s" is not supported by the current question', $this->getExpression()
40  );
41  }
42  else
43  {
44  $msg = sprintf(
45  'The expression "%s" is not supported by the question with index "Q%s"',
46  $this->getExpression(), $this->getQuestionIndex()
47  );
48  }
49 
50  parent::__construct($msg);
51  }
52 
56  public function getQuestionIndex()
57  {
58  return $this->question_index;
59  }
60 
64  public function getExpression()
65  {
66  return $this->expression;
67  }
68 
73  public function getFormAlert(ilLanguage $lng)
74  {
75  if( $this->getQuestionIndex() === null )
76  {
77  return sprintf(
78  $lng->txt("ass_lac_expression_not_supported_by_cur_question"), $this->getExpression()
79  );
80  }
81 
82  return sprintf(
83  $lng->txt("ass_lac_expression_not_supported_by_question"), $this->getQuestionIndex(), $this->getExpression()
84  );
85  }
86 }
global $lng
Definition: privfeed.php:17
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...