ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
QstsQuestionPage.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27use ILIAS\Data\UUID\Factory as UuidFactory;
28
30{
31 private UuidFactory $uuid_factory;
32
33 private readonly Edit $edit_view;
35 private ?Attempt $attempt_data = null;
36 private ?Viewable $participant_view = null;
39
40 private static array $answer_form_mapping = [];
41
42 #[\Override]
43 public function afterConstructor(): void
44 {
45 $this->uuid_factory = new UuidFactory();
46 }
47
48 #[\Override]
49 public function getParentType(): string
50 {
51 return 'qsts';
52 }
53
54 public function getEditView(): Edit
55 {
56 return $this->edit_view;
57 }
58
59 public function setEditView(
61 ): void {
62 $this->edit_view = $edit_view;
63 }
64
65 public function getQuestion(): Question
66 {
67 return $this->question;
68 }
69
70 public function setQuestion(
71 Question $question
72 ): void {
73 $this->question = $question;
74 }
75
76 public function getParticipantView(): Viewable
77 {
78 return $this->participant_view;
79 }
80
81 public function setParticipantView(
82 Viewable $participant_view
83 ): void {
84 $this->participant_view = $participant_view;
85 }
86
87 public function getAttemptData(): ?Attempt
88 {
89 return $this->attempt_data;
90 }
91
92 public function setAttemptData(
93 ?Attempt $attempt_data
94 ): void {
95 $this->attempt_data = $attempt_data;
96 }
97
99 {
100 return $this->required_capabilites;
101 }
102
103 public function setRequiredCapabilities(
104 RequiredCapabilities $required_capabilities
105 ): void {
106 $this->required_capabilites = $required_capabilities;
107 }
108
110 {
111 return $this->view_configuration;
112 }
113
114 public function setViewConfiguration(
115 ViewConfiguration $view_configuration
116 ): void {
117 $this->view_configuration = $view_configuration;
118 }
119
120 #[\Override]
121 public function pasteContents(
122 string $page_content_id,
123 bool $a_self_ass = false
124 ): array|bool {
125 $answer_form_element = $this->page_manager
126 ->content($this->getDomDoc())
127 ->getContentDomNode(...explode(':', $page_content_id))
128 ?->getElementsByTagName(ilPCAnswerForm::ANSWER_FORM_ELEMENT_TAG);
129
130 if ($answer_form_element?->length > 0) {
131 foreach ($answer_form_element->getIterator() as $node) {
132 self::$answer_form_mapping[$node->getAttribute(ilPCAnswerForm::ANSWER_FORM_ID_ATTRIBUTE)]
133 = $this->uuid_factory->uuid4AsString();
134 }
135 }
136
137 return parent::pasteContents($page_content_id, $a_self_ass);
138 }
139
140 #[\Override]
141 public function cutContents(
142 array $page_content_ids
143 ): array|bool {
144 return parent::cutContents(
145 array_filter(
146 $page_content_ids,
147 fn(string $v): bool => $this->page_manager
148 ->content($this->getDomDoc())
149 ->getContentDomNode(...explode(':', $v))
150 ?->getElementsByTagName('AnswerForm')
151 ?->length < 1
152 )
153 );
154 }
155
163 public static function getAnswerFormMapping(): array
164 {
165 return self::$answer_form_mapping;
166 }
167
168 public static function setAnswerFormMapping(
169 array $answer_form_mapping
170 ): void {
171 self::$answer_form_mapping = $answer_form_mapping;
172 }
173
174 public function addQuestionText(
175 string $text
176 ): void {
177 $this->buildDom();
178
179 $lng = $this->user->getLanguage();
180 if ($lng === '') {
181 $lng = 'de';
182 }
183
184 $page_element = new \ilPCParagraph($this);
185 $page_element->create($this, 'pg');
186 $page_element->setLanguage($lng);
187 $page_element->setText($text);
188
189 $this->update();
190 }
191}
cutContents(array $page_content_ids)
Copy contents to clipboard and cut them from the page.
setAttemptData(?Attempt $attempt_data)
setViewConfiguration(ViewConfiguration $view_configuration)
Viewable $participant_view
ViewConfiguration $view_configuration
readonly Edit $edit_view
static array $answer_form_mapping
setRequiredCapabilities(RequiredCapabilities $required_capabilities)
setQuestion(Question $question)
setEditView(Edit $edit_view)
static setAnswerFormMapping(array $answer_form_mapping)
addQuestionText(string $text)
RequiredCapabilities $required_capabilites
UuidFactory $uuid_factory
pasteContents(string $page_content_id, bool $a_self_ass=false)
Paste contents from pc clipboard.
setParticipantView(Viewable $participant_view)
static getAnswerFormMapping()
2026-06-30, sk:This is awfull, but as there are statics used in the copy process this is the only way...
const string ANSWER_FORM_ID_ATTRIBUTE
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:26
$text
Definition: xapiexit.php:21