ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 Survey InternalGUIService $gui
 
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 336 of file class.InfoScreenGUI.php.

References ILIAS\Survey\InfoScreen\InfoScreenGUI\$survey, $txt, ILIAS\Survey\InfoScreen\InfoScreenGUI\addPrivacyInfo(), ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilDatePresentation\setUseRelativeDates(), and ILIAS\Repository\user().

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

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

References ILIAS\Survey\InfoScreen\InfoScreenGUI\$survey, ilInfoScreenGUI\addProperty(), ILIAS\Repository\lng(), ilObjSurvey\RESULTS_360_ALL, and ilObjSurvey\RESULTS_360_OWN.

Referenced by ILIAS\Survey\InfoScreen\InfoScreenGUI\addAppraiseeInfo(), and ILIAS\Survey\InfoScreen\InfoScreenGUI\addStartResumeSection().

327  : void {
329  $privacy_info = $this->lng->txt("svy_rater_see_app_info");
331  $privacy_info .= " " . $this->lng->txt("svy_app_see_rater_info");
332  }
333  $info->addProperty($this->lng->txt("svy_privacy_info"), $privacy_info);
334  }
+ 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

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

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(), ilUserUtil\getNamePresentation(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

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

224  : void {
226 
228  if ($this->access_manager->canStartSurvey() &&
229  !$status_manager->mustEnterCode($anonymous_code)) {
230  if (!$this->feature_config->usesAppraisees()) {
231  if ($anonymous_code) {
232  $info->addHiddenElement("anonymous_id", $anonymous_code);
233  }
234  $big_button = false;
235  if ($this->run_manager->hasStarted() &&
236  !$this->run_manager->hasFinished()) {
237  $big_button = array("resume", $this->lng->txt("resume_survey"));
238  } elseif (!$this->run_manager->hasStarted()) {
239  $big_button = array("start", $this->lng->txt("start_survey"));
240  }
241  if ($big_button) {
242  $this->gui->button(
243  $big_button[1],
244  $big_button[0]
245  )->primary()->submit()->toToolbar();
246  }
247  } else {
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 = $this->gui->button(
310  $item[1],
311  $href
312  );
313  $big_button_360 = '<div>' . $button->render() . '</div>';
314 
315  $info->addProperty($appr_name, $big_button_360);
316  }
317  }
318  } elseif (!$status_manager->isAppraisee()) {
319  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("survey_360_no_appraisees"));
320  }
321  }
322  }
323  }
mustEnterCode(string $code="")
Check if user must enter code to start (and currently is able to start)
const ANONYMOUS_USER_ID
Definition: constants.php:27
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:
getAppraiseesToRate(?int $a_user_id, int $a_anonymous_id=null)
getAnonymousIdByCode(string $a_code)
isAppraiseeClosed(int $a_user_id)
Participants StatusManager $status_manager
+ 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 384 of file class.InfoScreenGUI.php.

References $messages, ILIAS\Survey\InfoScreen\InfoScreenGUI\$survey, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), IL_CAL_TIMESTAMP, ILIAS\Repository\lng(), ilInfoScreenGUI\setMessageBox(), and ILIAS\Repository\ui().

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

384  : void
385  {
387 
388  $links = [];
389 
390  if (!$this->access_manager->canStartSurvey() &&
391  $this->access_manager->canEditSettings()) {
392  $messages = [];
393 
394  if (!$survey->hasStarted()) {
395  $messages[] = $this->lng->txt('start_date_not_reached') . ' (' .
399  )) . ")";
400  }
401 
402  if ($survey->hasEnded()) {
403  $messages[] = $this->lng->txt('end_date_reached') . ' (' .
405  }
406 
407  if ($survey->getOfflineStatus()) {
408  $messages[] = $this->lng->txt("survey_is_offline");
409  }
410 
411  if (count($messages) > 0) {
412  $links[] = $this->ui->factory()->link()->standard(
413  $this->lng->txt("survey_edit_settings"),
414  $this->ctrl->getLinkTarget($this->survey_gui, "properties")
415  );
416  $mbox = $this->ui->factory()->messageBox()->info(implode("<br />", $messages));
417  if (count($links) > 0) {
418  $mbox = $mbox->withLinks($links);
419  }
420  $info->setMessageBox($mbox);
421  }
422  }
423  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: xapiexit.php:22
const IL_CAL_TIMESTAMP
+ 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 83 of file class.InfoScreenGUI.php.

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(), ILIAS\Survey\InfoScreen\InfoScreenGUI\addStartResumeSection(), ILIAS\Repository\ctrl(), ILIAS\Survey\InfoScreen\InfoScreenGUI\displayNotStartableReasons(), and ILIAS\Repository\lng().

Referenced by ILIAS\Survey\InternalGUIService\infoScreen().

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

Field Documentation

◆ $access_manager

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

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

◆ $ctrl

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

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

◆ $feature_config

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

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

◆ $gui

ILIAS Survey InternalGUIService ILIAS\Survey\InfoScreen\InfoScreenGUI::$gui
protected

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

◆ $lng

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

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

◆ $main_tpl

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

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

◆ $request

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

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

◆ $requested_code

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

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

◆ $run_manager

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

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

◆ $status_manager

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

◆ $survey

◆ $survey_gui

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

Definition at line 41 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 37 of file class.InfoScreenGUI.php.

◆ $user

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

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