ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ResultsDetailsPrintViewProviderGUI.php
Go to the documentation of this file.
1<?php
2
20
21use ILIAS\Export;
24
29{
30 protected \ilTree $tree;
31 protected \ILIAS\Survey\InternalGUIService $gui;
32 protected \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request;
33 protected \ILIAS\Survey\Mode\UIModifier $ui_modifier;
34 protected \ILIAS\Survey\Evaluation\EvaluationManager $evaluation_manager;
35 protected \ilObjSurvey $survey;
36 protected int $ref_id;
37 protected \ilLanguage $lng;
38 protected \ilCtrl $ctrl;
39
40 public function __construct(
43 int $ref_id
44 ) {
45 global $DIC;
46
47 $this->lng = $lng;
48 $this->ctrl = $ctrl;
49 $this->ref_id = $ref_id;
50 $this->survey = new \ilObjSurvey($this->ref_id);
51 $this->request = $DIC->survey()
52 ->internal()
53 ->gui()
54 ->evaluation($this->survey)
55 ->request();
56 $this->evaluation_manager = $DIC->survey()
57 ->internal()
58 ->domain()
59 ->evaluation(
60 $this->survey,
61 $DIC->user()->getId(),
62 $this->request->getAppraiseeId(),
63 $this->request->getRaterId()
64 );
65 $this->ui_modifier = $DIC->survey()
66 ->internal()
67 ->gui()
68 ->modeUIModifier($this->survey->getMode());
69 $this->gui = $DIC->survey()
70 ->internal()
71 ->gui();
72 $this->tree = $DIC->repositoryTree();
73 }
74
75 public function getTemplateInjectors(): array
76 {
77 return [
78 static function (\ilGlobalTemplate $tpl): void {
79 //$tpl add js/css
80 }
81 ];
82 }
83
85 {
87 $ilCtrl = $this->ctrl;
88
89 $form = new \ilPropertyFormGUI();
90
91 $radg = new \ilRadioGroupInputGUI($lng->txt("svy_selection"), "print_selection");
92 $radg->setValue("all");
93 $op1 = new \ilRadioOption($lng->txt("svy_all_questions"), "all");
94 $radg->addOption($op1);
95 $op2 = new \ilRadioOption($lng->txt("svy_selected_questions"), "selected");
96 $radg->addOption($op2);
97
98 $nl = new \ilNestedListInputGUI("", "qids");
99 $op2->addSubItem($nl);
100
101 foreach ($this->survey->getSurveyQuestions() as $qdata) {
102 $nl->addListNode(
103 $qdata["question_id"],
104 $qdata["title"],
105 0,
106 false,
107 false
108 );
109 }
110
111 $form->addItem($radg);
112
113
114 $form->addCommandButton("printResultsDetails", $lng->txt("print_view"));
115
116 $form->setTitle($lng->txt("svy_print_selection"));
117 $form->setFormAction($ilCtrl->getFormActionByClass(
118 "ilSurveyEvaluationGUI",
119 "printResultsDetails"
120 ));
121
122 return $form;
123 }
124
125 public function getPages(): array
126 {
127 $print_pages = [];
128
129 $finished_ids = $this->evaluation_manager->getFilteredFinishedIds();
130
131 $selection = $this->request->getPrintSelection();
132 $qids = $this->request->getQuestionIds();
133
134 $first = true;
135 foreach ($this->survey->getSurveyQuestions() as $qdata) {
136 $q_eval = \SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
137
138 if ($selection !== "all" && !in_array($qdata["question_id"], $qids)) {
139 continue;
140 }
141
142 $panels = $this->ui_modifier->getDetailPanels(
143 $this->survey->getSurveyParticipants(),
144 $this->request,
145 $q_eval
146 );
147 $panel_report = $this->gui->ui()->factory()->panel()->report(
148 $this->lng->txt("svy_eval_detail"),
149 $panels
150 );
151 $head = "";
152 if ($first) {
153 $head = $this->getPrintHeader();
154 $first = false;
155 }
156 $print_pages[] = $head . $this->gui->ui()->renderer()->render(
157 $panel_report
158 );
159 //$print_pages[] = $this->gui->ui()->renderer()->render($panels);
160 }
161 return $print_pages;
162 }
163
164 protected function getPrintHeader(): string
165 {
166 $head = "<h2>" . $this->survey->getTitle() . "</h2>\n";
167 $path = "";
168 $path_full = $this->tree->getPathFull($this->survey->getRefId());
169 foreach ($path_full as $data) {
170 $path .= " &raquo; ";
171 $path .= $data['title'];
172 }
173
175 $props = array(
176 $this->lng->txt("url") => \ilLink::_getStaticLink($this->survey->getRefId()),
177 $this->lng->txt("path") => $path,
178 $this->lng->txt("date") => \ilDatePresentation::formatDate(new \ilDateTime(time(), IL_CAL_UNIX)),
179 );
180
181 $f = $this->gui->ui()->factory();
182 $r = $this->gui->ui()->renderer();
183 $l = $f->listing()->descriptive($props);
184
185 return $head . $r->render($l);
186 }
187
188 public function autoPageBreak(): bool
189 {
190 return false;
191 }
192}
static _instanciateQuestionEvaluation(int $question_id, ?array $a_finished_ids=null)
const IL_CAL_UNIX
Class ilCtrl provides processing control methods.
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
special template class to simplify handling of ITX/PEAR
language handling
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...
This class represents a property form user interface.
$path
Definition: ltiservices.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26