ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
Properties.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\Refinery\Factory as Refinery;
26use ILIAS\UI\Factory as UIFactory;
30
31class Properties implements Property
32{
33 private ?PropertySequence $sequence = null;
35
36 public function __construct(
37 private readonly int $question_id,
38 private readonly GeneralQuestionProperties $question_properties,
39 ) {
40 if ($question_id !== $question_properties->getQuestionId()) {
41 throw new \Exception(
42 sprintf(
43 'The question ids do not match. Id local: %s. Id properties: %s.',
44 $question_id,
45 $question_properties->getQuestionId()
46 )
47 );
48 }
49
50 $this->aggregated_results = new PropertyAggregatedResults($question_id);
51 }
52
53 public function getQuestionId(): int
54 {
55 return $this->question_id;
56 }
57
59 {
60 return $this->question_properties;
61 }
62
64 {
65 return $this->sequence;
66 }
67
69 {
70 $clone = clone $this;
71 $clone->sequence = $sequence;
72 return $clone;
73 }
74
76 {
78 }
79
81 {
82 $clone = clone $this;
83 $clone->aggregated_results = $aggregated_results;
84 return $clone;
85 }
86
87 public function getAsQuestionsTableRow(
89 UIFactory $ui_factory,
91 \Closure $question_target_link_builder,
92 OrderingRowBuilder $row_builder,
93 TitleColumnsBuilder $title_builder
94 ): OrderingRow {
95 return $row_builder->buildOrderingRow(
96 (string) $this->question_id,
97 [
98 'question_id' => $this->question_id,
99 'title' => $ui_factory->link()->standard(
100 $refinery->encode()->htmlSpecialCharsAsEntities()->transform(
101 $this->question_properties->getTitle()
102 ),
103 $question_target_link_builder($this->question_id)
104 ),
105 'description' => $this->question_properties->getDescription(),
106 'type_tag' => $this->question_properties->getTypeName($lng),
107 'points' => $this->question_properties->getAvailablePoints(),
108 'author' => $this->question_properties->getAuthor(),
109 'complete' => $this->question_properties->isRequiredInformationComplete(),
110 'lifecycle' => new \ilAssQuestionLifecycle($this->question_properties->getLifecycle())->getTranslation($lng) ?? '',
111 'qpl' => $title_builder->buildAccessCheckedQuestionpoolTitleAsLink($this->question_properties->getOriginObjectId()),
112 'nr_of_answers' => $this->getAggregatedResults()->getNumberOfAnswers(),
113 'average_points' => $this->getAggregatedResults()->getAveragePoints(),
114 'percentage_points_achieved' => round($this->getAggregatedResults()->getPercentageOfPointsAchieved(), 2) . '%'
115 ]
116 );
117 }
118}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
__construct(private readonly int $question_id, private readonly GeneralQuestionProperties $question_properties,)
Definition: Properties.php:36
PropertyAggregatedResults $aggregated_results
Definition: Properties.php:34
withSequenceInformation(PropertySequence $sequence)
Definition: Properties.php:68
getAsQuestionsTableRow(Language $lng, UIFactory $ui_factory, Refinery $refinery, \Closure $question_target_link_builder, OrderingRowBuilder $row_builder, TitleColumnsBuilder $title_builder)
Definition: Properties.php:87
withAggregatedResults(PropertyAggregatedResults $aggregated_results)
Definition: Properties.php:80
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...
link(string $caption, string $href, bool $new_viewport=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:26