ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.UIModifier.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
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(
79 in_array(
80 $survey->getReminderTarget(),
82 true
83 )
84 );
85 $items[] = $cb;
86
87 // remind raters
88 $cb = new \ilCheckboxInputGUI("", "remind_raters");
89 $cb->setOptionTitle($lng->txt("survey_360_raters"));
90 $cb->setInfo($lng->txt("survey_360_raters_remind_info"));
91 $cb->setValue("1");
92 $cb->setChecked(
93 in_array(
94 $survey->getReminderTarget(),
96 true
97 )
98 );
99 $items[] = $cb;
100
101 return $items;
102 }
103
104 public function setValuesFromForm(
105 \ilObjSurvey $survey,
106 \ilPropertyFormGUI $form
107 ): void {
108 if ($form->getInput("remind_appraisees") && $form->getInput("remind_raters")) {
110 } elseif ($form->getInput("remind_appraisees")) {
112 } elseif ($form->getInput("remind_raters")) {
114 } else {
115 $survey->setReminderTarget(0);
116 }
117
118 $survey->set360Results((int) $form->getInput("ts_res"));
119 }
120
121 public function setResultsDetailToolbar(
122 \ilObjSurvey $survey,
123 int $user_id,
124 \ilTemplate $eval_tpl
125 ): array {
126 $this->addApprSelectionToToolbar(
127 $survey,
128 $this->gui->toolbar(),
130 );
131
132 return $this->getExportAndPrintComponents(
133 $survey,
134 true,
135 $eval_tpl
136 );
137 }
138
140 \ilObjSurvey $survey,
141 int $user_id
142 ): array {
143 $toolbar = $this->gui->toolbar();
144
145 $this->addApprSelectionToToolbar(
146 $survey,
147 $toolbar,
149 );
150
151 $this->addRaterSelectionToToolbar(
152 $survey,
153 $toolbar,
155 );
156
157 return [];
158 }
159
164 \ilObjSurvey $survey,
165 \ilToolbarGUI $toolbar,
166 int $user_id
167 ): void {
168 $lng = $this->service->gui()->lng();
169 $ctrl = $this->service->gui()->ctrl();
170 $req = $this->service->gui()->evaluation($survey)->request();
171
172 $evaluation_manager = $this->service->domain()->evaluation(
173 $survey,
174 $user_id,
175 $req->getAppraiseeId(),
176 $req->getRaterId()
177 );
178
179 if (!$evaluation_manager->isMultiParticipantsView()) {
180 $raters = $evaluation_manager->getSelectableRaters();
181
182 if (count($raters) > 0) {
183 $options = [];
184 //$options["-"] = $lng->txt("svy_all_raters");
185 foreach ($raters as $rater) {
186 $options[$rater["user_id"]] = $rater["name"];
187 }
188
189 $rat = new \ilSelectInputGUI($lng->txt("svy_rater"), "rater_id");
190 $rat->setOptions($options);
191 $rat->setValue($evaluation_manager->getCurrentRater(true));
192 $toolbar->addInputItem($rat, true);
193
194 $this->gui->button(
195 $this->gui->lng()->txt("svy_select_rater"),
196 $ctrl->getCmd()
197 )->submit()->toToolbar(false, $toolbar);
198
199 $toolbar->addSeparator();
200 }
201 }
202 }
203
204 protected function getPanelChart(
207 ): string {
208 return "";
209 }
210
211 protected function getPanelText(
214 \ilSurveyEvaluationResults $question_res
215 ): string {
216 return "";
217 }
218
219 protected function getPanelTable(
220 array $participants,
223 ): string {
224 $a_results = $a_eval->getResults();
225 $lng = $this->service->gui()->lng();
226 $matrix = false;
227 if (is_array($a_results)) {
228 $answers = $a_results[0][1]->getAnswers();
229 $q = $a_results[0][1]->getQuestion();
230 $matrix = true;
231 } else {
232 $answers = $a_results->getAnswers();
233 $q = $a_results->getQuestion();
234 }
235 // SurveySingleChoiceQuestion
236 if (!in_array($q->getQuestionType(), [
237 "SurveySingleChoiceQuestion",
238 "SurveyMultipleChoiceQuestion",
239 "SurveyMetricQuestion",
240 "SurveyTextQuestion"
241 ], true)) {
242 //var_dump($q->getQuestionType());
243 //var_dump($answers);
244 //exit;
245 }
246
248
249 $a_tpl = new \ilTemplate(
250 "tpl.svy_results_details_table.html",
251 true,
252 true,
253 "components/ILIAS/Survey/Evaluation"
254 );
255
256 // table
257 $ret = "";
258 if ($request->getShowTable()) {
259 if (!$matrix) {
260 // rater
261 $a_tpl->setCurrentBlock("grid_col_header_bl");
262 $a_tpl->setVariable("COL_HEADER", $lng->txt("svy_rater"));
263 $a_tpl->parseCurrentBlock();
264
265 // date
266 $a_tpl->setCurrentBlock("grid_col_header_bl");
267 $a_tpl->setVariable("COL_HEADER", $lng->txt("date"));
268 $a_tpl->parseCurrentBlock();
269
270 // answer
271 $a_tpl->setCurrentBlock("grid_col_header_bl");
272 $a_tpl->setVariable("COL_HEADER", $lng->txt("answers"));
273 $a_tpl->parseCurrentBlock();
274
275 $condensed_answers = [];
276 foreach ($answers as $answer) {
277 $condensed_answers[$answer->active_id]["tstamp"] = $answer->tstamp;
278 $condensed_answers[$answer->active_id]["active_id"] = $answer->active_id;
279 // this moves the original multiple answers items of muliple choice question into one array
280 $condensed_answers[$answer->active_id]["value"][] = $answer->value;
281 $condensed_answers[$answer->active_id]["text"] = $answer->text;
282 }
283
285 foreach ($condensed_answers as $answer) {
286 // rater
287 $a_tpl->setCurrentBlock("grid_col_bl");
288 $a_tpl->setVariable("COL_CAPTION", " ");
289 $a_tpl->parseCurrentBlock();
290
291 // rater
292 $participant = $this->getParticipantByActiveId($participants, $answer["active_id"]);
293 $part_caption = "";
294 if ($participant) {
295 $part_caption = $this->getCaptionForParticipant($participant);
296 }
297 $a_tpl->setCurrentBlock("grid_col_bl");
298 $a_tpl->setVariable("COL_CAPTION", $part_caption);
299 $a_tpl->parseCurrentBlock();
300
301 // date
302 $a_tpl->setCurrentBlock("grid_col_bl");
303 $date = new \ilDate($answer["tstamp"], IL_CAL_UNIX);
304 $a_tpl->setVariable(
305 "COL_CAPTION",
307 );
308 $a_tpl->parseCurrentBlock();
309
310 // answer
311 $a_tpl->setCurrentBlock("grid_col_bl");
312 if ($q->getQuestionType() === "SurveyTextQuestion") {
313 $a_tpl->setVariable(
314 "COL_CAPTION",
315 $a_results->getScaleText($answer["text"])
316 );
317 } else {
318 $scale_texts = array_map(static function ($v) use ($a_results): string {
319 return $a_results->getScaleText($v);
320 }, $answer["value"]);
321 $a_tpl->setVariable(
322 "COL_CAPTION",
323 implode(", ", $scale_texts)
324 );
325 }
326 $a_tpl->parseCurrentBlock();
327
328 $a_tpl->touchBlock("grid_row_bl");
329 }
330 $ret = $a_tpl->get();
331 } else {
333 foreach ($answers as $answer) {
336 $cats = $q->getColumns();
337 foreach ($cats->getCategories() as $cat) {
338 $a_tpl->touchBlock("grid_col_head_center");
339 $a_tpl->setCurrentBlock("grid_col_header_bl");
340 $a_tpl->setVariable("COL_HEADER", $cat->title);
341 $a_tpl->parseCurrentBlock();
342 }
343
344 $cats_rows = $q->getRows();
345
346 reset($a_results);
347 foreach ($cats_rows->getCategories() as $cat) {
348 $a_tpl->setCurrentBlock("grid_col_bl");
349 $a_tpl->setVariable("COL_CAPTION", $cat->title);
350 $a_tpl->parseCurrentBlock();
351
352 $r = current($a_results);
353 $row_answers = $r[1]->getAnswers();
354 $user_answers = null;
355 foreach ($row_answers as $ra) {
356 if ($ra->active_id == $answer->active_id) {
357 $user_answers = $ra;
358 }
359 }
360
361 foreach ($cats->getCategories() as $catr) {
362 if ($user_answers && $user_answers->value == $catr->scale) {
363 $a_tpl->touchBlock("grid_col_center");
364 $a_tpl->setCurrentBlock("grid_col_bl");
365 $a_tpl->setVariable("COL_CAPTION", "X");
366 } else {
367 $a_tpl->setCurrentBlock("grid_col_bl");
368 $a_tpl->setVariable("COL_CAPTION", " ");
369 }
370
371 $a_tpl->parseCurrentBlock();
372 }
373
374 $a_tpl->touchBlock("grid_row_bl");
375 next($a_results);
376 }
377
378 // rater
379 $participant = $this->getParticipantByActiveId($participants, $answer->active_id);
380 $part_caption = "";
381 if ($participant) {
382 $part_caption = $participant["sortname"];
383 }
384 $date = new \ilDate($answer->tstamp, IL_CAL_UNIX);
385 $part_caption .= ", " . \ilDatePresentation::formatDate($date);
386
387 $a_tpl->setVariable("HEADER", $part_caption);
388 $ret .= $a_tpl->get();
389 $a_tpl = new \ilTemplate(
390 "tpl.svy_results_details_table.html",
391 true,
392 true,
393 "components/ILIAS/Survey/Evaluation"
394 );
395 }
396 }
397 }
398 return $ret;
399 }
400
401 protected function getParticipantByActiveId(array $participants, int $active_id): ?array
402 {
403 foreach ($participants as $part) {
404 if ((int) $part["active_id"] === $active_id) {
405 return $part;
406 }
407 }
408 return null;
409 }
410
411 protected function getCaptionForParticipant(array $part_array): string
412 {
413 return $part_array["sortname"];
414 }
415}
addRaterSelectionToToolbar(\ilObjSurvey $survey, \ilToolbarGUI $toolbar, int $user_id)
Add rater selection to toolbar.
getSurveySettingsResults(\ilObjSurvey $survey, InternalGUIService $ui_service)
setResultsDetailToolbar(\ilObjSurvey $survey, int $user_id, \ilTemplate $eval_tpl)
getPanelChart(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval)
getSurveySettingsReminderTargets(\ilObjSurvey $survey, InternalGUIService $ui_service)
getParticipantByActiveId(array $participants, int $active_id)
setResultsCompetenceToolbar(\ilObjSurvey $survey, int $user_id)
getPanelText(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval, \ilSurveyEvaluationResults $question_res)
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, ?ilObjUser $user=null,)
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.
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
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...
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
catch(\Exception $e) $req
Definition: xapiproxy.php:81
global $lng
Definition: privfeed.php:26
if(!file_exists('../ilias.ini.php'))