3 declare(strict_types=1);
36 protected \ILIAS\DI\UIServices
$ui;
47 protected \ilLanguage
$lng;
57 ServerRequestInterface $request,
61 $this->main_tpl = $DIC->ui()->mainTemplate();
65 $this->
ui = $DIC->ui();
69 $this->status_manager = $domain_service->
participants()->status($this->survey, $user->
getId());
70 $this->access_manager = $domain_service->
access($this->survey->getRefId(), $user->
getId());
71 $this->run_manager = $domain_service->
execution()->run($this->survey, $user->
getId());
72 $this->feature_config = $domain_service->
modeFeatureConfig($this->survey->getMode());
77 $body = $request->getParsedBody();
78 $this->requested_code = (string) ($body[
"anonymous_id"] ??
"");
88 $external_rater = $status_manager->isExternalRater();
90 $output_gui = new \ilSurveyExecutionGUI($survey);
92 $info = new \ilInfoScreenGUI($this->survey_gui);
93 $info->enablePrivateNotes();
101 $this->run_manager->initSession($this->requested_code);
103 $this->main_tpl->setOnScreenMessage(
"failure", $e->getMessage(),
true);
104 $this->
ctrl->redirect($this->survey_gui,
"infoScreen");
106 $anonymous_code = $this->run_manager->getCode();
109 if ($this->status_manager->cantStartAgain()) {
110 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"already_completed_survey"));
116 if ($this->status_manager->canViewUserResults()) {
118 $button->setCaption(
"svy_view_own_results");
119 $button->setUrl($this->
ctrl->getLinkTarget($this->survey_gui,
"viewUserResults"));
120 $toolbar->addButtonInstance($button);
125 if ($this->status_manager->canMailUserResults()) {
127 $toolbar->addSeparator();
130 if (!$user->getEmail()) {
131 $mail = new \ilTextInputGUI($this->
lng->txt(
"email"),
"mail");
133 $mail->setValue($user->getEmail());
134 $toolbar->addInputItem($mail,
true);
137 $toolbar->setFormAction($this->
ctrl->getFormAction($this->survey_gui,
"mailUserResults"));
140 $button->setCaption(
"svy_mail_send_confirmation");
141 $button->setCommand(
"mailUserResults");
142 $toolbar->addButtonInstance($button);
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);
157 if ($status_manager->canAddItselfAsAppraisee()) {
158 $link = $this->
ctrl->getLinkTargetByClass(
"ilsurveyparticipantsgui",
"addSelfAppraisee");
160 $this->
lng->txt(
"survey_360_add_self_appraisee"),
178 $toolbar->setFormAction($this->
ctrl->getFormAction($output_gui,
"infoScreen"));
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());
187 $info->addSection($this->
lng->txt(
"show_details"));
188 $info->addProperty(
"", $info->getHiddenToggleButton());
191 $info->hideFurtherSections(
false);
193 if (!$this->feature_config->usesAppraisees()) {
194 $info->addSection($this->
lng->txt(
"svy_general_properties"));
197 $this->
lng->txt(
"survey_results_anonymization"),
198 !$survey->hasAnonymizedResults()
199 ? $this->
lng->txt(
"survey_results_personalized_info")
200 : $this->
lng->txt(
"survey_results_anonymized_info")
203 if ($this->access_manager->canAccessEvaluation()) {
204 $info->addProperty($this->
lng->txt(
"evaluation_access"), $this->
lng->txt(
"evaluation_access_info"));
208 $info->addMetaDataSections($survey->getId(), 0, $survey->getType());
220 string $anonymous_code,
226 if ($this->access_manager->canStartSurvey() &&
227 !$status_manager->mustEnterCode($anonymous_code)) {
228 if (!$this->feature_config->usesAppraisees()) {
229 if ($anonymous_code) {
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"));
241 $button->setCaption($big_button[1],
false);
242 $button->setCommand($big_button[0]);
243 $button->setPrimary(
true);
244 $this->
toolbar->addButtonInstance($button);
252 if ($anonymous_code) {
253 $anonymous_id = $survey->getAnonymousIdByCode($anonymous_code);
255 $appr_ids = $survey->getAppraiseesToRate(0, $anonymous_id);
262 $appr_ids = $survey->getAppraiseesToRate($this->
user->getId());
265 if (count($appr_ids)) {
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();
274 foreach ($appr_ids as $appr_id) {
275 if ($survey->isAppraiseeClosed($appr_id)) {
277 $list[$appr_id] = $this->
lng->txt(
"survey_360_appraisee_is_closed");
278 } elseif (array_key_exists($appr_id, $active_appraisees)) {
280 if ($active_appraisees[$appr_id]) {
281 $list[$appr_id] = $this->
lng->txt(
"already_completed_survey");
285 $list[$appr_id] = array(
"resume", $this->
lng->txt(
"resume_survey"));
289 $list[$appr_id] = array(
"start", $this->
lng->txt(
"start_survey"));
293 $info->
addSection($this->
lng->txt(
"survey_360_rate_other_appraisees"));
295 if (!$this->status_manager->isAppraisee()) {
299 foreach ($list as $appr_id => $item) {
302 if (!is_array($item)) {
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",
"");
310 $button->setCaption($item[1],
false);
311 $button->setUrl($href);
312 $big_button_360 =
'<div>' . $button->render() .
'</div>';
317 } elseif (!$status_manager->isAppraisee()) {
318 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_360_no_appraisees"));
328 $privacy_info = $this->
lng->txt(
"svy_rater_see_app_info");
330 $privacy_info .=
" " . $this->
lng->txt(
"svy_app_see_rater_info");
332 $info->
addProperty($this->
lng->txt(
"svy_privacy_info"), $privacy_info);
339 if ($this->status_manager->isAppraisee()) {
340 $info->
addSection($this->
lng->txt(
"survey_360_appraisee_info"));
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"]);
348 if ($survey->get360Mode()) {
349 if (!$appr_data[
"closed"]) {
351 $button->setCaption(
"survey_360_appraisee_close_action");
352 $button->setUrl($this->
ctrl->getLinkTargetByClass(
353 "ilsurveyparticipantsgui",
354 "confirmappraiseeclose" 356 $close_button_360 =
'<div>' . $button->render() .
'</div>';
358 $txt =
"survey_360_appraisee_close_action_info";
359 if ($survey->getSkillService()) {
363 $this->
lng->txt(
"status"),
364 $close_button_360 . $this->
lng->txt(
$txt)
369 $dt = new \ilDateTime($appr_data[
"closed"],
IL_CAL_UNIX);
371 $this->
lng->txt(
"status"),
373 $this->
lng->txt(
"survey_360_appraisee_close_action_status"),
388 if (!$this->access_manager->canStartSurvey() &&
389 $this->access_manager->canEditSettings()) {
392 if (!$survey->hasStarted()) {
393 $messages[] = $this->
lng->txt(
'start_date_not_reached') .
' (' .
395 $survey->getStartDate(),
400 if ($survey->hasEnded()) {
401 $messages[] = $this->
lng->txt(
'end_date_reached') .
' (' .
405 if ($survey->getOfflineStatus()) {
410 $links[] = $this->
ui->factory()->link()->standard(
411 $this->
lng->txt(
"survey_edit_settings"),
412 $this->
ctrl->getLinkTarget($this->survey_gui,
"properties")
414 $mbox = $this->
ui->factory()->messageBox()->info(implode(
"<br />",
$messages));
415 if (count($links) > 0) {
416 $mbox = $mbox->withLinks($links);
addAppraiseeInfo(\ilInfoScreenGUI $info)
Info screen wrapper for the survey.
addStartResumeSection(\ilInfoScreenGUI $info, string $anonymous_code, $output_gui)
Add start/resume buttons or appraisee list to info screen.
access(int $ref_id, int $user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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:
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
Participant status manager.
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...
ilGlobalTemplateInterface $main_tpl
displayNotStartableReasons(\ilInfoScreenGUI $info)
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHiddenElement(string $a_name, string $a_value)
__construct()
Constructor setup ILIAS global object public.
modeFeatureConfig(int $mode)
Access AccessManager $access_manager
ilObjSurveyGUI $survey_gui
addSection(string $a_title)
Execution RunManager $run_manager
ILIAS Survey Mode FeatureConfig $feature_config
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Survey Run Note: The manager should get the current user id passed.
addPrivacyInfo(\ilInfoScreenGUI $info)
Participants StatusManager $status_manager
static setUseRelativeDates(bool $a_status)
set use relative dates
ServerRequestInterface $request
Survey internal domain service.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setMessageBox(ILIAS\UI\Component\MessageBox\MessageBox $a_val)