ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssLacAnswerValueNotExist.php
Go to the documentation of this file.
1<?php
2
29{
33 protected $question_index;
34
38 protected $value;
39
43 protected $answer_index;
44
51 {
52 $this->question_index = $question_index;
53 $this->answer_index = $answer_index;
54 $this->value = $value;
55
56 if ($this->getQuestionIndex() === null && $this->getAnswerIndex() === null) {
57 $msg = sprintf(
58 'The value "%s" does not exist for the current question',
59 $value
60 );
61 } elseif ($this->getQuestionIndex() === null) {
62 $msg = sprintf(
63 'The value "%s" does not exist for the answer with index "%s" of the current question',
64 $value,
65 $this->getAnswerIndex()
66 );
67 } elseif ($this->getAnswerIndex() === null) {
68 $msg = sprintf(
69 'The value "%s" does not exist for the question Q%s',
70 $value,
71 $this->getQuestionIndex()
72 );
73 } else {
74 $msg = sprintf(
75 'The value "%s" does not exist for the question Q%s[%s]',
76 $value,
77 $this->getQuestionIndex(),
78 $this->getAnswerIndex()
79 );
80 }
81
83 }
84
88 public function getQuestionIndex(): int
89 {
91 }
92
96 public function getAnswerIndex(): ?int
97 {
99 }
100
104 public function getValue(): string
105 {
106 return $this->value;
107 }
108
113 public function getFormAlert(ilLanguage $lng): string
114 {
115 if ($this->getQuestionIndex() === null && $this->getAnswerIndex() === null) {
116 return sprintf(
117 $lng->txt("ass_lac_answer_value_not_exists_cur_qst_one_answer"),
118 $this->getValue()
119 );
120 }
121
122 if ($this->getQuestionIndex() === null) {
123 return sprintf(
124 $lng->txt("ass_lac_answer_value_not_exists_cur_qst"),
125 $this->getValue(),
126 $this->getAnswerIndex()
127 );
128 }
129
130 if ($this->getAnswerIndex() === null) {
131 return sprintf(
132 $lng->txt("ass_lac_answer_value_not_exists_one_answer"),
133 $this->getValue(),
134 $this->getQuestionIndex()
135 );
136 }
137
138 return sprintf(
139 $lng->txt("ass_lac_answer_value_not_exists"),
140 $this->getValue(),
141 $this->getQuestionIndex(),
142 $this->getAnswerIndex()
143 );
144 }
145}
__construct($question_index, $value, $answer_index=null)
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31