19 declare(strict_types=1);
50 $this->main_tpl = $DIC->ui()->mainTemplate();
52 $this->rbacsystem = $DIC->rbac()->system();
59 $this->feature_config = $this->domain_service->modeFeatureConfig($survey->
getMode());
65 $lng = $this->ui_service->lng();
72 if ($feature_config->supportsTutorNotification()) {
78 $tut_ids->setAlert(
$lng->txt(
"survey_notification_tutor_recipients_invalid"));
84 if (!$end->getDate()) {
86 $tut_res->setAlert(
$lng->txt(
"svy_notification_tutor_results_alert"));
94 $tut_res_ids->setAlert(
$lng->txt(
"survey_notification_tutor_recipients_invalid"));
114 $tut_logins = $form->
getInput(
"tut_ids");
115 foreach ($tut_logins as $tut_login) {
117 if ($tut_id && $rbacsystem->checkAccessOfUser($tut_id,
"write", $survey->getRefId())) {
118 $tut_ids[] = $tut_id;
133 $tut_res_ids = array();
134 $tut_logins = $form->
getInput(
"tut_res_ids");
135 foreach ($tut_logins as $tut_login) {
137 if ($tut_id && $rbacsystem->checkAccessOfUser($tut_id,
"write", $survey->getRefId())) {
138 $tut_res_ids[] = $tut_id;
151 $ctrl = $this->ui_service->ctrl();
152 $lng = $this->ui_service->lng();
154 $form = new \ilPropertyFormGUI();
155 $form->setFormAction($ctrl->getFormActionByClass(
158 $form->setId(
"survey_properties");
171 $form->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
183 $lng = $this->ui_service->lng();
187 $header = new \ilFormSectionHeaderGUI();
188 $header->setTitle(
$lng->txt(
"settings"));
195 $title = new \ilTextInputGUI(
$lng->txt(
"title"),
"title");
196 $title->setRequired(
true);
197 $title->setValue($survey->getTitle());
204 $desc = new \ilTextAreaInputGUI(
$lng->txt(
"description"),
"description");
206 $desc->setValue($survey->getLongDescription());
209 $ne = new \ilNonEditableValueGUI(
$lng->txt(
"type"));
211 $this->domain_service
212 ->modeProvider($survey->getMode())
217 if ($feature_config->usesAppraisees()) {
218 $self_rate = new \ilCheckboxInputGUI(
$lng->txt(
"survey_360_self_raters"),
"self_rate");
219 $self_rate->setInfo(
$lng->txt(
"survey_360_self_raters_info"));
220 $self_rate->setChecked($survey->get360SelfRaters());
223 $self_appr = new \ilCheckboxInputGUI(
$lng->txt(
"survey_360_self_appraisee"),
"self_appr");
224 $self_appr->setInfo(
$lng->txt(
"survey_360_self_appraisee_info"));
225 $self_appr->setChecked($survey->get360SelfAppraisee());
229 foreach ($this->modifier->getSurveySettingsGeneral($survey) as $item) {
242 $lng = $this->ui_service->lng();
246 $lng->loadLanguageModule(
'rep');
248 $section = new \ilFormSectionHeaderGUI();
249 $section->setTitle(
$lng->txt(
'rep_activation_availability'));
253 $act_obj_info = $act_ref_info =
"";
255 $act_obj_info =
' ' .
$lng->txt(
'rep_activation_online_object_info');
256 $act_ref_info =
$lng->txt(
'rep_activation_access_ref_info');
259 $online = new \ilCheckboxInputGUI(
$lng->txt(
'rep_activation_online'),
'online');
260 $online->setInfo(
$lng->txt(
'svy_activation_online_info') . $act_obj_info);
261 $online->setChecked(!$survey->getOfflineStatus());
264 $time_based_aval = new \ilCheckboxInputGUI(
$lng->txt(
'rep_time_based_availability'),
'time_based_avail');
265 $time_based_aval->setChecked(
266 (
int) $survey->getActivationStartDate() > 0 ||
267 (
int) $survey->getActivationEndDate() > 0
269 $form->
addItem($time_based_aval);
271 $dur = new \ilDateDurationInputGUI(
$lng->txt(
'rep_time_period'),
"access_period");
272 $dur->setShowTime(
true);
273 $date = $survey->getActivationStartDate();
277 $date = $survey->getActivationEndDate();
281 $time_based_aval->addSubItem($dur);
283 $visible = new \ilCheckboxInputGUI(
$lng->txt(
'rep_activation_limited_visibility'),
'access_visiblity');
284 $visible->setInfo(
$lng->txt(
'svy_activation_limited_visibility_info'));
285 $visible->setChecked($survey->getActivationVisibility());
286 $time_based_aval->addSubItem($visible);
299 $lng = $this->ui_service->lng();
302 $section = new \ilFormSectionHeaderGUI();
303 $section->setTitle(
$lng->txt(
'obj_presentation'));
307 $obj_service->commonSettings()->legacyForm($form, $survey)->addTileImage();
319 $lng = $this->ui_service->lng();
321 $section = new \ilFormSectionHeaderGUI();
322 $section->setTitle(
$lng->txt(
'svy_settings_section_before_start'));
326 $intro = new \ilTextAreaInputGUI(
$lng->txt(
"introduction"),
"introduction");
327 $intro->setValue($survey->prepareTextareaOutput($survey->getIntroduction()));
330 $intro->setInfo(
$lng->txt(
"survey_introduction_info"));
331 if ((
new \
ilRTESettings($this->domain_service->lng(), $this->domain_service->user()))->getRichTextEditor() ===
"tinymce") {
332 $intro->setUseRte(
true);
333 $intro->setRteTagSet(
"mini");
347 $lng = $this->ui_service->lng();
352 $section = new \ilFormSectionHeaderGUI();
353 $section->setTitle(
$lng->txt(
'svy_settings_section_access'));
357 $start = $survey->getStartDate();
359 $startingtime = new \ilDateTimeInputGUI(
$lng->txt(
"start_date"),
'start_date');
360 $startingtime->setShowTime(
true);
367 $end = $survey->getEndDate();
369 $endingtime = new \ilDateTimeInputGUI(
$lng->txt(
"end_date"),
'end_date');
370 $endingtime->setShowTime(
true);
377 if ($feature_config->supportsAccessCodes()) {
378 $codes = new \ilCheckboxInputGUI(
$lng->txt(
"survey_access_codes"),
"acc_codes");
379 $codes->setInfo(
$lng->txt(
"survey_access_codes_info"));
380 $codes->setChecked(!$survey->isAccessibleWithoutCode());
384 $codes->setDisabled(
true);
398 $lng = $this->ui_service->lng();
402 $section = new \ilFormSectionHeaderGUI();
403 $section->setTitle(
$lng->txt(
'svy_settings_section_question_behaviour'));
407 $show_question_titles = new \ilCheckboxInputGUI(
$lng->txt(
"svy_show_questiontitles"),
"show_question_titles");
408 $show_question_titles->setValue(
"1");
409 $show_question_titles->setChecked($survey->getShowQuestionTitles());
410 $form->
addItem($show_question_titles);
423 $lng = $this->ui_service->lng();
425 $ctrl = $this->ui_service->ctrl();
426 $invitation_manager = $this->domain_service->participants()->invitations();
430 $info = new \ilFormSectionHeaderGUI();
431 $info->setTitle(
$lng->txt(
"svy_settings_section_finishing"));
434 $mail_confirm = new \ilCheckboxInputGUI(
$lng->txt(
"svy_results_mail_confirm"),
"mail_confirm");
435 $mail_confirm->setInfo(
$lng->txt(
"svy_results_mail_confirm_info"));
436 $mail_confirm->setChecked($survey->hasMailConfirmation());
439 $mail_own = new \ilCheckboxInputGUI(
$lng->txt(
"svy_results_mail_own"),
"mail_own");
440 $mail_own->setInfo(
$lng->txt(
"svy_results_mail_own_info"));
441 $mail_own->setChecked($survey->hasMailOwnResults());
442 $mail_confirm->addSubItem($mail_own);
445 $finalstatement = new \ilTextAreaInputGUI(
$lng->txt(
"outro"),
"outro");
446 $finalstatement->setValue($survey->prepareTextareaOutput($survey->getOutro()));
447 $finalstatement->setRows(10);
448 $finalstatement->setCols(80);
449 if ((
new \
ilRTESettings($this->domain_service->lng(), $this->domain_service->user()))->getRichTextEditor() ===
"tinymce") {
450 $finalstatement->setUseRte(
true);
451 $finalstatement->setRteTagSet(
"mini");
453 $form->
addItem($finalstatement);
456 $mailnotification = new \ilCheckboxInputGUI(
$lng->txt(
"mailnotification"),
"mailnotification");
458 $mailnotification->setInfo(
$lng->txt(
"svy_result_mail_notification_info"));
459 $mailnotification->setValue(
"1");
460 $mailnotification->setChecked($survey->getMailNotification());
463 $mailaddresses = new \ilTextInputGUI(
$lng->txt(
"survey_notification_tutor_recipients"),
"mailaddresses");
464 $mailaddresses->setValue($survey->getMailAddresses());
465 $mailaddresses->setSize(80);
466 $mailaddresses->setInfo(
$lng->txt(
'mailaddresses_info'));
467 $mailaddresses->setRequired(
true);
470 $participantdata = new \ilTextAreaInputGUI(
$lng->txt(
"mailparticipantdata"),
"mailparticipantdata");
471 $participantdata->setValue($survey->getMailParticipantData());
472 $participantdata->setRows(6);
473 $participantdata->setCols(80);
474 $participantdata->setUseRte(
false);
475 $participantdata->setInfo(
$lng->txt(
"mailparticipantdata_info"));
478 $placeholders = array(
479 "FIRST_NAME" =>
"firstname",
480 "LAST_NAME" =>
"lastname",
484 foreach ($placeholders as $placeholder => $caption) {
485 $txt[] =
"[" . strtoupper($placeholder) .
"]: " .
$lng->txt($caption);
488 $participantdatainfo = new \ilNonEditableValueGUI(
$lng->txt(
"svy_placeholders_label"),
"",
true);
489 $participantdatainfo->setValue(
$lng->txt(
"mailparticipantdata_placeholder") .
"<br />" .
$txt);
491 $mailnotification->addSubItem($mailaddresses);
492 $mailnotification->addSubItem($participantdata);
493 $mailnotification->addSubItem($participantdatainfo);
494 $form->
addItem($mailnotification);
497 if ($feature_config->supportsTutorNotification()) {
498 $num_inv = count($invitation_manager->getAllForSurvey($survey->getSurveyId()));
501 $tut = new \ilCheckboxInputGUI(
$lng->txt(
"survey_notification_tutor_setting"),
"tut");
502 $tut->setChecked($survey->getTutorNotificationStatus());
505 $tut_logins = array();
506 $tuts = $survey->getTutorNotificationRecipients();
508 foreach ($tuts as $tut_id) {
511 $tut_logins[] = $tmp[
"login"];
515 $tut_ids = new \ilTextInputGUI(
$lng->txt(
"survey_notification_tutor_recipients"),
"tut_ids");
516 $tut_ids->setDataSource($ctrl->getLinkTargetByClass($target_class,
"doAutoComplete",
"",
true));
517 $tut_ids->setRequired(
true);
518 $tut_ids->setMulti(
true);
519 $tut_ids->setMultiValues($tut_logins);
520 $tut_ids->setValue(array_shift($tut_logins));
521 $tut->addSubItem($tut_ids);
524 $tut_grp = new \ilRadioGroupInputGUI(
$lng->txt(
"survey_notification_target_group"),
"tut_grp");
525 $tut_grp->setRequired(
true);
526 $tut_grp->setValue((
string) $survey->getTutorNotificationTarget());
527 $tut->addSubItem($tut_grp);
530 $tut_grp_crs = new \ilRadioOption(
531 $lng->txt(
"survey_notification_target_group_parent_course"),
535 $tut_grp_crs->setInfo(
$lng->txt(
"survey_notification_target_group_parent_course_inactive"));
537 $tut_grp_crs->setInfo(sprintf(
538 $lng->txt(
"survey_notification_target_group_invited_info"),
539 count($survey->getNotificationTargetUserIds(
false))
542 $tut_grp->addOption($tut_grp_crs);
545 $tut_grp_inv = new \ilRadioOption(
546 $lng->txt(
"survey_notification_target_group_invited"),
549 $tut_grp_inv->setInfo(sprintf(
$lng->txt(
"survey_notification_target_group_invited_info"), $num_inv));
550 $tut_grp->addOption($tut_grp_inv);
594 $tree = $this->domain_service->repositoryTree();
595 $has_parent = $tree->checkForParentType($survey->getRefId(),
"grp");
597 $has_parent = $tree->checkForParentType($survey->getRefId(),
"crs");
599 return (
bool) $has_parent;
609 $lng = $this->ui_service->lng();
611 $invitation_manager = $this->domain_service->participants()->invitations();
615 $info = new \ilFormSectionHeaderGUI();
616 $info->setTitle(
$lng->txt(
"svy_settings_section_reminders"));
619 $rmd = new \ilCheckboxInputGUI(
$lng->txt(
"survey_reminder_setting"),
"rmd");
620 $rmd->setChecked($survey->getReminderStatus());
623 $rmd_start = new \ilDateTimeInputGUI(
$lng->txt(
"survey_reminder_start"),
"rmd_start");
624 $rmd_start->setRequired(
true);
625 $start = $survey->getReminderStart();
627 $rmd_start->setDate($start);
629 $rmd->addSubItem($rmd_start);
631 $end = $survey->getReminderEnd();
632 $rmd_end = new \ilDateTimeInputGUI(
$lng->txt(
"survey_reminder_end"),
"rmd_end");
634 $rmd_end->setDate($end);
636 $rmd->addSubItem($rmd_end);
638 $rmd_freq = new \ilNumberInputGUI(
$lng->txt(
"survey_reminder_frequency"),
"rmd_freq");
639 $rmd_freq->setRequired(
true);
640 $rmd_freq->setSize(3);
641 $rmd_freq->setSuffix(
$lng->txt(
"survey_reminder_frequency_days"));
642 $rmd_freq->setValue((
string) $survey->getReminderFrequency());
643 $rmd_freq->setMinValue(1);
644 $rmd->addSubItem($rmd_freq);
646 if ($feature_config->supportsMemberReminder()) {
647 $rmd_grp = new \ilRadioGroupInputGUI(
$lng->txt(
"survey_notification_target_group"),
"rmd_grp");
648 $rmd_grp->setRequired(
true);
649 $rmd_grp->setValue((
string) $survey->getReminderTarget());
650 $rmd->addSubItem($rmd_grp);
652 $rmd_grp_crs = new \ilRadioOption(
653 $lng->txt(
"survey_notification_target_group_parent_course"),
657 $rmd_grp_crs->setInfo(
$lng->txt(
"survey_notification_target_group_parent_course_inactive"));
659 $rmd_grp_crs->setInfo(sprintf(
660 $lng->txt(
"survey_notification_target_group_invited_info"),
661 count($survey->getNotificationTargetUserIds(
false))
664 $rmd_grp->addOption($rmd_grp_crs);
666 $rmd_grp_inv = new \ilRadioOption(
667 $lng->txt(
"survey_notification_target_group_invited"),
670 $num_inv = count($invitation_manager->getAllForSurvey($survey->getSurveyId()));
671 $rmd_grp_inv->setInfo(sprintf(
$lng->txt(
"survey_notification_target_group_invited_info"), $num_inv));
672 $rmd_grp->addOption($rmd_grp_inv);
674 $mtmpl = $survey->getReminderMailTemplates();
676 $rmdt = new \ilRadioGroupInputGUI(
$lng->txt(
"svy_reminder_mail_template"),
"rmdt");
677 $rmdt->setRequired(
true);
678 $rmdt->addOption(
new \
ilRadioOption(
$lng->txt(
"svy_reminder_mail_template_none"),
"-1"));
679 foreach ($mtmpl as $mtmpl_id => $mtmpl_caption) {
680 $option = new \ilRadioOption($mtmpl_caption, (
string) $mtmpl_id);
681 $rmdt->addOption($option);
684 $reminderTemplateValue = -1;
685 if ($survey->getReminderTemplate()) {
686 $reminderTemplateValue = $survey->getReminderTemplate();
688 $rmdt->setValue((
string) $reminderTemplateValue);
689 $rmd->addSubItem($rmdt);
693 foreach ($this->modifier->getSurveySettingsReminderTargets(
697 $rmd->addSubItem($item);
709 $lng = $this->ui_service->lng();
715 $results = new \ilFormSectionHeaderGUI();
719 if ($feature_config->supportsSumScore()) {
721 $sum_score = new \ilCheckboxInputGUI(
$lng->txt(
"survey_calculate_sum_score"),
"calculate_sum_score");
722 $sum_score->setInfo(
$lng->txt(
"survey_calculate_sum_score_info"));
723 $sum_score->setValue(
"1");
724 $sum_score->setChecked($survey->getCalculateSumScore());
728 foreach ($this->modifier->getSurveySettingsResults(
744 $lng = $this->ui_service->lng();
752 $skmg_set = new \ilSkillManagementSettings();
754 if ($feature_config->supportsCompetences() && $skmg_set->isActivated()) {
755 $skill_service = new \ilCheckboxInputGUI(
$lng->txt(
"survey_activate_skill_service"),
"skill_service");
756 $skill_service->setInfo(
$lng->txt(
"survey_activate_skill_service_info"));
757 $skill_service->setChecked($survey->getSkillService());
758 $other_items[] = $skill_service;
762 ->getObjectPositionSettingsByType($survey->getType());
764 if (count($other_items) > 0 ||
765 $position_settings->isActive()
767 $feat = new \ilFormSectionHeaderGUI();
768 $feat->setTitle(
$lng->txt(
'obj_features'));
771 foreach ($other_items as $item) {
776 if ($position_settings->isActive()) {
796 $lng = $this->ui_service->lng();
803 $rmd_start = $rmd_end;
806 $survey->setReminderStatus(
true);
807 $survey->setReminderStart($rmd_start);
808 $survey->setReminderEnd($rmd_end);
809 $survey->setReminderFrequency((
int) $form->
getInput(
"rmd_freq"));
810 if ($feature_config->supportsMemberReminder()) {
811 $survey->setReminderTarget((
int) $form->
getInput(
"rmd_grp"));
812 $survey->setReminderTemplate(($form->
getInput(
"rmdt") > 0)
817 $survey->setReminderStatus(
false);
820 if ($feature_config->supportsTutorNotification()) {
824 $survey->setTutorNotificationStatus(
true);
825 $survey->setTutorNotificationRecipients($tut_ids);
826 $survey->setTutorNotificationTarget((
int) $form->
getInput(
"tut_grp"));
828 $survey->setTutorNotificationStatus(
false);
842 if ($form->
getInput(
'online') && count($survey->questions) === 0) {
843 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->txt(
"cannot_switch_to_online_no_questions"),
true);
845 $survey->setOfflineStatus(!$form->
getInput(
'online'));
848 $survey->setMailOwnResults((
bool) $form->
getInput(
"mail_own"));
849 $survey->setMailConfirmation((
bool) $form->
getInput(
"mail_confirm"));
852 $survey->setTitle($form->
getInput(
'title'));
853 $survey->setDescription($form->
getInput(
'description'));
858 $tb = $form->
getInput(
"time_based_avail");
859 if ($tb && $period->getStart() && $period->getEnd()) {
860 $survey->setActivationLimited(
true);
861 $survey->setActivationVisibility((
bool) $form->
getInput(
"access_visiblity"));
862 $survey->setActivationStartDate($period->getStart()->get(
IL_CAL_UNIX));
863 $survey->setActivationEndDate($period->getEnd()->get(
IL_CAL_UNIX));
865 $survey->setActivationLimited(
false);
869 $obj_service->commonSettings()->legacyForm($form, $survey)->saveTileImage();
872 if ($start->getDate()) {
876 $survey->setStartDate(
"");
880 if ($end->getDate()) {
884 $survey->setEndDate(
"");
886 $survey->setIntroduction($form->
getInput(
"introduction"));
887 $survey->setOutro($form->
getInput(
"outro"));
888 $survey->setShowQuestionTitles((
bool) $form->
getInput(
"show_question_titles"));
891 $survey->setMailNotification((
bool) $form->
getInput(
'mailnotification'));
892 $survey->setMailAddresses($form->
getInput(
'mailaddresses'));
893 $survey->setMailParticipantData($form->
getInput(
'mailparticipantdata'));
895 if ($feature_config->usesAppraisees()) {
896 $survey->set360SelfAppraisee((
bool) $form->
getInput(
"self_appr"));
897 $survey->set360SelfRaters((
bool) $form->
getInput(
"self_rate"));
900 if ($feature_config->supportsCompetences()) {
901 $survey->setSkillService((
bool) $form->
getInput(
"skill_service"));
904 foreach ($this->modifier->getSurveySettingsResults(
908 $this->modifier->setValuesFromForm($survey, $form);
This class represents an option in a radio group.
static _hasDatasets(int $survey_id)
Survey internal ui service.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupName(int $a_user_id)
lookup user name
static _lookupId($a_user_str)
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const NOTIFICATION_PARENT_COURSE
const NOTIFICATION_INVITED_USERS
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const ORGU_POSITION_ACCESS