ILIAS  release_8 Revision v8.24
class.UIModifier.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
25
31{
32 public function getSurveySettingsGeneral(
33 \ilObjSurvey $survey
34 ): array {
35 $items = [];
36
37 return $items;
38 }
39
40 public function getSurveySettingsResults(
41 \ilObjSurvey $survey,
42 InternalGUIService $ui_service
43 ): array {
44 $items = [];
45 $lng = $ui_service->lng();
46
47 $ts_results = new \ilRadioGroupInputGUI($lng->txt("survey_360_results"), "ts_res");
48 $ts_results->setValue((string) $survey->get360Results());
49
50 $option = new \ilRadioOption($lng->txt("survey_360_results_none"), (string) \ilObjSurvey::RESULTS_360_NONE);
51 $option->setInfo($lng->txt("survey_360_results_none_info"));
52 $ts_results->addOption($option);
53
54 $option = new \ilRadioOption(
55 $lng->txt("survey_360_results_own"),
57 );
58 $option->setInfo($lng->txt("survey_360_results_own_info"));
59 $ts_results->addOption($option);
60
61 $items[] = $ts_results;
62
63 return $items;
64 }
65
67 \ilObjSurvey $survey,
68 InternalGUIService $ui_service
69 ): array {
70 $items = [];
71 $lng = $ui_service->lng();
72
73 // remind appraisees
74 $cb = new \ilCheckboxInputGUI($lng->txt("survey_notification_target_group"), "remind_appraisees");
75 $cb->setOptionTitle($lng->txt("survey_360_appraisees"));
76 $cb->setInfo($lng->txt("survey_360_appraisees_remind_info"));
77 $cb->setValue("1");
78 $cb->setChecked(in_array(
79 $survey->getReminderTarget(),
81 true
82 ));
83 $items[] = $cb;
84
85 // remind raters
86 $cb = new \ilCheckboxInputGUI("", "remind_raters");
87 $cb->setOptionTitle($lng->txt("survey_360_raters"));
88 $cb->setInfo($lng->txt("survey_360_raters_remind_info"));
89 $cb->setValue("1");
90 $cb->setChecked(in_array(
91 $survey->getReminderTarget(),
93 true
94 ));
95 $items[] = $cb;
96
97 return $items;
98 }
99
100 public function setValuesFromForm(
101 \ilObjSurvey $survey,
102 \ilPropertyFormGUI $form
103 ): void {
104 if ($form->getInput("remind_appraisees") && $form->getInput("remind_raters")) {
106 } elseif ($form->getInput("remind_appraisees")) {
108 } elseif ($form->getInput("remind_raters")) {
110 } else {
111 $survey->setReminderTarget(0);
112 }
113
114 $survey->set360Results((int) $form->getInput("ts_res"));
115 }
116
117
118 public function setResultsDetailToolbar(
119 \ilObjSurvey $survey,
120 \ilToolbarGUI $toolbar,
121 int $user_id
122 ): void {
123 $this->addApprSelectionToToolbar(
124 $survey,
125 $toolbar,
126 $user_id
127 );
128
129 $this->addExportAndPrintButton(
130 $survey,
131 $toolbar,
132 true
133 );
134 }
135
137 \ilObjSurvey $survey,
138 \ilToolbarGUI $toolbar,
139 int $user_id
140 ): void {
141 $this->addApprSelectionToToolbar(
142 $survey,
143 $toolbar,
144 $user_id
145 );
146
147 $this->addRaterSelectionToToolbar(
148 $survey,
149 $toolbar,
150 $user_id
151 );
152 }
153
158 \ilObjSurvey $survey,
159 \ilToolbarGUI $toolbar,
160 int $user_id
161 ): void {
162 $lng = $this->service->gui()->lng();
163 $ctrl = $this->service->gui()->ctrl();
164 $req = $this->service->gui()->evaluation($survey)->request();
165
166 $evaluation_manager = $this->service->domain()->evaluation(
167 $survey,
168 $user_id,
169 $req->getAppraiseeId(),
170 $req->getRaterId()
171 );
172
173
174 if (!$evaluation_manager->isMultiParticipantsView()) {
175 $raters = $evaluation_manager->getSelectableRaters();
176
177 if (count($raters) > 0) {
178 $options = [];
179 $options["-"] = $lng->txt("svy_all_raters");
180 foreach ($raters as $rater) {
181 $options[$rater["user_id"]] = $rater["name"];
182 }
183
184 $rat = new \ilSelectInputGUI($lng->txt("svy_rater"), "rater_id");
185 $rat->setOptions($options);
186 $rat->setValue($evaluation_manager->getCurrentRater());
187 $toolbar->addInputItem($rat, true);
188
190 $button->setCaption("svy_select_rater");
191 $button->setCommand($ctrl->getCmd());
192 $toolbar->addButtonInstance($button);
193
194 $toolbar->addSeparator();
195 }
196 }
197 }
198
199
200 protected function getPanelChart(
201 \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request,
203 ): string {
204 return "";
205 }
206
207 protected function getPanelText(
208 \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request,
210 \ilSurveyEvaluationResults $question_res
211 ): string {
212 return "";
213 }
214
215 protected function getPanelTable(
216 array $participants,
217 \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request,
219 ): string {
220 $a_results = $a_eval->getResults();
221 $lng = $this->service->gui()->lng();
222 $matrix = false;
223 if (is_array($a_results)) {
224 $answers = $a_results[0][1]->getAnswers();
225 $q = $a_results[0][1]->getQuestion();
226 $matrix = true;
227 } else {
228 $answers = $a_results->getAnswers();
229 $q = $a_results->getQuestion();
230 }
231 // SurveySingleChoiceQuestion
232 if (!in_array($q->getQuestionType(), [
233 "SurveySingleChoiceQuestion",
234 "SurveyMultipleChoiceQuestion",
235 "SurveyMetricQuestion",
236 "SurveyTextQuestion"
237 ], true)) {
238 //var_dump($q->getQuestionType());
239 //var_dump($answers);
240 //exit;
241 }
242
243
245
246 $a_tpl = new \ilTemplate("tpl.svy_results_details_table.html", true, true, "Modules/Survey/Evaluation");
247
248 // table
249 $ret = "";
250 if ($request->getShowTable()) {
251 if (!$matrix) {
252
253 // rater
254 $a_tpl->setCurrentBlock("grid_col_header_bl");
255 $a_tpl->setVariable("COL_HEADER", $lng->txt("svy_rater"));
256 $a_tpl->parseCurrentBlock();
257
258 // date
259 $a_tpl->setCurrentBlock("grid_col_header_bl");
260 $a_tpl->setVariable("COL_HEADER", $lng->txt("date"));
261 $a_tpl->parseCurrentBlock();
262
263 // answer
264 $a_tpl->setCurrentBlock("grid_col_header_bl");
265 $a_tpl->setVariable("COL_HEADER", $lng->txt("answers"));
266 $a_tpl->parseCurrentBlock();
267
268 $condensed_answers = [];
269 foreach ($answers as $answer) {
270 $condensed_answers[$answer->active_id]["tstamp"] = $answer->tstamp;
271 $condensed_answers[$answer->active_id]["active_id"] = $answer->active_id;
272 // this moves the original multiple answers items of muliple choice question into one array
273 $condensed_answers[$answer->active_id]["value"][] = $answer->value;
274 $condensed_answers[$answer->active_id]["text"] = $answer->text;
275 }
276
278 foreach ($condensed_answers as $answer) {
279 // rater
280 $a_tpl->setCurrentBlock("grid_col_bl");
281 $a_tpl->setVariable("COL_CAPTION", " ");
282 $a_tpl->parseCurrentBlock();
283
284 // rater
285 $participant = $this->getParticipantByActiveId($participants, $answer["active_id"]);
286 $part_caption = "";
287 if ($participant) {
288 $part_caption = $this->getCaptionForParticipant($participant);
289 }
290 $a_tpl->setCurrentBlock("grid_col_bl");
291 $a_tpl->setVariable("COL_CAPTION", $part_caption);
292 $a_tpl->parseCurrentBlock();
293
294 // date
295 $a_tpl->setCurrentBlock("grid_col_bl");
296 $date = new \ilDate($answer["tstamp"], IL_CAL_UNIX);
297 $a_tpl->setVariable(
298 "COL_CAPTION",
300 );
301 $a_tpl->parseCurrentBlock();
302
303 // answer
304 $a_tpl->setCurrentBlock("grid_col_bl");
305 if ($q->getQuestionType() === "SurveyTextQuestion") {
306 $a_tpl->setVariable(
307 "COL_CAPTION",
308 $a_results->getScaleText($answer["text"])
309 );
310 } else {
311 $scale_texts = array_map(static function ($v) use ($a_results): string {
312 return $a_results->getScaleText($v);
313 }, $answer["value"]);
314 $a_tpl->setVariable(
315 "COL_CAPTION",
316 implode(", ", $scale_texts)
317 );
318 }
319 $a_tpl->parseCurrentBlock();
320
321 $a_tpl->touchBlock("grid_row_bl");
322 }
323 $ret = $a_tpl->get();
324 } else {
325
327 foreach ($answers as $answer) {
328
331 $cats = $q->getColumns();
332 foreach ($cats->getCategories() as $cat) {
333 $a_tpl->touchBlock("grid_col_head_center");
334 $a_tpl->setCurrentBlock("grid_col_header_bl");
335 $a_tpl->setVariable("COL_HEADER", $cat->title);
336 $a_tpl->parseCurrentBlock();
337 }
338
339 $cats_rows = $q->getRows();
340
341 reset($a_results);
342 foreach ($cats_rows->getCategories() as $cat) {
343 $a_tpl->setCurrentBlock("grid_col_bl");
344 $a_tpl->setVariable("COL_CAPTION", $cat->title);
345 $a_tpl->parseCurrentBlock();
346
347 $r = current($a_results);
348 $row_answers = $r[1]->getAnswers();
349 $user_answers = null;
350 foreach ($row_answers as $ra) {
351 if ($ra->active_id == $answer->active_id) {
352 $user_answers = $ra;
353 }
354 }
355
356 foreach ($cats->getCategories() as $catr) {
357 if ($user_answers && $user_answers->value == $catr->scale) {
358 $a_tpl->touchBlock("grid_col_center");
359 $a_tpl->setCurrentBlock("grid_col_bl");
360 $a_tpl->setVariable("COL_CAPTION", "X");
361 } else {
362 $a_tpl->setCurrentBlock("grid_col_bl");
363 $a_tpl->setVariable("COL_CAPTION", " ");
364 }
365
366 $a_tpl->parseCurrentBlock();
367 }
368
369 $a_tpl->touchBlock("grid_row_bl");
370 next($a_results);
371 }
372
373 // rater
374 $participant = $this->getParticipantByActiveId($participants, $answer->active_id);
375 $part_caption = "";
376 if ($participant) {
377 $part_caption = $participant["sortname"];
378 }
379 $date = new \ilDate($answer->tstamp, IL_CAL_UNIX);
380 $part_caption .= ", " . \ilDatePresentation::formatDate($date);
381
382 $a_tpl->setVariable("HEADER", $part_caption);
383 $ret .= $a_tpl->get();
384 $a_tpl = new \ilTemplate("tpl.svy_results_details_table.html", true, true, "Modules/Survey/Evaluation");
385 }
386 }
387 }
388 return $ret;
389 }
390
391 protected function getParticipantByActiveId(array $participants, int $active_id): ?array
392 {
393 foreach ($participants as $part) {
394 if ((int) $part["active_id"] === $active_id) {
395 return $part;
396 }
397 }
398 return null;
399 }
400
401 protected function getCaptionForParticipant(array $part_array): string
402 {
403 return $part_array["sortname"];
404 }
405}
addRaterSelectionToToolbar(\ilObjSurvey $survey, \ilToolbarGUI $toolbar, int $user_id)
Add rater selection to toolbar.
getSurveySettingsResults(\ilObjSurvey $survey, InternalGUIService $ui_service)
setResultsDetailToolbar(\ilObjSurvey $survey, \ilToolbarGUI $toolbar, int $user_id)
getPanelChart(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval)
getSurveySettingsReminderTargets(\ilObjSurvey $survey, InternalGUIService $ui_service)
getParticipantByActiveId(array $participants, int $active_id)
getPanelText(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval, \ilSurveyEvaluationResults $question_res)
setResultsCompetenceToolbar(\ilObjSurvey $survey, \ilToolbarGUI $toolbar, int $user_id)
setValuesFromForm(\ilObjSurvey $survey, \ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
set360Results(int $a_value)
const NOTIFICATION_APPRAISEES_AND_RATERS
setReminderTarget(int $a_value)
const NOTIFICATION_APPRAISEES
const NOTIFICATION_RATERS
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
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', '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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
catch(\Exception $e) $req
Definition: xapiproxy.php:93
$lng