3 declare(strict_types=1);
36 protected \ILIAS\Survey\InternalGUIService
$gui;
37 protected \ILIAS\DI\UIServices
$ui;
48 protected \ilLanguage
$lng;
58 ServerRequestInterface $request,
62 $this->main_tpl = $DIC->ui()->mainTemplate();
66 $this->
ui = $DIC->ui();
70 $this->status_manager = $domain_service->
participants()->status($this->survey, $user->
getId());
71 $this->access_manager = $domain_service->
access($this->survey->getRefId(), $user->
getId());
72 $this->run_manager = $domain_service->
execution()->run($this->survey, $user->
getId());
73 $this->feature_config = $domain_service->
modeFeatureConfig($this->survey->getMode());
78 $body = $request->getParsedBody();
79 $this->requested_code = (string) ($body[
"anonymous_id"] ??
"");
80 $this->gui = $DIC->survey()->internal()->gui();
90 $external_rater = $status_manager->isExternalRater();
92 $output_gui = new \ilSurveyExecutionGUI($survey);
94 $info = new \ilInfoScreenGUI($this->survey_gui);
95 $info->enablePrivateNotes();
103 $this->run_manager->initSession($this->requested_code);
105 $this->main_tpl->setOnScreenMessage(
"failure", $e->getMessage(),
true);
106 $this->
ctrl->redirect($this->survey_gui,
"infoScreen");
108 $anonymous_code = $this->run_manager->getCode();
111 if ($this->status_manager->cantStartAgain()) {
112 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"already_completed_survey"));
118 if ($this->status_manager->canViewUserResults()) {
120 $this->
lng->txt(
"svy_view_own_results"),
121 $this->
ctrl->getLinkTarget($this->survey_gui,
"viewUserResults")
127 if ($this->status_manager->canMailUserResults()) {
129 $toolbar->addSeparator();
132 if (!$user->getEmail()) {
133 $mail = new \ilTextInputGUI($this->
lng->txt(
"email"),
"mail");
135 $mail->setValue($user->getEmail());
136 $toolbar->addInputItem($mail,
true);
139 $toolbar->setFormAction($this->
ctrl->getFormAction($this->survey_gui,
"mailUserResults"));
142 $this->
lng->txt(
"svy_mail_send_confirmation"),
144 )->submit()->toToolbar();
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);
159 if ($status_manager->canAddItselfAsAppraisee()) {
160 $link = $this->
ctrl->getLinkTargetByClass(
"ilsurveyparticipantsgui",
"addSelfAppraisee");
162 $this->
lng->txt(
"survey_360_add_self_appraisee"),
180 $toolbar->setFormAction($this->
ctrl->getFormAction($output_gui,
"infoScreen"));
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());
189 $info->addSection($this->
lng->txt(
"show_details"));
190 $info->addProperty(
"", $info->getHiddenToggleButton());
193 $info->hideFurtherSections(
false);
195 if (!$this->feature_config->usesAppraisees()) {
196 $info->addSection($this->
lng->txt(
"svy_general_properties"));
199 $this->
lng->txt(
"survey_results_anonymization"),
200 !$survey->hasAnonymizedResults()
201 ? $this->
lng->txt(
"survey_results_personalized_info")
202 : $this->
lng->txt(
"survey_results_anonymized_info")
205 if ($this->access_manager->canAccessEvaluation()) {
206 $info->addProperty($this->
lng->txt(
"evaluation_access"), $this->
lng->txt(
"evaluation_access_info"));
210 $info->addMetaDataSections($survey->getId(), 0, $survey->getType());
222 string $anonymous_code,
228 if ($this->access_manager->canStartSurvey() &&
229 !$status_manager->mustEnterCode($anonymous_code)) {
230 if (!$this->feature_config->usesAppraisees()) {
231 if ($anonymous_code) {
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"));
245 )->primary()->submit()->toToolbar();
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",
"");
309 $button = $this->gui->button(
313 $big_button_360 =
'<div>' . $button->render() .
'</div>';
318 } elseif (!$status_manager->isAppraisee()) {
319 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_360_no_appraisees"));
329 $privacy_info = $this->
lng->txt(
"svy_rater_see_app_info");
331 $privacy_info .=
" " . $this->
lng->txt(
"svy_app_see_rater_info");
333 $info->
addProperty($this->
lng->txt(
"svy_privacy_info"), $privacy_info);
340 if ($this->status_manager->isAppraisee()) {
341 $info->
addSection($this->
lng->txt(
"survey_360_appraisee_info"));
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"]);
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" 358 $close_button_360 =
'<div>' . $button->render() .
'</div>';
360 $txt =
"survey_360_appraisee_close_action_info";
361 if ($survey->getSkillService()) {
365 $this->
lng->txt(
"status"),
366 $close_button_360 . $this->
lng->txt(
$txt)
371 $dt = new \ilDateTime($appr_data[
"closed"],
IL_CAL_UNIX);
373 $this->
lng->txt(
"status"),
375 $this->
lng->txt(
"survey_360_appraisee_close_action_status"),
390 if (!$this->access_manager->canStartSurvey() &&
391 $this->access_manager->canEditSettings()) {
394 if (!$survey->hasStarted()) {
395 $messages[] = $this->
lng->txt(
'start_date_not_reached') .
' (' .
397 $survey->getStartDate(),
402 if ($survey->hasEnded()) {
403 $messages[] = $this->
lng->txt(
'end_date_reached') .
' (' .
407 if ($survey->getOfflineStatus()) {
412 $links[] = $this->
ui->factory()->link()->standard(
413 $this->
lng->txt(
"survey_edit_settings"),
414 $this->
ctrl->getLinkTarget($this->survey_gui,
"properties")
416 $mbox = $this->
ui->factory()->messageBox()->info(implode(
"<br />",
$messages));
417 if (count($links) > 0) {
418 $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...
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)
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:
__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
ILIAS Survey InternalGUIService $gui
static setUseRelativeDates(bool $a_status)
set use relative dates
ServerRequestInterface $request
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)