ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.assFormulaQuestionUnitCategory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 private int $id = 0;
29 private string $category = '';
30 private int $question_fi = 0;
31
32 public function initFormArray(array $data): void
33 {
34 $this->id = (int) $data['category_id'];
35 $this->category = $data['category'];
36 $this->question_fi = (int) $data['question_fi'];
37 }
38
39 public function setId(int $id): void
40 {
41 $this->id = $id;
42 }
43
44 public function getId(): int
45 {
46 return $this->id;
47 }
48
49 public function setCategory(string $category): void
50 {
51 $this->category = $category;
52 }
53
54 public function getCategory(): string
55 {
56 return $this->category;
57 }
58
59 public function getSanitizedCategory(): string
60 {
61 return $this->sanitizeString($this->getCategory());
62 }
63
64 public function setQuestionFi(int $question_fi): void
65 {
66 $this->question_fi = $question_fi;
67 }
68
69 public function getQuestionFi(): int
70 {
71 return $this->question_fi;
72 }
73
74 public function getDisplayString(): string
75 {
76 global $DIC;
77
78 $category = $this->getCategory();
79 $txt = $DIC->language()->txt("qpl_qst_formulaquestion_{$category}");
80 return strcmp("-qpl_qst_formulaquestion_{$category}-", $txt) !== 0
81 ? $this->sanitizeString($txt)
82 : $this->getSanitizedCategory();
83 }
84
85 private function sanitizeString(string $string): string
86 {
87 return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
88 }
89}
global $DIC
Definition: shib_login.php:26