ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.UIModifier.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
31{
32 public function getSurveySettingsResults(
33 \ilObjSurvey $survey,
34 InternalGUIService $ui_service
35 ): array {
36 $items = [];
37 $lng = $ui_service->lng();
38 $anon_list = null;
39
40 $evaluation_access = new \ilRadioGroupInputGUI($lng->txt('evaluation_access'), "evaluation_access");
41
42 $option = new \ilCheckboxOption($lng->txt("evaluation_access_off"), \ilObjSurvey::EVALUATION_ACCESS_OFF, '');
43 $option->setInfo($lng->txt("svy_evaluation_access_off_info"));
44 $evaluation_access->addOption($option);
45
46 $option = new \ilCheckboxOption($lng->txt("evaluation_access_all"), \ilObjSurvey::EVALUATION_ACCESS_ALL, '');
47 $option->setInfo($lng->txt("svy_evaluation_access_all_info"));
48 $evaluation_access->addOption($option);
49
50 $option = new \ilCheckboxOption($lng->txt("evaluation_access_participants"), \ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
51 $option->setInfo($lng->txt("svy_evaluation_access_participants_info"));
52 $evaluation_access->addOption($option);
53
54 $evaluation_access->setValue($survey->getEvaluationAccess());
55 $items[] = $evaluation_access;
56
57 $anonymization_options = new \ilRadioGroupInputGUI($lng->txt("survey_results_anonymization"), "anonymization_options");
58
59 $option = new \ilCheckboxOption($lng->txt("survey_results_personalized"), "statpers");
60 $option->setInfo($lng->txt("survey_results_personalized_info"));
61 $anonymization_options->addOption($option);
62
63 $option = new \ilCheckboxOption($lng->txt("survey_results_anonymized"), "statanon");
64 $option->setInfo($lng->txt("survey_results_anonymized_info"));
65 $anonymization_options->addOption($option);
66 $anonymization_options->setValue($survey->hasAnonymizedResults()
67 ? "statanon"
68 : "statpers");
69 $items[] = $anonymization_options;
70
71 $surveySetting = new \ilSetting("survey");
72 if ($surveySetting->get("anonymous_participants", null)) {
73 $min = "";
74 if ((int) $surveySetting->get("anonymous_participants_min", "0") > 0) {
75 $min = " (" . $lng->txt("svy_anonymous_participants_min") . ": " .
76 $surveySetting->get("anonymous_participants_min") . ")";
77 }
78
79 $anon_list = new \ilCheckboxInputGUI($lng->txt("svy_anonymous_participants_svy"), "anon_list");
80 $anon_list->setInfo($lng->txt("svy_anonymous_participants_svy_info") . $min);
81 $anon_list->setChecked($survey->hasAnonymousUserList());
82 $option->addSubItem($anon_list);
83 }
84
85 if ($survey->_hasDatasets($survey->getSurveyId())) {
86 $anonymization_options->setDisabled(true);
87 if ($anon_list) {
88 $anon_list->setDisabled(true);
89 }
90 }
91
92 return $items;
93 }
94
95 public function setValuesFromForm(
96 \ilObjSurvey $survey,
98 ): void {
99 $survey->setEvaluationAccess($form->getInput("evaluation_access"));
100 $survey->setCalculateSumScore((bool) $form->getInput("calculate_sum_score"));
101 $hasDatasets = \ilObjSurvey::_hasDatasets($survey->getSurveyId());
102 if (!$hasDatasets) {
103 $current = $survey->getAnonymize();
104
105 // get current setting if property is hidden
106 $codes = (bool) $form->getInput("acc_codes");
107 $anon = ((string) $form->getInput("anonymization_options") === "statanon");
108
109 // parse incoming values
110 if (!$anon) {
111 if (!$codes) {
113 } else {
115 }
116 } else {
117 if ($codes) {
119 } else {
121 }
122
123 $survey->setAnonymousUserList((bool) $form->getInput("anon_list"));
124 }
125 }
126 }
127}
getSurveySettingsResults(\ilObjSurvey $survey, InternalGUIService $ui_service)
setValuesFromForm(\ilObjSurvey $survey, \ilPropertyFormGUI $form)
const EVALUATION_ACCESS_PARTICIPANTS
setAnonymousUserList(bool $a_value)
const EVALUATION_ACCESS_ALL
const ANONYMIZE_FREEACCESS
static _hasDatasets(int $survey_id)
const EVALUATION_ACCESS_OFF
setCalculateSumScore(bool $a_val)
const ANONYMIZE_CODE_ALL
setAnonymize(int $a_anonymize)
set anonymize status
This class represents a property form user interface.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
global $lng
Definition: privfeed.php:31