ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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  foreach ($this->object->getSurveyQuestions() as $qdata) {
350  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
351  $q_res = $q_eval->getResults();
352  $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
353 
354  switch ($this->request->getExportFormat()) {
355  case self::TYPE_XLS:
356  $excel->setActiveSheet(0);
357  foreach ($ov_rows as $row) {
358  foreach ($row as $col => $value) {
359  $excel->setCell($ov_row, $col, $value);
360  }
361  $ov_row++;
362  }
363  break;
364 
365  case self::TYPE_SPSS:
366  foreach ($ov_rows as $row) {
367  $csvfile[] = $row;
368  }
369  break;
370  }
371 
372  if ($details) {
373  switch ($this->request->getExportFormat()) {
374  case self::TYPE_XLS:
375  $this->exportResultsDetailsExcel($excel, $q_eval, $q_res, $do_title, $do_label);
376  break;
377  }
378  }
379  }
380 
381  // #11179
382  $type = !$details
383  ? $this->lng->txt("svy_eval_cumulated")
384  : $this->lng->txt("svy_eval_detail");
385 
386  $surveyname = $this->object->getTitle() . " " . $type . " " . date("Y-m-d");
387  $surveyname = preg_replace("/\s/", "_", trim($surveyname));
388  $surveyname = ilFileUtils::getASCIIFilename($surveyname);
389 
390  // send to client
391  switch ($this->request->getExportFormat()) {
392  case self::TYPE_XLS:
393  $excel->sendToClient($surveyname);
394  break;
395 
396  case self::TYPE_SPSS:
397  $csv = "";
398  $separator = ";";
399  foreach ($csvfile as $csvrow) {
400  $csvrow = $this->processCSVRow($csvrow, true, $separator);
401  $csv .= implode($separator, $csvrow) . "\n";
402  }
403  ilUtil::deliverData($csv, $surveyname . ".csv");
404  exit();
405  }
406  }
407 
413  protected function exportResultsDetailsExcel(
414  ilExcel $a_excel,
415  SurveyQuestionEvaluation $a_eval,
416  $a_results,
417  bool $a_do_title,
418  bool $a_do_label
419  ): void {
420  $question_res = $a_results;
421  $matrix = false;
422  if (is_array($question_res)) {
423  $question_res = $question_res[0][1];
424  $matrix = true;
425  }
426  $question = $question_res->getQuestion();
427 
428  $a_excel->addSheet($question->getTitle());
429 
430 
431  // question "overview"
432 
433  $kv = array();
434 
435  if ($a_do_title) {
436  $kv[$this->lng->txt("title")] = $question->getTitle();
437  }
438  if ($a_do_label) {
439  $kv[$this->lng->txt("label")] = $question->label;
440  }
441 
442  // question
443  $kv[$this->lng->txt("question")] = $question->getQuestiontext();
444 
445  // question type
446  $kv[$this->lng->txt("question_type")] = SurveyQuestion::_getQuestionTypeName($question->getQuestionType());
447 
448  // :TODO: present subtypes (hrz/vrt, mc/sc mtx, metric scale)?
449 
450  // answered and skipped users
451  $kv[$this->lng->txt("users_answered")] = $question_res->getUsersAnswered();
452  $kv[$this->lng->txt("users_skipped")] = $question_res->getUsersSkipped(); // #0021671
453 
454  $excel_row = 1;
455 
456  foreach ($kv as $key => $value) {
457  $a_excel->setCell($excel_row, 0, $key);
458  $a_excel->setCell($excel_row++, 1, $value);
459  }
460 
461  if (!$matrix) {
462  $this->parseResultsToExcel(
463  $a_excel,
464  $question_res,
465  $excel_row,
466  $a_eval->getExportGrid($a_results),
467  $a_eval->getTextAnswers($a_results)
468  );
469  } else {
470  // question
471  $this->parseResultsToExcel(
472  $a_excel,
473  $question_res,
474  $excel_row,
475  null,
476  null,
477  false
478  );
479 
480  $texts = $a_eval->getTextAnswers($a_results);
481 
482  // "rows"
483  foreach ($a_results as $row_results) {
484  $row_title = $row_results[0];
485 
486  $a_excel->setCell($excel_row, 0, $this->lng->txt("row"));
487  $a_excel->setCell($excel_row++, 1, $row_title);
488 
489  $this->parseResultsToExcel(
490  $a_excel,
491  $row_results[1],
492  $excel_row,
493  $a_eval->getExportGrid($row_results[1]),
494  is_array($texts[$row_title] ?? false)
495  ? array("" => $texts[$row_title])
496  : null
497  );
498  }
499  }
500 
501  // matrix question: overview #21438
502  if ($matrix) {
503  $a_excel->setCell($excel_row++, 0, $this->lng->txt("overview"));
504 
505  // title row with variables
506  $counter = 0;
507  $cats = $question->getColumns();
508  foreach ($cats->getCategories() as $cat) {
509  $a_excel->setColors($a_excel->getCoordByColumnAndRow(1 + $counter, $excel_row), self::EXCEL_SUBTITLE);
510  $a_excel->setCell($excel_row, 1 + $counter, $cat->title);
511  $counter++;
512  }
513  $excel_row++;
514 
515  foreach ($a_results as $row_results) {
516  $row_title = $row_results[0];
517  $counter = 0;
518  $a_excel->setCell($excel_row, 0, $row_title);
519 
520  $vars = $row_results[1]->getVariables();
521  if ($vars) {
522  foreach ($vars as $var) {
523  $a_excel->setCell($excel_row, ++$counter, $var->abs);
524  }
525  }
526  $excel_row++;
527  }
528  }
529 
530  // 1st column is bold
531  $a_excel->setBold("A1:A" . $excel_row);
532  }
533 
534  protected function parseResultsToExcel(
535  ilExcel $a_excel,
536  ilSurveyEvaluationResults $a_results,
537  int &$a_excel_row,
538  ?array $a_grid = null,
539  ?array $a_text_answers = null,
540  bool $a_include_mode = true
541  ): void {
542  $kv = array();
543 
544  if ($a_include_mode) {
545  if ($a_results->getModeValue() !== null) {
546  // :TODO:
547  $kv[$this->lng->txt("mode")] = is_array($a_results->getModeValue())
548  ? implode(", ", $a_results->getModeValue())
549  : $a_results->getModeValue();
550 
551  $kv[$this->lng->txt("mode_text")] = $a_results->getModeValueAsText();
552  $kv[$this->lng->txt("mode_nr_of_selections")] = $a_results->getModeNrOfSelections();
553  }
554 
555  if ($a_results->getMedian() !== null) {
556  $kv[$this->lng->txt("median")] = $a_results->getMedianAsText();
557  }
558 
559  if ($a_results->getMean() !== null) {
560  $kv[$this->lng->txt("arithmetic_mean")] = $a_results->getMean();
561  }
562  }
563 
564  foreach ($kv as $key => $value) {
565  $a_excel->setCell($a_excel_row, 0, $key);
566  $a_excel->setCell($a_excel_row++, 1, $value);
567  }
568 
569  // grid
570  if ($a_grid) {
571  // header
572  $a_excel->setColors("B" . $a_excel_row . ":E" . $a_excel_row, self::EXCEL_SUBTITLE);
573  $a_excel->setCell($a_excel_row, 0, $this->lng->txt("svy_categories"));
574  foreach ($a_grid["cols"] as $col_idx => $col) {
575  $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
576  }
577  $a_excel_row++;
578 
579  // rows
580  foreach ($a_grid["rows"] as $cols) {
581  foreach ($cols as $col_idx => $col) {
582  $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
583  }
584  $a_excel_row++;
585  }
586  }
587 
588  // text answers
589  if ($a_text_answers) {
590  // "given_answers" ?
591  $a_excel->setCell($a_excel_row, 0, $this->lng->txt("freetext_answers"));
592 
593  // mc/sc
594  if (!is_array($a_text_answers[""] ?? null)) {
595  $a_excel->setColors("B" . $a_excel_row . ":C" . $a_excel_row, self::EXCEL_SUBTITLE);
596  $a_excel->setCell($a_excel_row, 1, $this->lng->txt("title"));
597  $a_excel->setCell($a_excel_row++, 2, $this->lng->txt("answer"));
598  }
599  // mtx (row), txt
600  else {
601  $a_excel->setColors("B" . $a_excel_row . ":B" . $a_excel_row, self::EXCEL_SUBTITLE);
602  $a_excel->setCell($a_excel_row++, 1, $this->lng->txt("answer"));
603  }
604 
605  foreach ($a_text_answers as $var => $items) {
606  foreach ($items as $item) {
607  if (!is_array($a_text_answers[""] ?? null)) {
608  $a_excel->setCell($a_excel_row, 1, $var);
609  $a_excel->setCell($a_excel_row++, 2, $item);
610  } else {
611  $a_excel->setCell($a_excel_row++, 1, $item);
612  }
613  }
614  }
615  }
616  }
617 
618  public function exportData(): void
619  {
620  if ($this->request->getExportFormat() !== '') {
621  $this->exportCumulatedResults(0);
622  } else {
623  $this->ctrl->redirect($this, 'evaluation');
624  }
625  }
626 
627  public function exportDetailData(): void
628  {
629  if ($this->request->getExportFormat() !== '') {
630  $this->exportCumulatedResults(1);
631  } else {
632  $this->ctrl->redirect($this, 'evaluation');
633  }
634  }
635 
636  public function printEvaluation(): void
637  {
638  $this->tpl->setOnScreenMessage('info', $this->lng->txt('use_browser_print_function'), true);
639  $this->ctrl->redirect($this, 'evaluation');
640  }
641 
642  protected function buildExportButtonAndModal(
643  string $export_cmd
644  ): void {
645  $lng = $this->lng;
646  $ctrl = $this->ctrl;
647  $toolbar = $this->toolbar;
648  $ui_fac = $this->gui->ui()->factory();
649 
650  $ctrl->setParameter($this, "export_cmd", $export_cmd);
651  $modal = $this->getExportModal();
652  $button = $ui_fac->button()->standard(
653  $lng->txt("export"),
654  "#"
655  )->withOnClick($modal->getShowSignal());
656 
657  $toolbar->addComponent($button);
658  $toolbar->addComponent($modal);
659  }
660 
661  protected function getExportModal(): Modal\RoundTrip | Form\Standard
662  {
663  $lng = $this->lng;
664  $ctrl = $this->ctrl;
665  $ui_fac = $this->gui->ui()->factory();
666 
667  $post_url = $ctrl->getFormAction($this, "validateAndSubmitExportForm");
668 
669  $inputs["export_format"] = $ui_fac->input()->field()->select(
670  $lng->txt("filetype"),
671  [
672  \ilSurveyEvaluationGUI::TYPE_XLS => $lng->txt("exp_type_excel"),
673  \ilSurveyEvaluationGUI::TYPE_SPSS => $lng->txt("exp_type_csv")
674  ]
675  )
676  //->withValue(\ilSurveyEvaluationGUI::TYPE_XLS)
677  ->withRequired(true);
678 
679  $inputs["export_label"] = $ui_fac->input()->field()->select(
680  $lng->txt("title"),
681  [
682  "label_only" => $lng->txt("export_label_only"),
683  "title_only" => $lng->txt("export_title_only"),
684  "title_label" => $lng->txt("export_title_label")
685  ]
686  )
687  //->withValue("label_only")
688  ->withRequired(true);
689 
690  $modal = $ui_fac->modal()->roundtrip(
691  $lng->txt("svy_export_format"),
692  null,
693  $inputs,
694  $post_url
695  )
696  ->withSubmitLabel($lng->txt("export"));
697 
698  return $modal;
699  }
700 
701  protected function validateAndSubmitExportForm(): void
702  {
703  $lng = $this->lng;
704  $ctrl = $this->ctrl;
705  $tabs = $this->tabs;
706  $toolbar = $this->toolbar;
707  $request = $this->request;
708  $ui_request = $this->gui->http()->request();
709 
710  $export_cmd = $request->getExportCmd();
711  $ctrl->setParameter($this, "export_cmd", $export_cmd);
712  $modal = $this->getExportModal();
713  if ("POST" === $ui_request->getMethod()) {
714  $modal = $modal->withRequest($ui_request);
715  $data = $modal->getData();
716  if ($data) {
717  $ctrl->setParameter($this, "export_format", $data["export_format"]);
718  $ctrl->setParameter($this, "export_label", $data["export_label"]);
719  $ctrl->redirect($this, $export_cmd);
720  } else {
721  switch ($export_cmd) {
722  case "exportData":
723  $tabs->activateSubTab("svy_eval_cumulated");
724  $this->evaluation();
725  return;
726  case "exportDetailData":
727  $tabs->activateSubTab("svy_eval_detail");
728  $this->evaluationdetails();
729  return;
730  case "exportEvaluationUser":
731  $toolbar->addComponent($modal->withOnLoad($modal->getShowSignal()));
732  $tabs->activateSubTab("svy_eval_user");
733  $this->evaluationuser();
734  return;
735  }
736  }
737  }
738 
739  switch ($export_cmd) {
740  case "exportData":
741  $ctrl->redirect($this, "evaluation");
742  // no break
743  case "exportDetailData":
744  $ctrl->redirect($this, "evaluationdetails");
745  // no break
746  case "exportEvaluationUser":
747  $ctrl->redirect($this, "evaluationuser");
748  }
749  }
750 
751  protected function openEvaluation(): void
752  {
753  $skmg_set = new ilSkillManagementSettings();
754  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
755  $this->competenceEval();
756  } else {
757  if ($this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB) {
758  $this->evaluationdetails();
759  } else {
760  $this->evaluation();
761  }
762  }
763  }
764 
765  public function evaluation(
766  int $details = 0
767  ): void {
768  $ilToolbar = $this->toolbar;
769  $tree = $this->tree;
770  $ui = $this->ui;
771 
772  $ui_factory = $ui->factory();
773  $ui_renderer = $ui->renderer();
774 
775  $this->lng->loadLanguageModule("survey");
776 
777  $this->log->debug("check access");
778 
779  // auth
780  if (!$this->hasResultsAccess()) {
781  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
782  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
783  return;
784  }
785 
786  switch ($this->object->getEvaluationAccess()) {
788  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
789  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
790  return;
791  }
792  break;
793 
796  if (!$this->checkAnonymizedEvaluationAccess()) {
797  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
798  return;
799  }
800  break;
801  }
802  }
803 
804  $this->log->debug("check access ok");
805  // setup toolbar
806 
807  $appr_id = $this->evaluation_manager->getCurrentAppraisee();
808  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
809  $results = array();
810 
811  $eval_tpl = new ilTemplate("tpl.il_svy_svy_evaluation.html", true, true, "components/ILIAS/Survey");
812 
813 
814  if ($details) {
815  $this->ui_modifier->setResultsDetailToolbar(
816  $this->object,
817  $ilToolbar,
818  $this->user->getId(),
819  $eval_tpl
820  );
821  } else {
822  $this->ui_modifier->setResultsOverviewToolbar(
823  $this->object,
824  $ilToolbar,
825  $this->user->getId(),
826  $eval_tpl
827  );
828  }
829 
830  if (!$this->object->get360Mode() || $appr_id) {
831  if ($details) {
832  //templates: results, table of contents
833  $dtmpl = new ilTemplate("tpl.il_svy_svy_results_details.html", true, true, "components/ILIAS/Survey/Evaluation");
834  $toc_tpl = new ilTemplate("tpl.svy_results_table_contents.html", true, true, "components/ILIAS/Survey/Evaluation");
835  $this->lng->loadLanguageModule("content");
836  $toc_tpl->setVariable("TITLE_TOC", $this->lng->txt('cont_toc'));
837  }
838 
839  $finished_ids = $this->evaluation_manager->getFilteredFinishedIds();
840 
841  // parse answer data in evaluation results
842  $listing = $this->gui->listing();
843 
844  $panels = [];
845  foreach ($this->object->getSurveyQuestions() as $qdata) {
846  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
847  $q_res = $q_eval->getResults();
848  $results[] = $q_res;
849 
850  if ($details) {
851  $panels = array_merge(
852  $panels,
853  $this->ui_modifier->getDetailPanels(
854  $this->object->getSurveyParticipants(),
856  $q_eval
857  )
858  );
859 
860  // TABLE OF CONTENTS
861  if ($qdata["questionblock_id"] &&
862  $qdata["questionblock_id"] != $this->last_questionblock_id) {
863  $qblock = ilObjSurvey::_getQuestionblock($qdata["questionblock_id"]);
864  if ($qblock["show_blocktitle"]) {
865  $listing->node(
866  $this->ui->factory()->legacy()->content($qdata["questionblock_title"]),
867  "q" . $qdata["questionblock_id"]
868  );
869  } else {
870  $listing->node(
871  $this->ui->factory()->legacy()->content(""),
872  "q" . $qdata["questionblock_id"]
873  );
874  }
875  $this->last_questionblock_id = $qdata["questionblock_id"];
876  }
877  $anchor_id = "svyrdq" . $qdata["question_id"];
878  $listing->node(
879  $this->ui->factory()->link()->standard($qdata["title"], "#" . $anchor_id),
880  (string) $qdata["question_id"],
881  $qdata["questionblock_id"] ? "q" . $qdata["questionblock_id"] : "0"
882  );
883  }
884  }
885 
886  if ($details) {
887  $toc_tpl->setVariable("LIST", $listing->render());
888 
889  //TABLE OF CONTENTS
890  $panel_toc = $ui_factory->panel()->standard("", $ui_factory->legacy()->content($toc_tpl->get()));
891  $render_toc = $ui_renderer->render($panel_toc);
892  $dtmpl->setVariable("PANEL_TOC", $render_toc);
893 
894  //REPORT
895  $report_title = "";
896  $panel_report = $ui_factory->panel()->report($report_title, $panels);
897  $render_report = $ui_renderer->render($panel_report);
898  $dtmpl->setVariable("PANEL_REPORT", $render_report);
899 
900  //print the main template
901  $eval_tpl->setVariable('DETAIL', $dtmpl->get());
902  }
903  }
904 
905  //$eval_tpl->setVariable('MODAL', $modal);
906  if (!$details) {
907  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $results);
908  $eval_tpl->setVariable('CUMULATED', $table_gui->getHTML());
909  }
910 
911  //
912  // print header
913  //
914 
915  $path = "";
916  $path_full = $tree->getPathFull($this->object->getRefId());
917  foreach ($path_full as $data) {
918  $path .= " &raquo; ";
919  $path .= $data['title'];
920  }
921 
923  $props = array(
924  $this->lng->txt("link") => ilLink::_getStaticLink($this->object->getRefId()),
925  $this->lng->txt("path") => $path,
926  $this->lng->txt("svy_results") => !$details
927  ? $this->lng->txt("svy_eval_cumulated")
928  : $this->lng->txt("svy_eval_detail"),
929  $this->lng->txt("date") => ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)),
930  );
931  $eval_tpl->setCurrentBlock("print_header_bl");
932  foreach ($props as $key => $value) {
933  $eval_tpl->setVariable("HEADER_PROP_KEY", $key);
934  $eval_tpl->setVariable("HEADER_PROP_VALUE", $value);
935  $eval_tpl->parseCurrentBlock();
936  }
937 
938  $this->log->debug("end");
939 
940  $this->tpl->setContent($eval_tpl->get());
941  }
942 
951  public function processCSVRow(
952  array $row,
953  bool $quoteAll = false,
954  string $separator = ";"
955  ): array {
956  $resultarray = array();
957  foreach ($row as $rowindex => $entry) {
958  if (is_array($entry)) {
959  $entry = implode("/", $entry);
960  }
961  $surround = false;
962  if ($quoteAll) {
963  $surround = true;
964  }
965  if (strpos($entry ?? "", "\"") !== false) {
966  $entry = str_replace("\"", "\"\"", (string) $entry);
967  $surround = true;
968  }
969  if (strpos($entry ?? "", $separator) !== false) {
970  $surround = true;
971  }
972  // replace all CR LF with LF (for Excel for Windows compatibility
973  $entry = str_replace(chr(13) . chr(10), chr(10), (string) $entry);
974  if ($surround) {
975  //$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
976  $resultarray[$rowindex] = "\"" . $entry . "\"";
977  } else {
978  //$resultarray[$rowindex] = utf8_decode($entry);
979  $resultarray[$rowindex] = $entry;
980  }
981  }
982  return $resultarray;
983  }
984 
985  public function exportEvaluationUser(): void
986  {
987  // build title row(s)
988 
989  $title_row = $title_row2 = array();
990  $title_row[] = $this->lng->txt("lastname"); // #12756
991  $title_row[] = $this->lng->txt("firstname");
992  $title_row[] = $this->lng->txt("login");
993  $title_row[] = $this->lng->txt('workingtime'); // #13622
994  $title_row[] = $this->lng->txt('survey_results_finished');
995  $title_row2[] = "";
996  $title_row2[] = "";
997  $title_row2[] = "";
998  $title_row2[] = "";
999  $title_row2[] = "";
1000  if ($this->object->canExportSurveyCode()) {
1001  $title_row[] = $this->lng->txt("codes");
1002  $title_row2[] = "";
1003  }
1004 
1005  $questions = array();
1006 
1007  foreach ($this->object->getSurveyQuestions() as $qdata) {
1008  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], null);
1009  $q_res = $q_eval->getResults();
1010 
1011  $questions[$qdata["question_id"]] = array($q_eval, $q_res);
1012 
1013  $question = is_array($q_res)
1014  ? $q_res[0][1]->getQuestion()
1015  : $q_res->getQuestion();
1016 
1017  $do_title = $do_label = true;
1018  switch ($this->request->getExportLabel()) {
1019  case "label_only":
1020  $title_row[] = $question->label;
1021  $title_row2[] = "";
1022  $do_title = false;
1023  break;
1024 
1025  case "title_only":
1026  $title_row[] = $question->getTitle();
1027  $title_row2[] = "";
1028  $do_label = false;
1029  break;
1030 
1031  default:
1032  $title_row[] = $question->getTitle();
1033  $title_row2[] = $question->label;
1034  break;
1035  }
1036 
1037  $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1038  }
1039 
1040  $rows = array();
1041 
1042  // add title row(s)
1043  $rows[] = $title_row;
1044  if (implode("", $title_row2)) {
1045  $rows[] = $title_row2;
1046  }
1047 
1048  // #13620
1050 
1051  $finished_ids = null;
1052  if ($this->object->get360Mode()) {
1053  $appr_id = $this->request->getAppraiseeId();
1054  if (!$appr_id) {
1055  $this->ctrl->redirect($this, "evaluationuser");
1056  }
1057  $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
1058  if (!count($finished_ids)) {
1059  $finished_ids = array(-1);
1060  }
1061  }
1062 
1063  //$participants = $this->object->getSurveyParticipants($finished_ids);
1064  $participants = $this->access_manager->canReadResultOfParticipants($finished_ids);
1065 
1066  foreach ($participants as $user) {
1067  $user_id = $user["active_id"];
1068 
1069  $row = array();
1070  $row[] = trim($user["lastname"] ?? "")
1071  ? $user["lastname"]
1072  : ($user["name"] ?? ""); // anonymous
1073  $row[] = $user["firstname"] ?? "";
1074  $row[] = $user["login"] ?? ""; // #10579
1075 
1076  if ($this->object->canExportSurveyCode()) {
1077  $row[] = $user_id;
1078  }
1079 
1080  $row[] = $this->object->getWorkingtimeForParticipant($user_id);
1081 
1082  if ($user["finished"] ?? false) {
1083  $dt = new ilDateTime($user["finished_tstamp"], IL_CAL_UNIX);
1084  $row[] = ($this->request->getExportFormat() === self::TYPE_XLS)
1085  ? $dt
1087  } else {
1088  $row[] = "-"; // :TODO:
1089  }
1090 
1091  foreach ($questions as $item) {
1092  $q_eval = $item[0];
1093  $q_res = $item[1];
1094 
1095  $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1096  }
1097 
1098  $rows[] = $row;
1099  }
1100 
1101  // #11179
1102  $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d");
1103  $surveyname = preg_replace("/\s/", "_", trim($surveyname));
1104  $surveyname = ilFileUtils::getASCIIFilename($surveyname);
1105 
1106  switch ($this->request->getExportFormat()) {
1107  case self::TYPE_XLS:
1108  $excel = new ilExcel();
1109  $excel->addSheet($this->lng->txt("svy_eval_user"));
1110 
1111  foreach ($rows as $row_idx => $row) {
1112  foreach ($row as $col_idx => $col) {
1113  $excel->setCell($row_idx + 1, $col_idx, $col);
1114  }
1115  if (!$row_idx) {
1116  $excel->setBold("A1:" . $excel->getColumnCoord(count($row) - 1) . "1");
1117  }
1118  }
1119  $excel->sendToClient($surveyname);
1120 
1121  // no break
1122  case self::TYPE_SPSS:
1123  $csv = "";
1124  $separator = ";";
1125  foreach ($rows as $csvrow) {
1126  $csvrow = str_replace("\n", " ", $this->processCSVRow($csvrow, true, $separator));
1127  $csv .= implode($separator, $csvrow) . "\n";
1128  }
1129  ilUtil::deliverData($csv, "$surveyname.csv");
1130  exit();
1131  }
1132  }
1133 
1137  public function evaluationuser(): void
1138  {
1139  $ilToolbar = $this->toolbar;
1140 
1141  if (!$this->hasResultsAccess() &&
1142  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1143  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1144  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1145  }
1146 
1147  $appr_id = null;
1148  $data = [];
1149 
1150  if ($this->object->get360Mode()) {
1151  $appr_id = $this->getAppraiseeId();
1152  }
1153 
1154  if (!$this->object->get360Mode() || $appr_id) {
1155  $this->buildExportButtonAndModal("exportEvaluationUser");
1156 
1157  $ilToolbar->addSeparator();
1158 
1159  $pv = $this->print->resultsDetails($this->object->getRefId());
1160  $modal_elements = $pv->getModalElements(
1161  $this->ctrl->getLinkTargetByClass(
1162  "ilSurveyEvaluationGUI",
1163  "printResultsPerUserSelection"
1164  )
1165  );
1166  $ilToolbar->addComponent($modal_elements->button);
1167  $ilToolbar->addComponent($modal_elements->modal);
1168 
1169  $data = $this->evaluation_manager->getUserSpecificResults();
1170  }
1171 
1172  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser');
1173  $table_gui->setData($data);
1174  $this->tpl->setContent($table_gui->getHTML());
1175  }
1176 
1177  public function competenceEval(): void
1178  {
1179  $lng = $this->lng;
1180  $ilCtrl = $this->ctrl;
1181  $ilToolbar = $this->toolbar;
1182  $tpl = $this->tpl;
1183  $ilTabs = $this->tabs;
1184 
1185  $survey = $this->object;
1186 
1187  $ilTabs->activateSubTab("svy_eval_competences");
1188  $ilTabs->activateTab("svy_results");
1189 
1190  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "competenceEval"));
1191 
1192  $appr_id = $this->getAppraiseeId();
1193 
1194  if ($appr_id === 0) {
1195  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_no_appraisees_found"));
1196  return;
1197  }
1198 
1199  $this->ui_modifier->setResultsCompetenceToolbar(
1200  $this->object,
1201  $ilToolbar,
1202  $this->user->getId()
1203  );
1204 
1205  // evaluation modes
1206  $eval_modes = array();
1207 
1208  // get all competences of survey
1209  $sskill = new ilSurveySkill($survey);
1210  $opts = $sskill->getAllAssignedSkillsAsOptions();
1211  $skills = array();
1212  foreach ($opts as $id => $o) {
1213  $idarr = explode(":", $id);
1214  $skills[$id] = array("id" => $id, "title" => $o, "profiles" => array(),
1215  "base_skill" => $idarr[0], "tref_id" => $idarr[1]);
1216  }
1217 
1218  // get matching user competence profiles
1219  // -> add gap analysis to profile
1220  $profiles = $this->skill_profile_service->getProfilesOfUser($appr_id);
1221  foreach ($profiles as $p) {
1222  $prof_levels = $this->skill_profile_service->getSkillLevels($p->getId());
1223  foreach ($prof_levels as $pl) {
1224  if (isset($skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()])) {
1225  $skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()]["profiles"][] =
1226  $p->getId();
1227 
1228  $eval_modes["gap_" . $p->getId()] =
1229  $lng->txt("svy_gap_analysis") . ": " . $p->getTitle();
1230  }
1231  }
1232  }
1233 
1234  // if one competence does not match any profiles
1235  // -> add "competences of survey" alternative
1236  foreach ($skills as $sk) {
1237  if (count($sk["profiles"]) === 0) {
1238  $eval_modes["skills_of_survey"] = $lng->txt("svy_all_survey_competences");
1239  }
1240  }
1241 
1242  // final determination of current evaluation mode
1243  $comp_eval_mode = $this->request->getCompEvalMode();
1244 
1245  if (!isset($eval_modes[$comp_eval_mode])) {
1246  $comp_eval_mode = key($eval_modes);
1247  $ilCtrl->setParameter($this, "comp_eval_mode", $comp_eval_mode);
1248  }
1249 
1250  $ilCtrl->saveParameter($this, "comp_eval_mode");
1251 
1252  $mode_sel = new ilSelectInputGUI($lng->txt("svy_analysis"), "comp_eval_mode");
1253  $mode_sel->setOptions($eval_modes);
1254  $mode_sel->setValue($comp_eval_mode);
1255  $ilToolbar->addInputItem($mode_sel, true);
1256 
1257  $ilToolbar->addFormButton($lng->txt("select"), "competenceEval");
1258 
1259  $pskills_gui = new ilPersonalSkillsGUI();
1260  $rater = $this->evaluation_manager->getCurrentRater();
1261  if ($rater !== "") {
1262  if (strpos($rater ?? "", "u") === 0) {
1263  $rater = substr($rater, 1);
1264  }
1265  $pskills_gui->setTriggerUserFilter([$rater]);
1266  }
1267 
1268  if (strpos($comp_eval_mode ?? "", "gap_") === 0) {
1269  // gap analysis
1270  $profile_id = (int) substr($comp_eval_mode, 4);
1271 
1272  $pskills_gui->setProfileId($profile_id);
1273  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1274  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1275  $sskill = new ilSurveySkill($survey);
1276  $self_levels = array();
1277  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1278  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1279  }
1280  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1281  }
1282  $html = $pskills_gui->getGapAnalysisHTML($appr_id);
1283  } else { // must be all survey competences
1284  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1285  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1286  $sskill = new ilSurveySkill($survey);
1287  $self_levels = array();
1288  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1289  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1290  }
1291  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1292  }
1293  $sk = array();
1294  foreach ($skills as $skill) {
1295  $sk[] = array(
1296  "base_skill_id" => (int) $skill["base_skill"],
1297  "tref_id" => (int) $skill["tref_id"]
1298  );
1299  }
1300  $html = $pskills_gui->getGapAnalysisHTML($appr_id, $sk);
1301  }
1302  $tpl->setContent($html);
1303  }
1304 
1309  protected function hasResultsAccess(): bool
1310  {
1311  return $this->access->checkRbacOrPositionPermissionAccess('read_results', 'access_results', $this->object->getRefId());
1312  }
1313 
1317  public function sumscore(): void
1318  {
1319  if (!$this->hasResultsAccess() &&
1320  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1321  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1322  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1323  }
1324 
1325  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_max_sum_score") . ": " . $this->object->getMaxSumScore());
1326 
1327  $this->gui->button(
1328  $this->lng->txt("print"),
1329  "#"
1330  )->onClick("window.print(); return false;")->toToolbar();
1331 
1332  $finished_ids = null;
1333 
1334  $sum_scores = $this->getSumScores($finished_ids);
1335  $table_gui = new ilSumScoreTableGUI($this, 'sumscore', $this->object->hasAnonymizedResults());
1336  $table_gui->setSumScores($sum_scores);
1337  $this->tpl->setContent($table_gui->getHTML());
1338  }
1339 
1343  protected function getSumScores(
1344  ?array $a_finished_ids = null
1345  ): array {
1346  $sum_scores = [];
1347  foreach ($this->access_manager->canReadResultOfParticipants($a_finished_ids) as $p) {
1348  $sum_scores[$p["active_id"]] = [
1349  "username" => $p["sortname"],
1350  "score" => 0
1351  ];
1352  }
1353 
1354  foreach ($this->object->getSurveyQuestions() as $qdata) {
1355  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $a_finished_ids);
1356  foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1357  if ($sum_score === null) {
1358  $sum_scores[$finished_id]["score"] = null;
1359  }
1360  if ($sum_scores[$finished_id]["score"] !== null) {
1361  $sum_scores[$finished_id]["score"] += (int) $sum_score;
1362  }
1363  }
1364  }
1365  return $sum_scores;
1366  }
1367 
1371  public function printResultsOverviewSelection(): void
1372  {
1373  $view = $this->print->resultsOverview($this->object->getRefId());
1374  $view->sendForm();
1375  }
1376 
1380  public function printResultsDetailsSelection(): void
1381  {
1382  $this->ctrl->setParameterByClass(
1383  "ilSurveyEvaluationGUI",
1384  "vw",
1385  $this->request->getVW()
1386  );
1387  $this->ctrl->setParameterByClass(
1388  "ilSurveyEvaluationGUI",
1389  "cp",
1390  $this->request->getCP()
1391  );
1392  $view = $this->print->resultsDetails($this->object->getRefId());
1393  $view->sendForm();
1394  }
1395 
1396  public function printResultsDetails(): void
1397  {
1398  $view = $this->print->resultsDetails($this->object->getRefId());
1399  $view->sendPrintView();
1400  }
1401 
1405  public function printResultsPerUserSelection(): void
1406  {
1407  $view = $this->print->resultsPerUser($this->object->getRefId());
1408  $view->sendForm();
1409  }
1410 
1411  public function printResultsPerUser(): void
1412  {
1413  $view = $this->print->resultsPerUser($this->object->getRefId());
1414  $view->sendPrintView();
1415  }
1416 }
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
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...
exportResultsDetailsExcel(ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, bool $a_do_title, bool $a_do_label)
Export details (excel only)
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:22
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)
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.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sumscore()
Show sum score table.
ILIAS Survey PrintView GUIService $print
ilGlobalTemplateInterface $tpl
__construct(ilObjSurvey $a_object)
getTextAnswers($a_results)
Get text answers.