ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilSurveyEvaluationGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
31 {
32  public const TYPE_XLS = "excel";
33  public const TYPE_SPSS = "csv";
34  public const EXCEL_SUBTITLE = "DDDDDD";
35  protected \ILIAS\Survey\InternalGUIService $gui;
36  protected \ILIAS\Survey\Access\AccessManager $access_manager;
37  protected \ILIAS\Survey\PrintView\GUIService $print;
42  protected array $array_panels;
43 
44  protected ilLogger $log;
45  protected \ILIAS\DI\UIServices $ui;
46  protected \ILIAS\Survey\Evaluation\EvaluationManager $evaluation_manager;
47  protected ilTabsGUI $tabs;
49  protected ilObjUser $user;
51  protected ilTree $tree;
53  protected ilObjSurvey $object;
54  protected ilLanguage $lng;
56  protected ilCtrl $ctrl;
57  protected ?int $appr_id = null;
59  protected \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request;
60  protected \ILIAS\Skill\Service\SkillProfileService $skill_profile_service;
61 
62  public function __construct(
63  ilObjSurvey $a_object
64  ) {
65  global $DIC;
66 
67  $this->tabs = $DIC->tabs();
68  $this->access = $DIC->access();
69  $this->user = $DIC->user();
70  $this->rbacsystem = $DIC->rbac()->system();
71  $this->tree = $DIC->repositoryTree();
72  $this->toolbar = $DIC->toolbar();
73  $this->ui = $DIC->ui();
74  $lng = $DIC->language();
75  $tpl = $DIC["tpl"];
76  $ilCtrl = $DIC->ctrl();
77 
78  $this->lng = $lng;
79  $this->tpl = $tpl;
80  $this->ctrl = $ilCtrl;
81  $this->object = $a_object;
82  $this->log = ilLoggerFactory::getLogger("svy");
83  $this->array_panels = array();
84 
85  $this->request = $DIC->survey()->internal()->gui()->evaluation($this->object)->request();
86 
87  $this->ctrl->saveParameter($this, ["appr_id", "rater_id"]);
88  $this->evaluation_manager = $DIC
89  ->survey()
90  ->internal()
91  ->domain()
92  ->evaluation(
93  $this->object,
94  $DIC->user()->getId(),
95  $this->request->getAppraiseeId(),
96  $this->request->getRaterId()
97  );
98 
99  $this->setAppraiseeId(
100  $this->evaluation_manager->getCurrentAppraisee()
101  );
102 
103  $this->ui_modifier = $DIC->survey()
104  ->internal()
105  ->gui()
106  ->modeUIModifier($this->object->getMode());
107  $this->print = $DIC->survey()
108  ->internal()
109  ->gui()
110  ->print();
111  $this->access_manager = $DIC->survey()
112  ->internal()
113  ->domain()
114  ->access(
115  $this->object->getRefId(),
116  $DIC->user()->getId()
117  );
118  $this->skill_profile_service = $DIC->skills()->profile();
119  $this->gui = $DIC->survey()->internal()->gui();
120  }
121 
122  public function executeCommand(): string
123  {
124  $skmg_set = new ilSkillManagementSettings();
125  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
126  $cmd = $this->ctrl->getCmd("competenceEval");
127  } else {
128  $cmd = $this->ctrl->getCmd("evaluation");
129  }
130 
131  $next_class = $this->ctrl->getNextClass($this);
132 
133  $this->log->debug($cmd);
134 
135  switch ($next_class) {
136  default:
137  $this->setEvalSubtabs();
138  $ret = (string) $this->$cmd();
139  break;
140  }
141  return $ret;
142  }
143 
147  public function setEvalSubtabs(): void
148  {
149  $ilTabs = $this->tabs;
150 
151  $skmg_set = new ilSkillManagementSettings();
152  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
153  $ilTabs->addSubTabTarget(
154  "svy_eval_competences",
155  $this->ctrl->getLinkTarget($this, "competenceEval"),
156  array("competenceEval")
157  );
158  }
159 
160  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
161  $ilTabs->addSubTabTarget(
162  "svy_eval_cumulated",
163  $this->ctrl->getLinkTarget($this, "evaluation"),
164  array("evaluation", "checkEvaluationAccess")
165  );
166  }
167 
168  $ilTabs->addSubTabTarget(
169  "svy_eval_detail",
170  $this->ctrl->getLinkTarget($this, "evaluationdetails"),
171  array("evaluationdetails")
172  );
173 
174  if ($this->hasResultsAccess() && $this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
175  $ilTabs->addSubTabTarget(
176  "svy_eval_user",
177  $this->ctrl->getLinkTarget($this, "evaluationuser"),
178  array("evaluationuser")
179  );
180  }
181 
182  if ($this->object->getCalculateSumScore()) {
183  $ilTabs->addSubTabTarget(
184  "svy_sum_score",
185  $this->ctrl->getLinkTarget($this, "sumscore"),
186  array("sumscore")
187  );
188  }
189  }
190 
191 
192  public function setAppraiseeId(
193  int $a_val
194  ): void {
195  $this->appr_id = $a_val;
196  }
197 
198  public function getAppraiseeId(): int
199  {
200  return $this->appr_id;
201  }
202 
203  public function checkAnonymizedEvaluationAccess(): bool
204  {
205  $ilUser = $this->user;
206 
207  if ($this->object->getAnonymize() === 1 &&
208  $this->evaluation_manager->getAnonEvaluationAccess() === $this->request->getRefId()) {
209  return true;
210  }
211 
213  ilObject::_lookupObjId($this->request->getRefId()),
214  $ilUser->getId()
215  )) {
216  if ($this->object->getAnonymize() === 1) {
217  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
218  }
219  return true;
220  }
221 
222  if ($this->object->getAnonymize() === 1) {
223  // autocode
224  $surveycode = $this->object->getUserAccessCode($ilUser->getId());
225  if ($this->object->isAnonymizedParticipant($surveycode)) {
226  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
227  return true;
228  }
229 
230  // code needed
231  $this->tpl->setVariable("TABS", "");
232  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "components/ILIAS/Survey");
233  $this->tpl->setCurrentBlock("adm_content");
234  $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
235  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "checkEvaluationAccess"));
236  $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
237  $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
238  $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
239  $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
240  $this->tpl->parseCurrentBlock();
241  }
242 
243  $this->evaluation_manager->clearAnonEvaluationAccess();
244  return false;
245  }
246 
250  public function checkEvaluationAccess(): void
251  {
252  $surveycode = $this->request->getSurveyCode();
253  if ($this->object->isAnonymizedParticipant($surveycode)) {
254  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
255  $this->evaluation();
256  } else {
257  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("svy_check_evaluation_wrong_key", true));
258  $this->cancelEvaluationAccess();
259  }
260  }
261 
265  public function cancelEvaluationAccess(): void
266  {
267  $ilCtrl = $this->ctrl;
268  $tree = $this->tree;
269  $path = $tree->getPathFull($this->object->getRefId());
270  $ilCtrl->setParameterByClass(
271  "ilrepositorygui",
272  "ref_id",
273  $path[count($path) - 2]["child"]
274  );
275  $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
276  }
277 
281  protected function evaluationdetails(): void
282  {
283  $this->evaluation(1);
284  }
285 
286  public function exportCumulatedResults(
287  int $details = 0
288  ): void {
289  $finished_ids = null;
290  if ($this->object->get360Mode()) {
291  $appr_id = $this->request->getAppraiseeId();
292  if (!$appr_id) {
293  $this->ctrl->redirect($this, $details ? "evaluationdetails" : "evaluation");
294  }
295  $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
296  if (!count($finished_ids)) {
297  $finished_ids = array(-1);
298  }
299  }
300 
301  // titles
302  $title_row = array();
303  $do_title = $do_label = true;
304  switch ($this->request->getExportLabel()) {
305  case 'label_only':
306  $title_row[] = $this->lng->txt("label");
307  $do_title = false;
308  break;
309 
310  case 'title_only':
311  $title_row[] = $this->lng->txt("title");
312  $do_label = false;
313  break;
314 
315  default:
316  $title_row[] = $this->lng->txt("title");
317  $title_row[] = $this->lng->txt("label");
318  break;
319  }
320  $title_row[] = $this->lng->txt("question");
321  $title_row[] = $this->lng->txt("question_type");
322  $title_row[] = $this->lng->txt("users_answered");
323  $title_row[] = $this->lng->txt("users_skipped");
324  $title_row[] = $this->lng->txt("mode");
325  $title_row[] = $this->lng->txt("mode_text");
326  $title_row[] = $this->lng->txt("mode_nr_of_selections");
327  $title_row[] = $this->lng->txt("median");
328  $title_row[] = $this->lng->txt("arithmetic_mean");
329 
330  // creating container
331  $excel = null;
332  $csvfile = null;
333  switch ($this->request->getExportFormat()) {
334  case self::TYPE_XLS:
335  $excel = new ilExcel();
336  $excel->addSheet($this->lng->txt("svy_eval_cumulated"));
337  $excel->setCellArray(array($title_row), "A1");
338  $excel->setBold("A1:" . $excel->getColumnCoord(count($title_row) - 1) . "1");
339  break;
340 
341  case self::TYPE_SPSS:
342  $csvfile = array($title_row);
343  break;
344  }
345 
346 
347  // parse answer data in evaluation results
348  $ov_row = 2;
349  $question_index = 1;
350  foreach ($this->object->getSurveyQuestions() as $qdata) {
351  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
352  $q_res = $q_eval->getResults();
353  $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
354 
355  switch ($this->request->getExportFormat()) {
356  case self::TYPE_XLS:
357  $excel->setActiveSheet(0);
358  foreach ($ov_rows as $row) {
359  foreach ($row as $col => $value) {
360  $excel->setCell($ov_row, $col, $value);
361  }
362  $ov_row++;
363  }
364  break;
365 
366  case self::TYPE_SPSS:
367  foreach ($ov_rows as $row) {
368  $csvfile[] = $row;
369  }
370  break;
371  }
372 
373  if ($details) {
374  switch ($this->request->getExportFormat()) {
375  case self::TYPE_XLS:
376  $this->exportResultsDetailsExcel($excel, $q_eval, $q_res, $do_title, $do_label, $question_index++);
377  break;
378  }
379  }
380  }
381 
382  // #11179
383  $type = !$details
384  ? $this->lng->txt("svy_eval_cumulated")
385  : $this->lng->txt("svy_eval_detail");
386 
387  $surveyname = $this->object->getTitle() . " " . $type . " " . date("Y-m-d");
388  $surveyname = preg_replace("/\s/", "_", trim($surveyname));
389  $surveyname = ilFileUtils::getASCIIFilename($surveyname);
390 
391  // send to client
392  switch ($this->request->getExportFormat()) {
393  case self::TYPE_XLS:
394  $excel->sendToClient($surveyname);
395  break;
396 
397  case self::TYPE_SPSS:
398  $csv = "";
399  $separator = ";";
400  foreach ($csvfile as $csvrow) {
401  $csvrow = $this->processCSVRow($csvrow, true, $separator);
402  $csv .= implode($separator, $csvrow) . "\n";
403  }
404  ilUtil::deliverData($csv, $surveyname . ".csv");
405  exit();
406  }
407  }
408 
414  protected function exportResultsDetailsExcel(
415  ilExcel $a_excel,
416  SurveyQuestionEvaluation $a_eval,
417  $a_results,
418  bool $a_do_title,
419  bool $a_do_label,
420  int $question_index
421  ): void {
422  $question_res = $a_results;
423  $matrix = false;
424  if (is_array($question_res)) {
425  $question_res = $question_res[0][1];
426  $matrix = true;
427  }
428  $question = $question_res->getQuestion();
429 
430  $a_excel->addSheet($question_index . "_" . $question->getTitle());
431 
432 
433  // question "overview"
434 
435  $kv = array();
436 
437  if ($a_do_title) {
438  $kv[$this->lng->txt("title")] = $question->getTitle();
439  }
440  if ($a_do_label) {
441  $kv[$this->lng->txt("label")] = $question->label;
442  }
443 
444  // question
445  $kv[$this->lng->txt("question")] = $question->getQuestiontext();
446 
447  // question type
448  $kv[$this->lng->txt("question_type")] = SurveyQuestion::_getQuestionTypeName($question->getQuestionType());
449 
450  // :TODO: present subtypes (hrz/vrt, mc/sc mtx, metric scale)?
451 
452  // answered and skipped users
453  $kv[$this->lng->txt("users_answered")] = $question_res->getUsersAnswered();
454  $kv[$this->lng->txt("users_skipped")] = $question_res->getUsersSkipped(); // #0021671
455 
456  $excel_row = 1;
457 
458  foreach ($kv as $key => $value) {
459  $a_excel->setCell($excel_row, 0, $key);
460  $a_excel->setCell($excel_row++, 1, $value);
461  }
462 
463  if (!$matrix) {
464  $this->parseResultsToExcel(
465  $a_excel,
466  $question_res,
467  $excel_row,
468  $a_eval->getExportGrid($a_results),
469  $a_eval->getTextAnswers($a_results)
470  );
471  } else {
472  // question
473  $this->parseResultsToExcel(
474  $a_excel,
475  $question_res,
476  $excel_row,
477  null,
478  null,
479  false
480  );
481 
482  $texts = $a_eval->getTextAnswers($a_results);
483 
484  // "rows"
485  foreach ($a_results as $row_results) {
486  $row_title = $row_results[0];
487 
488  $a_excel->setCell($excel_row, 0, $this->lng->txt("row"));
489  $a_excel->setCell($excel_row++, 1, $row_title);
490 
491  $this->parseResultsToExcel(
492  $a_excel,
493  $row_results[1],
494  $excel_row,
495  $a_eval->getExportGrid($row_results[1]),
496  is_array($texts[$row_title] ?? false)
497  ? array("" => $texts[$row_title])
498  : null
499  );
500  }
501  }
502 
503  // matrix question: overview #21438
504  if ($matrix) {
505  $a_excel->setCell($excel_row++, 0, $this->lng->txt("overview"));
506 
507  // title row with variables
508  $counter = 0;
509  $cats = $question->getColumns();
510  foreach ($cats->getCategories() as $cat) {
511  $a_excel->setColors($a_excel->getCoordByColumnAndRow(1 + $counter, $excel_row), self::EXCEL_SUBTITLE);
512  $a_excel->setCell($excel_row, 1 + $counter, $cat->title);
513  $counter++;
514  }
515  $excel_row++;
516 
517  foreach ($a_results as $row_results) {
518  $row_title = $row_results[0];
519  $counter = 0;
520  $a_excel->setCell($excel_row, 0, $row_title);
521 
522  $vars = $row_results[1]->getVariables();
523  if ($vars) {
524  foreach ($vars as $var) {
525  $a_excel->setCell($excel_row, ++$counter, $var->abs);
526  }
527  }
528  $excel_row++;
529  }
530  }
531 
532  // 1st column is bold
533  $a_excel->setBold("A1:A" . $excel_row);
534  }
535 
536  protected function parseResultsToExcel(
537  ilExcel $a_excel,
538  ilSurveyEvaluationResults $a_results,
539  int &$a_excel_row,
540  ?array $a_grid = null,
541  ?array $a_text_answers = null,
542  bool $a_include_mode = true
543  ): void {
544  $kv = array();
545 
546  if ($a_include_mode) {
547  if ($a_results->getModeValue() !== null) {
548  // :TODO:
549  $kv[$this->lng->txt("mode")] = is_array($a_results->getModeValue())
550  ? implode(", ", $a_results->getModeValue())
551  : $a_results->getModeValue();
552 
553  $kv[$this->lng->txt("mode_text")] = $a_results->getModeValueAsText();
554  $kv[$this->lng->txt("mode_nr_of_selections")] = $a_results->getModeNrOfSelections();
555  }
556 
557  if ($a_results->getMedian() !== null) {
558  $kv[$this->lng->txt("median")] = $a_results->getMedianAsText();
559  }
560 
561  if ($a_results->getMean() !== null) {
562  $kv[$this->lng->txt("arithmetic_mean")] = $a_results->getMean();
563  }
564  }
565 
566  foreach ($kv as $key => $value) {
567  $a_excel->setCell($a_excel_row, 0, $key);
568  $a_excel->setCell($a_excel_row++, 1, $value);
569  }
570 
571  // grid
572  if ($a_grid) {
573  // header
574  $a_excel->setColors("B" . $a_excel_row . ":E" . $a_excel_row, self::EXCEL_SUBTITLE);
575  $a_excel->setCell($a_excel_row, 0, $this->lng->txt("svy_categories"));
576  foreach ($a_grid["cols"] as $col_idx => $col) {
577  $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
578  }
579  $a_excel_row++;
580 
581  // rows
582  foreach ($a_grid["rows"] as $cols) {
583  foreach ($cols as $col_idx => $col) {
584  $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
585  }
586  $a_excel_row++;
587  }
588  }
589 
590  // text answers
591  if ($a_text_answers) {
592  // "given_answers" ?
593  $a_excel->setCell($a_excel_row, 0, $this->lng->txt("freetext_answers"));
594 
595  // mc/sc
596  if (!is_array($a_text_answers[""] ?? null)) {
597  $a_excel->setColors("B" . $a_excel_row . ":C" . $a_excel_row, self::EXCEL_SUBTITLE);
598  $a_excel->setCell($a_excel_row, 1, $this->lng->txt("title"));
599  $a_excel->setCell($a_excel_row++, 2, $this->lng->txt("answer"));
600  }
601  // mtx (row), txt
602  else {
603  $a_excel->setColors("B" . $a_excel_row . ":B" . $a_excel_row, self::EXCEL_SUBTITLE);
604  $a_excel->setCell($a_excel_row++, 1, $this->lng->txt("answer"));
605  }
606 
607  foreach ($a_text_answers as $var => $items) {
608  foreach ($items as $item) {
609  if (!is_array($a_text_answers[""] ?? null)) {
610  $a_excel->setCell($a_excel_row, 1, $var);
611  $a_excel->setCell($a_excel_row++, 2, $item);
612  } else {
613  $a_excel->setCell($a_excel_row++, 1, $item);
614  }
615  }
616  }
617  }
618  }
619 
620  public function exportData(): void
621  {
622  if ($this->request->getExportFormat() !== '') {
623  $this->exportCumulatedResults(0);
624  } else {
625  $this->ctrl->redirect($this, 'evaluation');
626  }
627  }
628 
629  public function exportDetailData(): void
630  {
631  if ($this->request->getExportFormat() !== '') {
632  $this->exportCumulatedResults(1);
633  } else {
634  $this->ctrl->redirect($this, 'evaluation');
635  }
636  }
637 
638  public function printEvaluation(): void
639  {
640  $this->tpl->setOnScreenMessage('info', $this->lng->txt('use_browser_print_function'), true);
641  $this->ctrl->redirect($this, 'evaluation');
642  }
643 
644  protected function buildExportButtonAndModal(
645  string $export_cmd
646  ): void {
647  $lng = $this->lng;
648  $ctrl = $this->ctrl;
649  $toolbar = $this->toolbar;
650  $ui_fac = $this->gui->ui()->factory();
651 
652  $ctrl->setParameter($this, "export_cmd", $export_cmd);
653  $modal = $this->getExportModal();
654  $button = $ui_fac->button()->standard(
655  $lng->txt("export"),
656  "#"
657  )->withOnClick($modal->getShowSignal());
658 
659  $toolbar->addComponent($button);
660  $toolbar->addComponent($modal);
661  }
662 
663  protected function getExportModal(): Modal\RoundTrip | Form\Standard
664  {
665  $lng = $this->lng;
666  $ctrl = $this->ctrl;
667  $ui_fac = $this->gui->ui()->factory();
668 
669  $post_url = $ctrl->getFormAction($this, "validateAndSubmitExportForm");
670 
671  $inputs["export_format"] = $ui_fac->input()->field()->select(
672  $lng->txt("filetype"),
673  [
674  \ilSurveyEvaluationGUI::TYPE_XLS => $lng->txt("exp_type_excel"),
675  \ilSurveyEvaluationGUI::TYPE_SPSS => $lng->txt("exp_type_csv")
676  ]
677  )
678  //->withValue(\ilSurveyEvaluationGUI::TYPE_XLS)
679  ->withRequired(true);
680 
681  $inputs["export_label"] = $ui_fac->input()->field()->select(
682  $lng->txt("title"),
683  [
684  "label_only" => $lng->txt("export_label_only"),
685  "title_only" => $lng->txt("export_title_only"),
686  "title_label" => $lng->txt("export_title_label")
687  ]
688  )
689  //->withValue("label_only")
690  ->withRequired(true);
691 
692  $modal = $ui_fac->modal()->roundtrip(
693  $lng->txt("svy_export_format"),
694  null,
695  $inputs,
696  $post_url
697  )
698  ->withSubmitLabel($lng->txt("export"));
699 
700  return $modal;
701  }
702 
703  protected function validateAndSubmitExportForm(): void
704  {
705  $lng = $this->lng;
706  $ctrl = $this->ctrl;
707  $tabs = $this->tabs;
708  $toolbar = $this->toolbar;
709  $request = $this->request;
710  $ui_request = $this->gui->http()->request();
711 
712  $export_cmd = $request->getExportCmd();
713  $ctrl->setParameter($this, "export_cmd", $export_cmd);
714  $modal = $this->getExportModal();
715  if ("POST" === $ui_request->getMethod()) {
716  $modal = $modal->withRequest($ui_request);
717  $data = $modal->getData();
718  if ($data) {
719  $ctrl->setParameter($this, "export_format", $data["export_format"]);
720  $ctrl->setParameter($this, "export_label", $data["export_label"]);
721  $ctrl->redirect($this, $export_cmd);
722  } else {
723  switch ($export_cmd) {
724  case "exportData":
725  $tabs->activateSubTab("svy_eval_cumulated");
726  $this->evaluation();
727  return;
728  case "exportDetailData":
729  $tabs->activateSubTab("svy_eval_detail");
730  $this->evaluationdetails();
731  return;
732  case "exportEvaluationUser":
733  $toolbar->addComponent($modal->withOnLoad($modal->getShowSignal()));
734  $tabs->activateSubTab("svy_eval_user");
735  $this->evaluationuser();
736  return;
737  }
738  }
739  }
740 
741  switch ($export_cmd) {
742  case "exportData":
743  $ctrl->redirect($this, "evaluation");
744  // no break
745  case "exportDetailData":
746  $ctrl->redirect($this, "evaluationdetails");
747  // no break
748  case "exportEvaluationUser":
749  $ctrl->redirect($this, "evaluationuser");
750  }
751  }
752 
753  protected function openEvaluation(): void
754  {
755  $skmg_set = new ilSkillManagementSettings();
756  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
757  $this->competenceEval();
758  } else {
759  if ($this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB) {
760  $this->evaluationdetails();
761  } else {
762  $this->evaluation();
763  }
764  }
765  }
766 
767  public function evaluation(
768  int $details = 0
769  ): void {
770  $ilToolbar = $this->toolbar;
771  $tree = $this->tree;
772  $ui = $this->ui;
773 
774  $ui_factory = $ui->factory();
775  $ui_renderer = $ui->renderer();
776 
777  $this->lng->loadLanguageModule("survey");
778 
779  $this->log->debug("check access");
780 
781  // auth
782  if (!$this->hasResultsAccess()) {
783  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
784  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
785  return;
786  }
787 
788  switch ($this->object->getEvaluationAccess()) {
790  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
791  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
792  return;
793  }
794  break;
795 
798  if (!$this->checkAnonymizedEvaluationAccess()) {
799  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
800  return;
801  }
802  break;
803  }
804  }
805 
806  $this->log->debug("check access ok");
807  // setup toolbar
808 
809  $appr_id = $this->evaluation_manager->getCurrentAppraisee();
810  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
811  $results = array();
812 
813  $eval_tpl = new ilTemplate("tpl.il_svy_svy_evaluation.html", true, true, "components/ILIAS/Survey");
814 
815 
816  if ($details) {
817  $this->ui_modifier->setResultsDetailToolbar(
818  $this->object,
819  $ilToolbar,
820  $this->user->getId(),
821  $eval_tpl
822  );
823  } else {
824  $this->ui_modifier->setResultsOverviewToolbar(
825  $this->object,
826  $ilToolbar,
827  $this->user->getId(),
828  $eval_tpl
829  );
830  }
831 
832  if (!$this->object->get360Mode() || $appr_id) {
833  if ($details) {
834  //templates: results, table of contents
835  $dtmpl = new ilTemplate("tpl.il_svy_svy_results_details.html", true, true, "components/ILIAS/Survey/Evaluation");
836  $toc_tpl = new ilTemplate("tpl.svy_results_table_contents.html", true, true, "components/ILIAS/Survey/Evaluation");
837  $this->lng->loadLanguageModule("content");
838  $toc_tpl->setVariable("TITLE_TOC", $this->lng->txt('cont_toc'));
839  }
840 
841  $finished_ids = $this->evaluation_manager->getFilteredFinishedIds();
842 
843  // parse answer data in evaluation results
844  $listing = $this->gui->listing();
845 
846  $panels = [];
847  foreach ($this->object->getSurveyQuestions() as $qdata) {
848  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
849  $q_res = $q_eval->getResults();
850  $results[] = $q_res;
851 
852  if ($details) {
853  $panels = array_merge(
854  $panels,
855  $this->ui_modifier->getDetailPanels(
856  $this->object->getSurveyParticipants(),
858  $q_eval
859  )
860  );
861 
862  // TABLE OF CONTENTS
863  if ($qdata["questionblock_id"] &&
864  $qdata["questionblock_id"] != $this->last_questionblock_id) {
865  $qblock = ilObjSurvey::_getQuestionblock($qdata["questionblock_id"]);
866  if ($qblock["show_blocktitle"]) {
867  $listing->node(
868  $this->ui->factory()->legacy()->content($qdata["questionblock_title"]),
869  "q" . $qdata["questionblock_id"]
870  );
871  } else {
872  $listing->node(
873  $this->ui->factory()->legacy()->content(""),
874  "q" . $qdata["questionblock_id"]
875  );
876  }
877  $this->last_questionblock_id = $qdata["questionblock_id"];
878  }
879  $anchor_id = "svyrdq" . $qdata["question_id"];
880  $listing->node(
881  $this->ui->factory()->link()->standard($qdata["title"], "#" . $anchor_id),
882  (string) $qdata["question_id"],
883  $qdata["questionblock_id"] ? "q" . $qdata["questionblock_id"] : "0"
884  );
885  }
886  }
887 
888  if ($details) {
889  $toc_tpl->setVariable("LIST", $listing->render());
890 
891  //TABLE OF CONTENTS
892  $panel_toc = $ui_factory->panel()->standard("", $ui_factory->legacy()->content($toc_tpl->get()));
893  $render_toc = $ui_renderer->render($panel_toc);
894  $dtmpl->setVariable("PANEL_TOC", $render_toc);
895 
896  //REPORT
897  $report_title = "";
898  $panel_report = $ui_factory->panel()->report($report_title, $panels);
899  $render_report = $ui_renderer->render($panel_report);
900  $dtmpl->setVariable("PANEL_REPORT", $render_report);
901 
902  //print the main template
903  $eval_tpl->setVariable('DETAIL', $dtmpl->get());
904  }
905  }
906 
907  //$eval_tpl->setVariable('MODAL', $modal);
908  if (!$details) {
909  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $results);
910  $eval_tpl->setVariable('CUMULATED', $table_gui->getHTML());
911  }
912 
913  //
914  // print header
915  //
916 
917  $path = "";
918  $path_full = $tree->getPathFull($this->object->getRefId());
919  foreach ($path_full as $data) {
920  $path .= " &raquo; ";
921  $path .= $data['title'];
922  }
923 
925  $props = array(
926  $this->lng->txt("link") => ilLink::_getStaticLink($this->object->getRefId()),
927  $this->lng->txt("path") => $path,
928  $this->lng->txt("svy_results") => !$details
929  ? $this->lng->txt("svy_eval_cumulated")
930  : $this->lng->txt("svy_eval_detail"),
931  $this->lng->txt("date") => ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)),
932  );
933  $eval_tpl->setCurrentBlock("print_header_bl");
934  foreach ($props as $key => $value) {
935  $eval_tpl->setVariable("HEADER_PROP_KEY", $key);
936  $eval_tpl->setVariable("HEADER_PROP_VALUE", $value);
937  $eval_tpl->parseCurrentBlock();
938  }
939 
940  $this->log->debug("end");
941 
942  $this->tpl->setContent($eval_tpl->get());
943  }
944 
953  public function processCSVRow(
954  array $row,
955  bool $quoteAll = false,
956  string $separator = ";"
957  ): array {
958  $resultarray = array();
959  foreach ($row as $rowindex => $entry) {
960  if (is_array($entry)) {
961  $entry = implode("/", $entry);
962  }
963  $surround = false;
964  if ($quoteAll) {
965  $surround = true;
966  }
967  if (strpos($entry ?? "", "\"") !== false) {
968  $entry = str_replace("\"", "\"\"", (string) $entry);
969  $surround = true;
970  }
971  if (strpos($entry ?? "", $separator) !== false) {
972  $surround = true;
973  }
974  // replace all CR LF with LF (for Excel for Windows compatibility
975  $entry = str_replace(chr(13) . chr(10), chr(10), (string) $entry);
976  if ($surround) {
977  //$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
978  $resultarray[$rowindex] = "\"" . $entry . "\"";
979  } else {
980  //$resultarray[$rowindex] = utf8_decode($entry);
981  $resultarray[$rowindex] = $entry;
982  }
983  }
984  return $resultarray;
985  }
986 
987  public function exportEvaluationUser(): void
988  {
989  // build title row(s)
990 
991  $title_row = $title_row2 = array();
992  $title_row[] = $this->lng->txt("lastname"); // #12756
993  $title_row[] = $this->lng->txt("firstname");
994  $title_row[] = $this->lng->txt("login");
995  $title_row[] = $this->lng->txt('workingtime'); // #13622
996  $title_row[] = $this->lng->txt('survey_results_finished');
997  $title_row2[] = "";
998  $title_row2[] = "";
999  $title_row2[] = "";
1000  $title_row2[] = "";
1001  $title_row2[] = "";
1002  if ($this->object->canExportSurveyCode()) {
1003  $title_row[] = $this->lng->txt("codes");
1004  $title_row2[] = "";
1005  }
1006 
1007  $questions = array();
1008 
1009  foreach ($this->object->getSurveyQuestions() as $qdata) {
1010  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], null);
1011  $q_res = $q_eval->getResults();
1012 
1013  $questions[$qdata["question_id"]] = array($q_eval, $q_res);
1014 
1015  $question = is_array($q_res)
1016  ? $q_res[0][1]->getQuestion()
1017  : $q_res->getQuestion();
1018 
1019  $do_title = $do_label = true;
1020  switch ($this->request->getExportLabel()) {
1021  case "label_only":
1022  $title_row[] = $question->label;
1023  $title_row2[] = "";
1024  $do_title = false;
1025  break;
1026 
1027  case "title_only":
1028  $title_row[] = $question->getTitle();
1029  $title_row2[] = "";
1030  $do_label = false;
1031  break;
1032 
1033  default:
1034  $title_row[] = $question->getTitle();
1035  $title_row2[] = $question->label;
1036  break;
1037  }
1038 
1039  $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1040  }
1041 
1042  $rows = array();
1043 
1044  // add title row(s)
1045  $rows[] = $title_row;
1046  if (implode("", $title_row2)) {
1047  $rows[] = $title_row2;
1048  }
1049 
1050  // #13620
1052 
1053  $finished_ids = null;
1054  if ($this->object->get360Mode()) {
1055  $appr_id = $this->request->getAppraiseeId();
1056  if (!$appr_id) {
1057  $this->ctrl->redirect($this, "evaluationuser");
1058  }
1059  $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
1060  if (!count($finished_ids)) {
1061  $finished_ids = array(-1);
1062  }
1063  }
1064 
1065  //$participants = $this->object->getSurveyParticipants($finished_ids);
1066  $participants = $this->access_manager->canReadResultOfParticipants($finished_ids);
1067 
1068  foreach ($participants as $user) {
1069  $user_id = $user["active_id"];
1070 
1071  $row = array();
1072  $row[] = trim($user["lastname"] ?? "")
1073  ? $user["lastname"]
1074  : ($user["name"] ?? ""); // anonymous
1075  $row[] = $user["firstname"] ?? "";
1076  $row[] = $user["login"] ?? ""; // #10579
1077 
1078  if ($this->object->canExportSurveyCode()) {
1079  $row[] = $user_id;
1080  }
1081 
1082  $row[] = $this->object->getWorkingtimeForParticipant($user_id);
1083 
1084  if ($user["finished"] ?? false) {
1085  $dt = new ilDateTime($user["finished_tstamp"], IL_CAL_UNIX);
1086  $row[] = ($this->request->getExportFormat() === self::TYPE_XLS)
1087  ? $dt
1089  } else {
1090  $row[] = "-"; // :TODO:
1091  }
1092 
1093  foreach ($questions as $item) {
1094  $q_eval = $item[0];
1095  $q_res = $item[1];
1096 
1097  $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1098  }
1099 
1100  $rows[] = $row;
1101  }
1102 
1103  // #11179
1104  $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d");
1105  $surveyname = preg_replace("/\s/", "_", trim($surveyname));
1106  $surveyname = ilFileUtils::getASCIIFilename($surveyname);
1107 
1108  switch ($this->request->getExportFormat()) {
1109  case self::TYPE_XLS:
1110  $excel = new ilExcel();
1111  $excel->addSheet($this->lng->txt("svy_eval_user"));
1112 
1113  foreach ($rows as $row_idx => $row) {
1114  foreach ($row as $col_idx => $col) {
1115  $excel->setCell($row_idx + 1, $col_idx, $col);
1116  }
1117  if (!$row_idx) {
1118  $excel->setBold("A1:" . $excel->getColumnCoord(count($row) - 1) . "1");
1119  }
1120  }
1121  $excel->sendToClient($surveyname);
1122 
1123  // no break
1124  case self::TYPE_SPSS:
1125  $csv = "";
1126  $separator = ";";
1127  foreach ($rows as $csvrow) {
1128  $csvrow = str_replace("\n", " ", $this->processCSVRow($csvrow, true, $separator));
1129  $csv .= implode($separator, $csvrow) . "\n";
1130  }
1131  ilUtil::deliverData($csv, "$surveyname.csv");
1132  exit();
1133  }
1134  }
1135 
1139  public function evaluationuser(): void
1140  {
1141  $ilToolbar = $this->toolbar;
1142 
1143  if (!$this->hasResultsAccess() &&
1144  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1145  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1146  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1147  }
1148 
1149  $appr_id = null;
1150  $data = [];
1151 
1152  if ($this->object->get360Mode()) {
1153  $appr_id = $this->getAppraiseeId();
1154  }
1155 
1156  if (!$this->object->get360Mode() || $appr_id) {
1157  $this->buildExportButtonAndModal("exportEvaluationUser");
1158 
1159  $ilToolbar->addSeparator();
1160 
1161  $pv = $this->print->resultsDetails($this->object->getRefId());
1162  $modal_elements = $pv->getModalElements(
1163  $this->ctrl->getLinkTargetByClass(
1164  "ilSurveyEvaluationGUI",
1165  "printResultsPerUserSelection"
1166  )
1167  );
1168  $ilToolbar->addComponent($modal_elements->button);
1169  $ilToolbar->addComponent($modal_elements->modal);
1170 
1171  $data = $this->evaluation_manager->getUserSpecificResults();
1172  }
1173 
1174  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser');
1175  $table_gui->setData($data);
1176  $this->tpl->setContent($table_gui->getHTML());
1177  }
1178 
1179  public function competenceEval(): void
1180  {
1181  $lng = $this->lng;
1182  $ilCtrl = $this->ctrl;
1183  $ilToolbar = $this->toolbar;
1184  $tpl = $this->tpl;
1185  $ilTabs = $this->tabs;
1186 
1187  $survey = $this->object;
1188 
1189  $ilTabs->activateSubTab("svy_eval_competences");
1190  $ilTabs->activateTab("svy_results");
1191 
1192  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "competenceEval"));
1193 
1194  $appr_id = $this->getAppraiseeId();
1195 
1196  if ($appr_id === 0) {
1197  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_no_appraisees_found"));
1198  return;
1199  }
1200 
1201  $this->ui_modifier->setResultsCompetenceToolbar(
1202  $this->object,
1203  $ilToolbar,
1204  $this->user->getId()
1205  );
1206 
1207  // evaluation modes
1208  $eval_modes = array();
1209 
1210  // get all competences of survey
1211  $sskill = new ilSurveySkill($survey);
1212  $opts = $sskill->getAllAssignedSkillsAsOptions();
1213  $skills = array();
1214  foreach ($opts as $id => $o) {
1215  $idarr = explode(":", $id);
1216  $skills[$id] = array("id" => $id, "title" => $o, "profiles" => array(),
1217  "base_skill" => $idarr[0], "tref_id" => $idarr[1]);
1218  }
1219 
1220  // get matching user competence profiles
1221  // -> add gap analysis to profile
1222  $profiles = $this->skill_profile_service->getProfilesOfUser($appr_id);
1223  foreach ($profiles as $p) {
1224  $prof_levels = $this->skill_profile_service->getSkillLevels($p->getId());
1225  foreach ($prof_levels as $pl) {
1226  if (isset($skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()])) {
1227  $skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()]["profiles"][] =
1228  $p->getId();
1229 
1230  $eval_modes["gap_" . $p->getId()] =
1231  $lng->txt("svy_gap_analysis") . ": " . $p->getTitle();
1232  }
1233  }
1234  }
1235 
1236  // if one competence does not match any profiles
1237  // -> add "competences of survey" alternative
1238  foreach ($skills as $sk) {
1239  if (count($sk["profiles"]) === 0) {
1240  $eval_modes["skills_of_survey"] = $lng->txt("svy_all_survey_competences");
1241  }
1242  }
1243 
1244  // final determination of current evaluation mode
1245  $comp_eval_mode = $this->request->getCompEvalMode();
1246 
1247  if (!isset($eval_modes[$comp_eval_mode])) {
1248  $comp_eval_mode = key($eval_modes);
1249  $ilCtrl->setParameter($this, "comp_eval_mode", $comp_eval_mode);
1250  }
1251 
1252  $ilCtrl->saveParameter($this, "comp_eval_mode");
1253 
1254  $mode_sel = new ilSelectInputGUI($lng->txt("svy_analysis"), "comp_eval_mode");
1255  $mode_sel->setOptions($eval_modes);
1256  $mode_sel->setValue($comp_eval_mode);
1257  $ilToolbar->addInputItem($mode_sel, true);
1258 
1259  $ilToolbar->addFormButton($lng->txt("select"), "competenceEval");
1260 
1261  $pskills_gui = new ilPersonalSkillsGUI();
1262  $rater = $this->evaluation_manager->getCurrentRater(
1263  $this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB
1264  );
1265  if ($rater !== "") {
1266  if (strpos($rater ?? "", "u") === 0) {
1267  $rater = substr($rater, 1);
1268  }
1269  $pskills_gui->setTriggerUserFilter($rater);
1270  $pskills_gui->setHistoryView(true);
1271  }
1272 
1273  if (strpos($comp_eval_mode ?? "", "gap_") === 0) {
1274  // gap analysis
1275  $profile_id = (int) substr($comp_eval_mode, 4);
1276 
1277  $pskills_gui->setProfileId($profile_id);
1278  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1279  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1280  $sskill = new ilSurveySkill($survey);
1281  $self_levels = array();
1282  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1283  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1284  }
1285  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1286  }
1287  $html = $pskills_gui->getGapAnalysisHTML($appr_id);
1288  } else { // must be all survey competences
1289  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1290  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1291  $sskill = new ilSurveySkill($survey);
1292  $self_levels = array();
1293  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1294  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1295  }
1296  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1297  }
1298  $sk = array();
1299  foreach ($skills as $skill) {
1300  $sk[] = array(
1301  "base_skill_id" => (int) $skill["base_skill"],
1302  "tref_id" => (int) $skill["tref_id"]
1303  );
1304  }
1305  $html = $pskills_gui->getGapAnalysisHTML($appr_id, $sk);
1306  }
1307  $tpl->setContent($html);
1308  }
1309 
1314  protected function hasResultsAccess(): bool
1315  {
1316  return $this->access->checkRbacOrPositionPermissionAccess('read_results', 'access_results', $this->object->getRefId());
1317  }
1318 
1322  public function sumscore(): void
1323  {
1324  if (!$this->hasResultsAccess() &&
1325  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1326  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1327  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1328  }
1329 
1330  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_max_sum_score") . ": " . $this->object->getMaxSumScore());
1331 
1332  $this->gui->button(
1333  $this->lng->txt("print"),
1334  "#"
1335  )->onClick("window.print(); return false;")->toToolbar();
1336 
1337  $finished_ids = null;
1338 
1339  $sum_scores = $this->getSumScores($finished_ids);
1340  $table_gui = new ilSumScoreTableGUI($this, 'sumscore', $this->object->hasAnonymizedResults());
1341  $table_gui->setSumScores($sum_scores);
1342  $this->tpl->setContent($table_gui->getHTML());
1343  }
1344 
1348  protected function getSumScores(
1349  ?array $a_finished_ids = null
1350  ): array {
1351  $sum_scores = [];
1352  foreach ($this->access_manager->canReadResultOfParticipants($a_finished_ids) as $p) {
1353  $sum_scores[$p["active_id"]] = [
1354  "username" => $p["sortname"],
1355  "score" => 0
1356  ];
1357  }
1358 
1359  foreach ($this->object->getSurveyQuestions() as $qdata) {
1360  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $a_finished_ids);
1361  foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1362  if ($sum_score === null) {
1363  $sum_scores[$finished_id]["score"] = null;
1364  }
1365  if ($sum_scores[$finished_id]["score"] !== null) {
1366  $sum_scores[$finished_id]["score"] += (int) $sum_score;
1367  }
1368  }
1369  }
1370  return $sum_scores;
1371  }
1372 
1376  public function printResultsOverviewSelection(): void
1377  {
1378  $view = $this->print->resultsOverview($this->object->getRefId());
1379  $view->sendForm();
1380  }
1381 
1385  public function printResultsDetailsSelection(): void
1386  {
1387  $this->ctrl->setParameterByClass(
1388  "ilSurveyEvaluationGUI",
1389  "vw",
1390  $this->request->getVW()
1391  );
1392  $this->ctrl->setParameterByClass(
1393  "ilSurveyEvaluationGUI",
1394  "cp",
1395  $this->request->getCP()
1396  );
1397  $view = $this->print->resultsDetails($this->object->getRefId());
1398  $view->sendForm();
1399  }
1400 
1401  public function printResultsDetails(): void
1402  {
1403  $view = $this->print->resultsDetails($this->object->getRefId());
1404  $view->sendPrintView();
1405  }
1406 
1410  public function printResultsPerUserSelection(): void
1411  {
1412  $view = $this->print->resultsPerUser($this->object->getRefId());
1413  $view->sendForm();
1414  }
1415 
1416  public function printResultsPerUser(): void
1417  {
1418  $view = $this->print->resultsPerUser($this->object->getRefId());
1419  $view->sendPrintView();
1420  }
1421 }
This describes commonalities between the different modals.
Definition: Modal.php:34
static array static setUseRelativeDates(bool $a_status)
set use relative dates
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
getExportGrid($a_results)
Get grid data.
This describes commonalities between all forms.
Definition: Form.php:32
exportResultsDetailsExcel(ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, bool $a_do_title, bool $a_do_label, int $question_index)
Export details (excel only)
setEvalSubtabs()
Set the tabs for the evaluation output.
evaluationuser()
Print the survey evaluation for a selected user.
static getLogger(string $a_component_id)
Get component logger.
This class represents a selection list property in a property form.
const EVALUATION_ACCESS_OFF
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const EVALUATION_ACCESS_PARTICIPANTS
cancelEvaluationAccess()
Cancels the input of the survey access code for evaluation access.
activateSubTab(string $a_id)
ILIAS Skill Service SkillProfileService $skill_profile_service
addComponent(\ILIAS\UI\Component\Component $a_comp)
static _getQuestionblock(int $questionblock_id)
get question block properties
buildExportButtonAndModal(string $export_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
setContent(string $a_html)
Sets content for standard template.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOptions(array $a_options)
ILIAS Survey Evaluation EvaluationManager $evaluation_manager
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
const IL_CAL_UNIX
ILIAS Survey Access AccessManager $access_manager
checkEvaluationAccess()
Checks the evaluation access after entering the survey access code.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:29
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getASCIIFilename(string $a_filename)
parseResultsToExcel(ilExcel $a_excel, ilSurveyEvaluationResults $a_results, int &$a_excel_row, ?array $a_grid=null, ?array $a_text_answers=null, bool $a_include_mode=true)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
hasResultsAccess()
Check if user can view results granted by rbac or positions.
Personal skills GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setColors(string $a_coords, string $a_background, ?string $a_font=null)
Set cell(s) colors.
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
setBold(string $a_coords)
Set cell(s) to bold.
static _instanciateQuestionEvaluation(int $question_id, ?array $a_finished_ids=null)
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
getCoordByColumnAndRow(int $pColumn=1, int $pRow=1)
Get cell coordinate (e.g.
global $DIC
Definition: shib_login.php:26
ILIAS Survey Mode UIModifier $ui_modifier
$results
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
addSheet(string $a_name, bool $a_activate=true)
Add sheet.
ILIAS Survey Evaluation EvaluationGUIRequest $request
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
exit
processCSVRow(array $row, bool $quoteAll=false, string $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
const EVALUATION_ACCESS_ALL
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
Survey evaluation graphical output.
getSumScores(?array $a_finished_ids=null)
ILIAS Survey InternalGUIService $gui
evaluationdetails()
Show the detailed evaluation.
sumscore()
Show sum score table.
ILIAS Survey PrintView GUIService $print
ilGlobalTemplateInterface $tpl
__construct(ilObjSurvey $a_object)
getTextAnswers($a_results)
Get text answers.