ILIAS  release_8 Revision v8.24
ILIAS\Survey\InfoScreen\InfoScreenGUI Class Reference

Info screen wrapper for the survey. More...

+ Collaboration diagram for ILIAS\Survey\InfoScreen\InfoScreenGUI:

Public Member Functions

 getInfoScreenGUI ()
 

Protected Member Functions

 addStartResumeSection (\ilInfoScreenGUI $info, string $anonymous_code, $output_gui)
 Add start/resume buttons or appraisee list to info screen. More...
 
 addPrivacyInfo (\ilInfoScreenGUI $info)
 
 addAppraiseeInfo (\ilInfoScreenGUI $info)
 
 displayNotStartableReasons (\ilInfoScreenGUI $info)
 

Protected Attributes

ILIAS DI UIServices $ui
 
ilObjSurvey $survey
 
ilObjUser $user
 
ilToolbarGUI $toolbar
 
ilObjSurveyGUI $survey_gui
 
Participants StatusManager $status_manager
 
Access AccessManager $access_manager
 
Execution RunManager $run_manager
 
ServerRequestInterface $request
 
string $requested_code
 
ILIAS Survey Mode FeatureConfig $feature_config
 
ilLanguage $lng
 
ilCtrl $ctrl
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Info screen wrapper for the survey.

The screen currently acts as a start screen, too.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 34 of file class.InfoScreenGUI.php.

Member Function Documentation

◆ addAppraiseeInfo()

ILIAS\Survey\InfoScreen\InfoScreenGUI::addAppraiseeInfo ( \ilInfoScreenGUI  $info)
protected

Definition at line 335 of file class.InfoScreenGUI.php.

337 : void {
339 if ($this->status_manager->isAppraisee()) {
340 $info->addSection($this->lng->txt("survey_360_appraisee_info"));
341
342 $this->addPrivacyInfo($info);
343
344 $appr_data = $survey->getAppraiseesData();
345 $appr_data = $appr_data[$this->user->getId()];
346 $info->addProperty($this->lng->txt("survey_360_raters_status_info"), $appr_data["finished"]);
347
348 if ($survey->get360Mode()) {
349 if (!$appr_data["closed"]) {
350 $button = \ilLinkButton::getInstance();
351 $button->setCaption("survey_360_appraisee_close_action");
352 $button->setUrl($this->ctrl->getLinkTargetByClass(
353 "ilsurveyparticipantsgui",
354 "confirmappraiseeclose"
355 ));
356 $close_button_360 = '<div>' . $button->render() . '</div>';
357
358 $txt = "survey_360_appraisee_close_action_info";
359 if ($survey->getSkillService()) {
360 $txt .= "_skill";
361 }
362 $info->addProperty(
363 $this->lng->txt("status"),
364 $close_button_360 . $this->lng->txt($txt)
365 );
366 } else {
368
369 $dt = new \ilDateTime($appr_data["closed"], IL_CAL_UNIX);
370 $info->addProperty(
371 $this->lng->txt("status"),
372 sprintf(
373 $this->lng->txt("survey_360_appraisee_close_action_status"),
375 )
376 );
377 }
378 }
379 }
380 }
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
$txt
Definition: error.php:13

References $txt, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilLinkButton\getInstance(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilDatePresentation\setUseRelativeDates(), and ILIAS\Repository\user().

Referenced by ILIAS\Survey\InfoScreen\InfoScreenGUI\getInfoScreenGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addPrivacyInfo()

ILIAS\Survey\InfoScreen\InfoScreenGUI::addPrivacyInfo ( \ilInfoScreenGUI  $info)
protected

Definition at line 324 of file class.InfoScreenGUI.php.

326 : void {
328 $privacy_info = $this->lng->txt("svy_rater_see_app_info");
330 $privacy_info .= " " . $this->lng->txt("svy_app_see_rater_info");
331 }
332 $info->addProperty($this->lng->txt("svy_privacy_info"), $privacy_info);
333 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Survey\InfoScreen\InfoScreenGUI\addStartResumeSection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStartResumeSection()

ILIAS\Survey\InfoScreen\InfoScreenGUI::addStartResumeSection ( \ilInfoScreenGUI  $info,
string  $anonymous_code,
  $output_gui 
)
protected

Add start/resume buttons or appraisee list to info screen.

Parameters
object | string$output_gui
Exceptions

ilCtrlException

Definition at line 218 of file class.InfoScreenGUI.php.

222 : void {
224
226 if ($this->access_manager->canStartSurvey() &&
227 !$status_manager->mustEnterCode($anonymous_code)) {
228 if (!$this->feature_config->usesAppraisees()) {
229 if ($anonymous_code) {
230 $info->addHiddenElement("anonymous_id", $anonymous_code);
231 }
232 $big_button = false;
233 if ($this->run_manager->hasStarted() &&
234 !$this->run_manager->hasFinished()) {
235 $big_button = array("resume", $this->lng->txt("resume_survey"));
236 } elseif (!$this->run_manager->hasStarted()) {
237 $big_button = array("start", $this->lng->txt("start_survey"));
238 }
239 if ($big_button) {
241 $button->setCaption($big_button[1], false);
242 $button->setCommand($big_button[0]);
243 $button->setPrimary(true);
244 $this->toolbar->addButtonInstance($button);
245 }
246 } else {
247
248 // list appraisees
249 $appr_ids = array();
250
251 // use given code (if proper external one)
252 if ($anonymous_code) {
253 $anonymous_id = $survey->getAnonymousIdByCode($anonymous_code);
254 if ($anonymous_id) {
255 $appr_ids = $survey->getAppraiseesToRate(0, $anonymous_id);
256 }
257 }
258
259 // registered user
260 // if an auto-code was generated, we still have to check for the original user id
261 if (!$appr_ids && $this->user->getId() !== ANONYMOUS_USER_ID) {
262 $appr_ids = $survey->getAppraiseesToRate($this->user->getId());
263 }
264
265 if (count($appr_ids)) {
266 // map existing runs to appraisees
267 $active_appraisees = array();
268 foreach ($this->run_manager
269 ->getRunsForUser($this->user->getId(), $anonymous_code) as $item) {
270 $active_appraisees[$item->getAppraiseeId()] = $item->getFinished();
271 }
272
273 $list = array();
274 foreach ($appr_ids as $appr_id) {
275 if ($survey->isAppraiseeClosed($appr_id)) {
276 // closed
277 $list[$appr_id] = $this->lng->txt("survey_360_appraisee_is_closed");
278 } elseif (array_key_exists($appr_id, $active_appraisees)) {
279 // already done
280 if ($active_appraisees[$appr_id]) {
281 $list[$appr_id] = $this->lng->txt("already_completed_survey");
282 }
283 // resume
284 else {
285 $list[$appr_id] = array("resume", $this->lng->txt("resume_survey"));
286 }
287 } else {
288 // start
289 $list[$appr_id] = array("start", $this->lng->txt("start_survey"));
290 }
291 }
292
293 $info->addSection($this->lng->txt("survey_360_rate_other_appraisees"));
294
295 if (!$this->status_manager->isAppraisee()) {
296 $this->addPrivacyInfo($info);
297 }
298
299 foreach ($list as $appr_id => $item) {
300 $appr_name = \ilUserUtil::getNamePresentation($appr_id, false, false, "", true);
301
302 if (!is_array($item)) {
303 $info->addProperty($appr_name, $item);
304 } else {
305 $this->ctrl->setParameter($output_gui, "appr_id", $appr_id);
306 $href = $this->ctrl->getLinkTarget($output_gui, $item[0]);
307 $this->ctrl->setParameter($output_gui, "appr_id", "");
308
309 $button = \ilLinkButton::getInstance();
310 $button->setCaption($item[1], false);
311 $button->setUrl($href);
312 $big_button_360 = '<div>' . $button->render() . '</div>';
313
314 $info->addProperty($appr_name, $big_button_360);
315 }
316 }
317 } elseif (!$status_manager->isAppraisee()) {
318 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("survey_360_no_appraisees"));
319 }
320 }
321 }
322 }
Participants StatusManager $status_manager
mustEnterCode(string $code="")
Check if user must enter code to start (and currently is able to start)
getAppraiseesToRate(?int $a_user_id, int $a_anonymous_id=null)
getAnonymousIdByCode(string $a_code)
isAppraiseeClosed(int $a_user_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
const ANONYMOUS_USER_ID
Definition: constants.php:27

References ILIAS\Survey\InfoScreen\InfoScreenGUI\$status_manager, ILIAS\Survey\InfoScreen\InfoScreenGUI\$survey, ilInfoScreenGUI\addHiddenElement(), ILIAS\Survey\InfoScreen\InfoScreenGUI\addPrivacyInfo(), ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilObjSurvey\getAnonymousIdByCode(), ilObjSurvey\getAppraiseesToRate(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), ilUserUtil\getNamePresentation(), ILIAS\Survey\Participants\StatusManager\isAppraisee(), ilObjSurvey\isAppraiseeClosed(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

Referenced by ILIAS\Survey\InfoScreen\InfoScreenGUI\getInfoScreenGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayNotStartableReasons()

ILIAS\Survey\InfoScreen\InfoScreenGUI::displayNotStartableReasons ( \ilInfoScreenGUI  $info)
protected

Definition at line 382 of file class.InfoScreenGUI.php.

382 : void
383 {
385
386 $links = [];
387
388 if (!$this->access_manager->canStartSurvey() &&
389 $this->access_manager->canEditSettings()) {
390 $messages = [];
391
392 if (!$survey->hasStarted()) {
393 $messages[] = $this->lng->txt('start_date_not_reached') . ' (' .
397 )) . ")";
398 }
399
400 if ($survey->hasEnded()) {
401 $messages[] = $this->lng->txt('end_date_reached') . ' (' .
403 }
404
405 if ($survey->getOfflineStatus()) {
406 $messages[] = $this->lng->txt("survey_is_offline");
407 }
408
409 if (count($messages) > 0) {
410 $links[] = $this->ui->factory()->link()->standard(
411 $this->lng->txt("survey_edit_settings"),
412 $this->ctrl->getLinkTarget($this->survey_gui, "properties")
413 );
414 $mbox = $this->ui->factory()->messageBox()->info(implode("<br />", $messages));
415 if (count($links) > 0) {
416 $mbox = $mbox->withLinks($links);
417 }
418 $info->setMessageBox($mbox);
419 }
420 }
421 }
const IL_CAL_TIMESTAMP
@classDescription Date and time handling
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: xapiexit.php:22

References $messages, ilDatePresentation\formatDate(), IL_CAL_TIMESTAMP, ILIAS\Repository\lng(), ilInfoScreenGUI\setMessageBox(), and ILIAS\Repository\ui().

Referenced by ILIAS\Survey\InfoScreen\InfoScreenGUI\getInfoScreenGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInfoScreenGUI()

ILIAS\Survey\InfoScreen\InfoScreenGUI::getInfoScreenGUI ( )

Definition at line 81 of file class.InfoScreenGUI.php.

82 {
87
88 $external_rater = $status_manager->isExternalRater();
89
90 $output_gui = new \ilSurveyExecutionGUI($survey);
91
92 $info = new \ilInfoScreenGUI($this->survey_gui);
93 $info->enablePrivateNotes();
94
95 // appraisee infos
96 $this->addAppraiseeInfo($info);
97
98 // handle (anonymous) code
99
100 try {
101 $this->run_manager->initSession($this->requested_code);
102 } catch (\ilWrongSurveyCodeException $e) {
103 $this->main_tpl->setOnScreenMessage("failure", $e->getMessage(), true);
104 $this->ctrl->redirect($this->survey_gui, "infoScreen");
105 }
106 $anonymous_code = $this->run_manager->getCode();
107
108 // completed message
109 if ($this->status_manager->cantStartAgain()) {
110 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("already_completed_survey"));
111 }
112
113 $separator = false;
114
115 // view results button
116 if ($this->status_manager->canViewUserResults()) {
117 $button = \ilLinkButton::getInstance();
118 $button->setCaption("svy_view_own_results");
119 $button->setUrl($this->ctrl->getLinkTarget($this->survey_gui, "viewUserResults"));
120 $toolbar->addButtonInstance($button);
121 $separator = true;
122 }
123
124 // confirmation mail button / input
125 if ($this->status_manager->canMailUserResults()) {
126 if ($separator) {
128 }
129
130 if (!$user->getEmail()) {
131 $mail = new \ilTextInputGUI($this->lng->txt("email"), "mail");
132 $mail->setSize(25);
133 $mail->setValue($user->getEmail());
134 $toolbar->addInputItem($mail, true);
135 }
136
137 $toolbar->setFormAction($this->ctrl->getFormAction($this->survey_gui, "mailUserResults"));
138
140 $button->setCaption("svy_mail_send_confirmation");
141 $button->setCommand("mailUserResults");
142 $toolbar->addButtonInstance($button);
143 }
144
145 $this->displayNotStartableReasons($info);
146
147 if ($status_manager->mustEnterCode($anonymous_code)) {
148 $info->setFormAction($this->ctrl->getFormAction($this->survey_gui, "infoScreen"));
149 $info->addSection($this->lng->txt("anonymization"));
150 $info->addProperty("", $this->lng->txt("anonymize_anonymous_introduction"));
151 $info->addPropertyTextinput($this->lng->txt("enter_anonymous_id"), "anonymous_id", "", "8", "infoScreen", $this->lng->txt("submit"), true);
152 }
153
154 // display start / resume links/buttons
155 $this->addStartResumeSection($info, $anonymous_code, $output_gui);
156
157 if ($status_manager->canAddItselfAsAppraisee()) { // #14968
158 $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "addSelfAppraisee");
160 $this->lng->txt("survey_360_add_self_appraisee"),
161 $link
162 );
163 }
164
165 //if ($big_button) {
166 /*
167 $toolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
168
169 $toolbar->setCloseFormTag(false);
170 $info->setOpenFormTag(false);*/
171 //}
172 /* #12016
173 else
174 {
175 $info->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
176 }
177 */
178 $toolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
179
180 // introduction
181 if ($survey->getIntroduction() !== '') {
182 $introduction = $survey->getIntroduction();
183 $info->addSection($this->lng->txt("introduction"));
184 $info->addProperty("", $survey->prepareTextareaOutput($introduction) .
185 "<br />" . $info->getHiddenToggleButton());
186 } else {
187 $info->addSection($this->lng->txt("show_details"));
188 $info->addProperty("", $info->getHiddenToggleButton());
189 }
190
191 $info->hideFurtherSections(false);
192
193 if (!$this->feature_config->usesAppraisees()) {
194 $info->addSection($this->lng->txt("svy_general_properties"));
195
196 $info->addProperty(
197 $this->lng->txt("survey_results_anonymization"),
199 ? $this->lng->txt("survey_results_personalized_info")
200 : $this->lng->txt("survey_results_anonymized_info")
201 );
202
203 if ($this->access_manager->canAccessEvaluation()) {
204 $info->addProperty($this->lng->txt("evaluation_access"), $this->lng->txt("evaluation_access_info"));
205 }
206 }
207
208 $info->addMetaDataSections($survey->getId(), 0, $survey->getType());
209
210 return $info;
211 }
displayNotStartableReasons(\ilInfoScreenGUI $info)
addStartResumeSection(\ilInfoScreenGUI $info, string $anonymous_code, $output_gui)
Add start/resume buttons or appraisee list to info screen.
canAddItselfAsAppraisee()
Checks if a user can add himself as an appraisee.
Class ilInfoScreenGUI.
prepareTextareaOutput(string $txt_output)
Prepares a string for a text area output in surveys.
setFormAction(string $a_val, bool $a_multipart=false, string $a_target="")
Set form action (if form action is set, toolbar is wrapped into form tags)
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, ILIAS\Survey\InfoScreen\InfoScreenGUI\$status_manager, ILIAS\Survey\InfoScreen\InfoScreenGUI\$survey, ILIAS\Survey\InfoScreen\InfoScreenGUI\$toolbar, ILIAS\Survey\InfoScreen\InfoScreenGUI\$user, ILIAS\Survey\InfoScreen\InfoScreenGUI\addAppraiseeInfo(), ilToolbarGUI\addButtonInstance(), ilToolbarGUI\addInputItem(), ilToolbarGUI\addSeparator(), ILIAS\Survey\InfoScreen\InfoScreenGUI\addStartResumeSection(), ILIAS\Survey\Participants\StatusManager\canAddItselfAsAppraisee(), ILIAS\Repository\ctrl(), ILIAS\Survey\InfoScreen\InfoScreenGUI\displayNotStartableReasons(), ilObjUser\getEmail(), ilObject\getId(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), ilObjSurvey\getIntroduction(), ilObject\getType(), ILIAS\Survey\Participants\StatusManager\isExternalRater(), ILIAS\Repository\lng(), ILIAS\Survey\Participants\StatusManager\mustEnterCode(), ilObjSurvey\prepareTextareaOutput(), and ilToolbarGUI\setFormAction().

+ Here is the call graph for this function:

Field Documentation

◆ $access_manager

Access AccessManager ILIAS\Survey\InfoScreen\InfoScreenGUI::$access_manager
protected

Definition at line 42 of file class.InfoScreenGUI.php.

◆ $ctrl

ilCtrl ILIAS\Survey\InfoScreen\InfoScreenGUI::$ctrl
protected

Definition at line 48 of file class.InfoScreenGUI.php.

◆ $feature_config

ILIAS Survey Mode FeatureConfig ILIAS\Survey\InfoScreen\InfoScreenGUI::$feature_config
protected

Definition at line 46 of file class.InfoScreenGUI.php.

◆ $lng

ilLanguage ILIAS\Survey\InfoScreen\InfoScreenGUI::$lng
protected

Definition at line 47 of file class.InfoScreenGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ILIAS\Survey\InfoScreen\InfoScreenGUI::$main_tpl
private

Definition at line 49 of file class.InfoScreenGUI.php.

◆ $request

ServerRequestInterface ILIAS\Survey\InfoScreen\InfoScreenGUI::$request
protected

Definition at line 44 of file class.InfoScreenGUI.php.

◆ $requested_code

string ILIAS\Survey\InfoScreen\InfoScreenGUI::$requested_code
protected

Definition at line 45 of file class.InfoScreenGUI.php.

◆ $run_manager

Execution RunManager ILIAS\Survey\InfoScreen\InfoScreenGUI::$run_manager
protected

Definition at line 43 of file class.InfoScreenGUI.php.

◆ $status_manager

Participants StatusManager ILIAS\Survey\InfoScreen\InfoScreenGUI::$status_manager
protected

◆ $survey

ilObjSurvey ILIAS\Survey\InfoScreen\InfoScreenGUI::$survey
protected

◆ $survey_gui

ilObjSurveyGUI ILIAS\Survey\InfoScreen\InfoScreenGUI::$survey_gui
protected

Definition at line 40 of file class.InfoScreenGUI.php.

◆ $toolbar

ilToolbarGUI ILIAS\Survey\InfoScreen\InfoScreenGUI::$toolbar
protected

◆ $ui

ILIAS DI UIServices ILIAS\Survey\InfoScreen\InfoScreenGUI::$ui
protected

Definition at line 36 of file class.InfoScreenGUI.php.

◆ $user

ilObjUser ILIAS\Survey\InfoScreen\InfoScreenGUI::$user
protected

The documentation for this class was generated from the following file: