19declare(strict_types=1);
51 $this->main_tpl =
$DIC->ui()->mainTemplate();
53 $this->rbacsystem =
$DIC->rbac()->system();
60 $this->feature_config = $this->domain_service->modeFeatureConfig(
$survey->
getMode());
66 $lng = $this->ui_service->lng();
79 $tut_ids->setAlert(
$lng->txt(
"survey_notification_tutor_recipients_invalid"));
85 if (!$end->getDate()) {
87 $tut_res->setAlert(
$lng->txt(
"svy_notification_tutor_results_alert"));
95 $tut_res_ids->setAlert(
$lng->txt(
"survey_notification_tutor_recipients_invalid"));
115 $tut_logins = $form->
getInput(
"tut_ids");
116 foreach ($tut_logins as $tut_login) {
119 $tut_ids[] = $tut_id;
134 $tut_res_ids = array();
135 $tut_logins = $form->
getInput(
"tut_res_ids");
136 foreach ($tut_logins as $tut_login) {
139 $tut_res_ids[] = $tut_id;
152 $ctrl = $this->ui_service->
ctrl();
153 $lng = $this->ui_service->lng();
155 $form = new \ilPropertyFormGUI();
156 $form->setFormAction($ctrl->getFormActionByClass(
159 $form->setId(
"survey_properties");
172 $form->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
183 $survey = $this->survey;
184 $lng = $this->ui_service->lng();
188 $header = new \ilFormSectionHeaderGUI();
189 $header->setTitle(
$lng->txt(
"settings"));
196 $title = new \ilTextInputGUI(
$lng->txt(
"title"),
"title");
197 $title->setRequired(
true);
198 $title->setValue($survey->getTitle());
205 $desc = new \ilTextAreaInputGUI(
$lng->txt(
"description"),
"description");
207 $desc->setValue($survey->getLongDescription());
210 $ne = new \ilNonEditableValueGUI(
$lng->txt(
"type"));
212 $this->domain_service
213 ->modeProvider($survey->getMode())
219 $self_rate = new \ilCheckboxInputGUI(
$lng->txt(
"survey_360_self_raters"),
"self_rate");
220 $self_rate->setInfo(
$lng->txt(
"survey_360_self_raters_info"));
221 $self_rate->setChecked($survey->get360SelfRaters());
224 $self_appr = new \ilCheckboxInputGUI(
$lng->txt(
"survey_360_self_appraisee"),
"self_appr");
225 $self_appr->setInfo(
$lng->txt(
"survey_360_self_appraisee_info"));
226 $self_appr->setChecked($survey->get360SelfAppraisee());
230 foreach ($this->modifier->getSurveySettingsGeneral($survey) as $item) {
243 $lng = $this->ui_service->
lng();
244 $survey = $this->survey;
247 $lng->loadLanguageModule(
'rep');
249 $section = new \ilFormSectionHeaderGUI();
250 $section->setTitle(
$lng->txt(
'rep_activation_availability'));
254 $act_obj_info = $act_ref_info =
"";
256 $act_obj_info =
' ' .
$lng->txt(
'rep_activation_online_object_info');
257 $act_ref_info =
$lng->txt(
'rep_activation_access_ref_info');
260 $online = new \ilCheckboxInputGUI(
$lng->txt(
'rep_activation_online'),
'online');
261 $online->setInfo(
$lng->txt(
'svy_activation_online_info') . $act_obj_info);
262 $online->setChecked(!$survey->getOfflineStatus());
265 $time_based_aval = new \ilCheckboxInputGUI(
$lng->txt(
'rep_time_based_availability'),
'time_based_avail');
266 $time_based_aval->setChecked(
267 (
int) $survey->getActivationStartDate() > 0 ||
268 (
int) $survey->getActivationEndDate() > 0
270 $form->
addItem($time_based_aval);
272 $dur = new \ilDateDurationInputGUI(
$lng->txt(
'rep_time_period'),
"access_period");
273 $dur->setShowTime(
true);
274 $date = $survey->getActivationStartDate();
278 $date = $survey->getActivationEndDate();
282 $time_based_aval->addSubItem($dur);
284 $visible = new \ilCheckboxInputGUI(
$lng->txt(
'rep_activation_limited_visibility'),
'access_visiblity');
285 $visible->setInfo(
$lng->txt(
'svy_activation_limited_visibility_info'));
286 $visible->setChecked($survey->getActivationVisibility());
287 $time_based_aval->addSubItem($visible);
298 $obj_service = $this->object_service;
299 $survey = $this->survey;
300 $lng = $this->ui_service->lng();
303 $section = new \ilFormSectionHeaderGUI();
304 $section->setTitle(
$lng->txt(
'obj_presentation'));
308 $obj_service->commonSettings()->legacyForm($form, $survey)->addTileImage();
319 $survey = $this->survey;
320 $lng = $this->ui_service->lng();
322 $section = new \ilFormSectionHeaderGUI();
323 $section->setTitle(
$lng->txt(
'svy_settings_section_before_start'));
327 $intro = new \ilTextAreaInputGUI(
$lng->txt(
"introduction"),
"introduction");
328 $intro->setValue($survey->prepareTextareaOutput($survey->getIntroduction()));
331 $intro->setInfo(
$lng->txt(
"survey_introduction_info"));
332 if ((
new \
ilRTESettings($this->domain_service->lng(), $this->domain_service->user()))->getRichTextEditor() ===
"tinymce") {
333 $intro->setUseRte(
true);
334 $intro->setRteTagSet(
"mini");
347 $survey = $this->survey;
348 $lng = $this->ui_service->lng();
353 $section = new \ilFormSectionHeaderGUI();
354 $section->setTitle(
$lng->txt(
'svy_settings_section_access'));
358 $start = $survey->getStartDate();
360 $startingtime = new \ilDateTimeInputGUI(
$lng->txt(
"start_date"),
'start_date');
361 $startingtime->setShowTime(
true);
368 $end = $survey->getEndDate();
370 $endingtime = new \ilDateTimeInputGUI(
$lng->txt(
"end_date"),
'end_date');
371 $endingtime->setShowTime(
true);
379 $codes = new \ilCheckboxInputGUI(
$lng->txt(
"survey_access_code"),
"acc_codes");
380 $codes->setInfo(
$lng->txt(
"survey_access_codes_info"));
381 $codes->setChecked(!$survey->isAccessibleWithoutCode());
385 $codes->setDisabled(
true);
398 $survey = $this->survey;
399 $lng = $this->ui_service->lng();
403 $section = new \ilFormSectionHeaderGUI();
404 $section->setTitle(
$lng->txt(
'svy_settings_section_question_behaviour'));
408 $show_question_titles = new \ilCheckboxInputGUI(
$lng->txt(
"svy_show_questiontitles"),
"show_question_titles");
409 $show_question_titles->setValue(
"1");
410 $show_question_titles->setChecked($survey->getShowQuestionTitles());
411 $form->
addItem($show_question_titles);
423 $survey = $this->survey;
424 $lng = $this->ui_service->lng();
426 $ctrl = $this->ui_service->ctrl();
427 $invitation_manager = $this->domain_service->participants()->invitations();
431 $info = new \ilFormSectionHeaderGUI();
432 $info->setTitle(
$lng->txt(
"svy_settings_section_finishing"));
435 $mail_confirm = new \ilCheckboxInputGUI(
$lng->txt(
"svy_results_mail_confirm"),
"mail_confirm");
436 $mail_confirm->setInfo(
$lng->txt(
"svy_results_mail_confirm_info"));
437 $mail_confirm->setChecked($survey->hasMailConfirmation());
440 $mail_own = new \ilCheckboxInputGUI(
$lng->txt(
"svy_results_mail_own"),
"mail_own");
441 $mail_own->setInfo(
$lng->txt(
"svy_results_mail_own_info"));
442 $mail_own->setChecked($survey->hasMailOwnResults());
443 $mail_confirm->addSubItem($mail_own);
446 $finalstatement = new \ilTextAreaInputGUI(
$lng->txt(
"outro"),
"outro");
447 $finalstatement->setValue($survey->prepareTextareaOutput($survey->getOutro()));
448 $finalstatement->setRows(10);
449 $finalstatement->setCols(80);
450 if ((
new \
ilRTESettings($this->domain_service->lng(), $this->domain_service->user()))->getRichTextEditor() ===
"tinymce") {
451 $finalstatement->setUseRte(
true);
452 $finalstatement->setRteTagSet(
"mini");
454 $form->
addItem($finalstatement);
457 $mailnotification = new \ilCheckboxInputGUI(
$lng->txt(
"mailnotification"),
"mailnotification");
459 $mailnotification->setInfo(
$lng->txt(
"svy_result_mail_notification_info"));
460 $mailnotification->setValue(
"1");
461 $mailnotification->setChecked($survey->getMailNotification());
464 $mailaddresses = new \ilTextInputGUI(
$lng->txt(
"survey_notification_tutor_recipients"),
"mailaddresses");
465 $mailaddresses->setValue($survey->getMailAddresses());
466 $mailaddresses->setSize(80);
467 $mailaddresses->setInfo(
$lng->txt(
'mailaddresses_info'));
468 $mailaddresses->setRequired(
true);
471 $participantdata = new \ilTextAreaInputGUI(
$lng->txt(
"mailparticipantdata"),
"mailparticipantdata");
472 $participantdata->setValue($survey->getMailParticipantData());
473 $participantdata->setRows(6);
474 $participantdata->setCols(80);
475 $participantdata->setUseRte(
false);
476 $participantdata->setInfo(
$lng->txt(
"mailparticipantdata_info"));
479 $placeholders = array(
480 "FIRST_NAME" =>
"firstname",
481 "LAST_NAME" =>
"lastname",
485 foreach ($placeholders as $placeholder => $caption) {
486 $txt[] =
"[" . strtoupper($placeholder) .
"]: " .
$lng->txt($caption);
488 $txt = implode(
"<br />", $txt);
489 $participantdatainfo = new \ilNonEditableValueGUI(
$lng->txt(
"svy_placeholders_label"),
"",
true);
490 $participantdatainfo->setValue(
$lng->txt(
"mailparticipantdata_placeholder") .
"<br />" . $txt);
492 $mailnotification->addSubItem($mailaddresses);
493 $mailnotification->addSubItem($participantdata);
494 $mailnotification->addSubItem($participantdatainfo);
495 $form->
addItem($mailnotification);
499 $num_inv = count($invitation_manager->getAllForSurvey($survey->getSurveyId()));
502 $tut = new \ilCheckboxInputGUI(
$lng->txt(
"survey_notification_tutor_setting"),
"tut");
503 $tut->setChecked($survey->getTutorNotificationStatus());
506 $tut_logins = array();
507 $tuts = $survey->getTutorNotificationRecipients();
509 foreach ($tuts as $tut_id) {
512 $tut_logins[] = $tmp[
"login"];
516 $tut_ids = new \ilTextInputGUI(
$lng->txt(
"survey_notification_tutor_recipients"),
"tut_ids");
517 $tut_ids->setDataSource($ctrl->getLinkTargetByClass($target_class,
"doAutoComplete",
"",
true));
518 $tut_ids->setRequired(
true);
519 $tut_ids->setMulti(
true);
520 $tut_ids->setMultiValues($tut_logins);
521 $tut_ids->setValue(array_shift($tut_logins));
522 $tut->addSubItem($tut_ids);
525 $tut_grp = new \ilRadioGroupInputGUI(
$lng->txt(
"survey_notification_target_group"),
"tut_grp");
526 $tut_grp->setRequired(
true);
527 $tut_grp->setValue((
string) $survey->getTutorNotificationTarget());
528 $tut->addSubItem($tut_grp);
531 $tut_grp_crs = new \ilRadioOption(
532 $lng->txt(
"survey_notification_target_group_parent_course"),
535 if (!$this->hasGroupCourseParent()) {
536 $tut_grp_crs->setInfo(
$lng->txt(
"survey_notification_target_group_parent_course_inactive"));
538 $tut_grp_crs->setInfo(sprintf(
539 $lng->txt(
"survey_notification_target_group_invited_info"),
540 count($survey->getNotificationTargetUserIds(
false))
543 $tut_grp->addOption($tut_grp_crs);
546 $tut_grp_inv = new \ilRadioOption(
547 $lng->txt(
"survey_notification_target_group_invited"),
550 $tut_grp_inv->setInfo(sprintf(
$lng->txt(
"survey_notification_target_group_invited_info"), $num_inv));
551 $tut_grp->addOption($tut_grp_inv);
593 $survey = $this->survey;
595 $tree = $this->domain_service->repositoryTree();
596 $has_parent = $tree->checkForParentType($survey->getRefId(),
"grp");
598 $has_parent = $tree->checkForParentType($survey->getRefId(),
"crs");
600 return (
bool) $has_parent;
609 $survey = $this->survey;
610 $lng = $this->ui_service->lng();
612 $invitation_manager = $this->domain_service->participants()->invitations();
616 $info = new \ilFormSectionHeaderGUI();
617 $info->setTitle(
$lng->txt(
"svy_settings_section_reminders"));
620 $rmd = new \ilCheckboxInputGUI(
$lng->txt(
"survey_reminder_setting"),
"rmd");
621 $rmd->setChecked($survey->getReminderStatus());
624 $rmd_start = new \ilDateTimeInputGUI(
$lng->txt(
"survey_reminder_start"),
"rmd_start");
625 $rmd_start->setRequired(
true);
626 $start = $survey->getReminderStart();
628 $rmd_start->setDate($start);
630 $rmd->addSubItem($rmd_start);
632 $end = $survey->getReminderEnd();
633 $rmd_end = new \ilDateTimeInputGUI(
$lng->txt(
"survey_reminder_end"),
"rmd_end");
635 $rmd_end->setDate($end);
637 $rmd->addSubItem($rmd_end);
639 $rmd_freq = new \ilNumberInputGUI(
$lng->txt(
"survey_reminder_frequency"),
"rmd_freq");
640 $rmd_freq->setRequired(
true);
641 $rmd_freq->setSize(3);
642 $rmd_freq->setSuffix(
$lng->txt(
"survey_reminder_frequency_days"));
643 $rmd_freq->setValue((
string) $survey->getReminderFrequency());
644 $rmd_freq->setMinValue(1);
645 $rmd->addSubItem($rmd_freq);
648 $rmd_grp = new \ilRadioGroupInputGUI(
$lng->txt(
"survey_notification_target_group"),
"rmd_grp");
649 $rmd_grp->setRequired(
true);
650 $rmd_grp->setValue((
string) $survey->getReminderTarget());
651 $rmd->addSubItem($rmd_grp);
653 $rmd_grp_crs = new \ilRadioOption(
654 $lng->txt(
"survey_notification_target_group_parent_course"),
657 if (!$this->hasGroupCourseParent()) {
658 $rmd_grp_crs->setInfo(
$lng->txt(
"survey_notification_target_group_parent_course_inactive"));
660 $rmd_grp_crs->setInfo(sprintf(
661 $lng->txt(
"survey_notification_target_group_invited_info"),
662 count($survey->getNotificationTargetUserIds(
false))
665 $rmd_grp->addOption($rmd_grp_crs);
667 $rmd_grp_inv = new \ilRadioOption(
668 $lng->txt(
"survey_notification_target_group_invited"),
671 $num_inv = count($invitation_manager->getAllForSurvey($survey->getSurveyId()));
672 $rmd_grp_inv->setInfo(sprintf(
$lng->txt(
"survey_notification_target_group_invited_info"), $num_inv));
673 $rmd_grp->addOption($rmd_grp_inv);
675 $mtmpl = $survey->getReminderMailTemplates();
677 $rmdt = new \ilRadioGroupInputGUI(
$lng->txt(
"svy_reminder_mail_template"),
"rmdt");
678 $rmdt->setRequired(
true);
679 $rmdt->addOption(
new \
ilRadioOption(
$lng->txt(
"svy_reminder_mail_template_none"),
"-1"));
680 foreach ($mtmpl as $mtmpl_id => $mtmpl_caption) {
681 $option = new \ilRadioOption($mtmpl_caption, (
string) $mtmpl_id);
682 $rmdt->addOption($option);
685 $reminderTemplateValue = -1;
686 if ($survey->getReminderTemplate()) {
687 $reminderTemplateValue = $survey->getReminderTemplate();
689 $rmdt->setValue((
string) $reminderTemplateValue);
690 $rmd->addSubItem($rmdt);
694 foreach ($this->modifier->getSurveySettingsReminderTargets(
698 $rmd->addSubItem($item);
710 $lng = $this->ui_service->
lng();
711 $survey = $this->survey;
716 $results = new \ilFormSectionHeaderGUI();
722 $sum_score = new \ilCheckboxInputGUI(
$lng->txt(
"survey_calculate_sum_score"),
"calculate_sum_score");
723 $sum_score->setInfo(
$lng->txt(
"survey_calculate_sum_score_info"));
724 $sum_score->setValue(
"1");
725 $sum_score->setChecked($survey->getCalculateSumScore());
729 foreach ($this->modifier->getSurveySettingsResults(
745 $lng = $this->ui_service->
lng();
746 $survey = $this->survey;
753 $skmg_set = new \ilSkillManagementSettings();
756 $skill_service = new \ilCheckboxInputGUI(
$lng->txt(
"survey_activate_skill_service"),
"skill_service");
757 $skill_service->setInfo(
$lng->txt(
"survey_activate_skill_service_info"));
758 $skill_service->setChecked($survey->getSkillService());
759 $other_items[] = $skill_service;
763 ->getObjectPositionSettingsByType($survey->getType());
765 if (count($other_items) > 0 ||
766 $position_settings->isActive()
768 $feat = new \ilFormSectionHeaderGUI();
769 $feat->setTitle(
$lng->txt(
'obj_features'));
772 foreach ($other_items as $item) {
777 if ($position_settings->isActive()) {
794 $survey = $this->survey;
796 $obj_service = $this->object_service;
797 $lng = $this->ui_service->lng();
804 $rmd_start = $rmd_end;
807 $survey->setReminderStatus(
true);
808 $survey->setReminderStart($rmd_start);
809 $survey->setReminderEnd($rmd_end);
810 $survey->setReminderFrequency((
int) $form->
getInput(
"rmd_freq"));
812 $survey->setReminderTarget((
int) $form->
getInput(
"rmd_grp"));
813 $survey->setReminderTemplate(($form->
getInput(
"rmdt") > 0)
818 $survey->setReminderStatus(
false);
824 $tut_ids = $this->getTutorIdsFromForm($form);
825 $survey->setTutorNotificationStatus(
true);
826 $survey->setTutorNotificationRecipients($tut_ids);
827 $survey->setTutorNotificationTarget((
int) $form->
getInput(
"tut_grp"));
829 $survey->setTutorNotificationStatus(
false);
843 if ($form->
getInput(
'online') && count($survey->questions) === 0) {
844 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->txt(
"cannot_switch_to_online_no_questions"),
true);
846 $survey->setOfflineStatus(!$form->
getInput(
'online'));
849 $survey->setMailOwnResults((
bool) $form->
getInput(
"mail_own"));
850 $survey->setMailConfirmation((
bool) $form->
getInput(
"mail_confirm"));
853 $survey->setTitle($form->
getInput(
'title'));
854 $survey->setDescription($form->
getInput(
'description'));
859 $tb = $form->
getInput(
"time_based_avail");
860 if ($tb && $period->getStart() && $period->getEnd()) {
861 $survey->setActivationLimited(
true);
862 $survey->setActivationVisibility((
bool) $form->
getInput(
"access_visiblity"));
863 $survey->setActivationStartDate($period->getStart()->get(
IL_CAL_UNIX));
864 $survey->setActivationEndDate($period->getEnd()->get(
IL_CAL_UNIX));
866 $survey->setActivationLimited(
false);
870 $obj_service->commonSettings()->legacyForm($form, $survey)->saveTileImage();
873 if ($start->getDate()) {
877 $survey->setStartDate(
"");
881 if ($end->getDate()) {
885 $survey->setEndDate(
"");
890 $introduction = $form->
getInput(
"introduction");
891 $introduction = $purifier->purify($introduction);
892 $survey->setIntroduction($introduction);
894 $outro = $purifier->purify($outro);
895 $survey->setOutro($outro);
896 $survey->setShowQuestionTitles((
bool) $form->
getInput(
"show_question_titles"));
899 $survey->setMailNotification((
bool) $form->
getInput(
'mailnotification'));
900 $survey->setMailAddresses($form->
getInput(
'mailaddresses'));
901 $survey->setMailParticipantData($form->
getInput(
'mailparticipantdata'));
904 $survey->set360SelfAppraisee((
bool) $form->
getInput(
"self_appr"));
905 $survey->set360SelfRaters((
bool) $form->
getInput(
"self_rate"));
909 $survey->setSkillService((
bool) $form->
getInput(
"skill_service"));
912 foreach ($this->modifier->getSurveySettingsResults(
916 $this->modifier->setValuesFromForm($survey, $form);
Survey internal ui service.
@classDescription Date and time handling
const NOTIFICATION_INVITED_USERS
const NOTIFICATION_PARENT_COURSE
static _hasDatasets(int $survey_id)
static _lookupName(int $a_user_id)
static _lookupId(string|array $a_user_str)
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const ORGU_POSITION_ACCESS
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static _getAllReferences(int $id)
get all reference ids for object ID
This class represents an option in a radio group.
checkAccessOfUser(int $a_user_id, string $a_operations, int $a_ref_id, string $a_type="")
supportsTutorNotification()
usesAppraisees()
If raters rate single persons (appraisees) this mode is activated.
FeatureConfig $feature_config