ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
TestQuestionAdministrationInteraction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Test\Logging;
22
25use ILIAS\UI\Factory as UIFactory;
26use ILIAS\UI\Component\Listing\Descriptive as DescriptiveListing;
27use ILIAS\StaticURL\Services as StaticURLServices;
30
32{
33 public const IDENTIFIER = 'qai';
34
35 private int $id;
36
40 public function __construct(
41 private int $test_ref_id,
42 private int $question_id,
43 private int $admin_id,
44 private TestQuestionAdministrationInteractionTypes $interaction_type,
45 private int $modification_timestamp,
46 private array $additional_data
47 ) {
48
49 }
50
51 public function getUniqueIdentifier(): ?string
52 {
53 return self::IDENTIFIER . '_' . $this->id;
54 }
55
56 public function withId(int $id): self
57 {
58 $clone = clone $this;
59 $clone->id = $id;
60 return $clone;
61 }
62
65 TitleColumnsBuilder $title_builder,
66 DataRowBuilder $row_builder,
67 array $environment
68 ): DataRow {
69 $values = [
70 'date_and_time' => \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
71 ->setTimezone($environment['timezone']),
72 'corresponding_test' => $title_builder->buildTestTitleAsLink(
73 $this->test_ref_id
74 ),
75 'admin' => \ilUserUtil::getNamePresentation(
76 $this->admin_id,
77 false,
78 false,
79 '',
80 true
81 ),
82 'log_entry_type' => $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
83 'interaction_type' => $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value)
84 ];
85
86 if ($this->question_id !== null) {
87 $values['question'] = $title_builder->buildQuestionTitleAsLink(
88 $this->question_id,
89 $this->test_ref_id
90 );
91 }
92 return $row_builder->buildDataRow(
93 $this->getUniqueIdentifier(),
94 $values
95 )->withDisabledAction(
97 $this->additional_data === []
98 );
99 }
100
101 public function getLogEntryAsExportRow(
103 TitleColumnsBuilder $title_builder,
104 AdditionalInformationGenerator $additional_info,
105 array $environment
106 ): array {
107 return [
108 \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
109 ->setTimezone($environment['timezone'])
110 ->format($environment['date_format']),
111 $title_builder->buildTestTitleAsText($this->test_ref_id),
112 \ilUserUtil::getNamePresentation(
113 $this->admin_id,
114 false,
115 false,
116 '',
117 true
118 ),
119 '',
120 '',
121 $title_builder->buildQuestionTitleAsText($this->question_id),
122 $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
123 $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value),
124 $additional_info->parseForExport($this->additional_data, $environment)
125 ];
126 }
127
129 AdditionalInformationGenerator $additional_info,
130 UIFactory $ui_factory,
131 array $environment
132 ): DescriptiveListing {
133 return $additional_info->parseForTable($this->additional_data, $environment);
134 }
135
136 public function toStorage(): array
137 {
138 return [
139 'ref_id' => [\ilDBConstants::T_INTEGER , $this->test_ref_id],
140 'qst_id' => [\ilDBConstants::T_INTEGER , $this->question_id],
141 'admin_id' => [\ilDBConstants::T_INTEGER , $this->admin_id],
142 'interaction_type' => [\ilDBConstants::T_TEXT , $this->interaction_type->value],
143 'modification_ts' => [\ilDBConstants::T_INTEGER , $this->modification_timestamp],
144 'additional_data' => [\ilDBConstants::T_CLOB , json_encode($this->additional_data)]
145 ];
146 }
147}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
getLogEntryAsDataTableRow(\ilLanguage $lng, TitleColumnsBuilder $title_builder, DataRowBuilder $row_builder, array $environment)
getParsedAdditionalInformation(AdditionalInformationGenerator $additional_info, UIFactory $ui_factory, array $environment)
__construct(private int $test_ref_id, private int $question_id, private int $admin_id, private TestQuestionAdministrationInteractionTypes $interaction_type, private int $modification_timestamp, private array $additional_data)
getLogEntryAsExportRow(\ilLanguage $lng, TitleColumnsBuilder $title_builder, AdditionalInformationGenerator $additional_info, array $environment)
buildQuestionTitleAsLink(int $question_id, int $test_ref_id)
language handling
Class ilUserUtil.
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...
buildDataRow(string $id, array $record)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:26