ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilAssLacAnswerValueNotExist.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 public function __construct(
33 protected ?int $question_index,
34 protected string $value,
35 protected ?int $answer_index = null
36 ) {
37 if ($this->getQuestionIndex() === null && $this->getAnswerIndex() === null) {
38 $msg = "The value \"{$value}\" does not exist for the current question";
39 } elseif ($this->getQuestionIndex() === null) {
40 $msg = "The value \"{$value}\" does not exist for the answer with index \"{$this->getAnswerIndex()}\" of the current question";
41 } elseif ($this->getAnswerIndex() === null) {
42 $msg = "The value \"{$value}\" does not exist for the question Q{$this->getQuestionIndex()}";
43 } else {
44 $msg = "The value \"{$value}\" does not exist for the question Q{$this->getQuestionIndex()}[{$this->getAnswerIndex()}]";
45 }
46
48 }
49
50 public function getQuestionIndex(): ?int
51 {
52 return $this->question_index;
53 }
54
55 public function getAnswerIndex(): ?int
56 {
57 return $this->answer_index;
58 }
59
60 public function getValue(): string
61 {
62 return $this->value;
63 }
64
65 public function getFormAlert(ilLanguage $lng): string
66 {
67 if ($this->getQuestionIndex() === null && $this->getAnswerIndex() === null) {
68 return sprintf(
69 $lng->txt('ass_lac_answer_value_not_exists_cur_qst_one_answer'),
70 $this->getValue()
71 );
72 }
73
74 if ($this->getQuestionIndex() === null) {
75 return sprintf(
76 $lng->txt('ass_lac_answer_value_not_exists_cur_qst'),
77 $this->getValue(),
78 $this->getAnswerIndex()
79 );
80 }
81
82 if ($this->getAnswerIndex() === null) {
83 return sprintf(
84 $lng->txt('ass_lac_answer_value_not_exists_one_answer'),
85 $this->getValue(),
86 $this->getQuestionIndex()
87 );
88 }
89
90 return sprintf(
91 $lng->txt('ass_lac_answer_value_not_exists'),
92 $this->getValue(),
93 $this->getQuestionIndex(),
94 $this->getAnswerIndex()
95 );
96 }
97}
__construct(protected ?int $question_index, protected string $value, protected ?int $answer_index=null)
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31