ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserProfileInfoSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilUserProfileInfoSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 show ()
 
 initForm ()
 
 save ()
 

Protected Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilUserProfilePromptService $user_prompt
 
ilProfilePromptSettings $prompt_settings
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning User profile info settings UI class

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilUserProfileInfoSettingsGUI:

Definition at line 24 of file class.ilUserProfileInfoSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserProfileInfoSettingsGUI::__construct ( )

Definition at line 32 of file class.ilUserProfileInfoSettingsGUI.php.

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

33  {
34  global $DIC;
35 
36  $this->ctrl = $DIC->ctrl();
37  $this->tpl = $DIC["tpl"];
38  $this->lng = $DIC->language();
39  $this->user_prompt = new ilUserProfilePromptService();
40  $this->prompt_settings = $this->user_prompt->data()->getSettings();
41  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilUserProfileInfoSettingsGUI::executeCommand ( )

Definition at line 43 of file class.ilUserProfileInfoSettingsGUI.php.

References ILIAS\Repository\ctrl().

43  : void
44  {
45  $next_class = $this->ctrl->getNextClass($this);
46  $cmd = $this->ctrl->getCmd("show");
47 
48  switch ($next_class) {
49  default:
50  if (in_array($cmd, array("show", "save"))) {
51  $this->$cmd();
52  }
53  }
54  }
+ Here is the call graph for this function:

◆ initForm()

ilUserProfileInfoSettingsGUI::initForm ( )

Definition at line 64 of file class.ilUserProfileInfoSettingsGUI.php.

References $ctrl, $lng, $prompt_settings, ilProfilePromptSettings\getDays(), ilCtrl\getFormAction(), ilProfilePromptSettings\getInfoText(), ilLanguage\getInstalledLanguages(), ilProfilePromptSettings\getMode(), ilProfilePromptSettings\getPromptText(), ilLanguage\loadLanguageModule(), ilProfilePromptSettings\MODE_INCOMPLETE_ONLY, ilProfilePromptSettings\MODE_ONCE_AFTER_LOGIN, ilProfilePromptSettings\MODE_REPEAT, ilNumberInputGUI\setMaxLength(), ilTextAreaInputGUI\setRows(), ilRadioGroupInputGUI\setValue(), and ilLanguage\txt().

Referenced by save(), and show().

65  {
66  $lng = $this->lng;
69 
70  $lng->loadLanguageModule("meta");
71 
72  $form = new ilPropertyFormGUI();
73 
74  // default info text
75  $first = true;
76  foreach ($lng->getInstalledLanguages() as $l) {
77  // info text
78  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_info_text_" . $l);
79  $ti->setRows(7);
80  if ($first) {
81  $ti->setInfo($lng->txt("user_profile_info_text_info"));
82  }
83  $first = false;
84  $ti->setValue($prompt_settings->getInfoText($l));
85  $form->addItem($ti);
86  }
87 
88  // prompting settings
89  $sec = new ilFormSectionHeaderGUI();
90  $sec->setTitle($lng->txt('user_prompting_settings'));
91  $form->addItem($sec);
92 
93  // prompt mode
94  $radg = new ilRadioGroupInputGUI($lng->txt("user_prompting_recurrence"), "prompt_mode");
96 
97  // ... only if incomplete
98  $op1 = new ilRadioOption(
99  $lng->txt("user_prompt_incomplete"),
101  $lng->txt("user_prompt_incomplete_info")
102  );
103  $radg->addOption($op1);
104 
105  // ... once after login
106  $op2 = new ilRadioOption(
107  $lng->txt("user_prompt_once_after_login"),
109  $lng->txt("user_prompt_once_after_login_info")
110  );
111  $radg->addOption($op2);
112 
113  // days after login
114  $ti = new ilNumberInputGUI($lng->txt("days"), "days_after_login");
115  $ti->setMaxLength(4);
116  $ti->setSize(4);
117  $ti->setValue($prompt_settings->getDays());
118  $op2->addSubItem($ti);
119 
120  // ... repeatly
121  $op3 = new ilRadioOption(
122  $lng->txt("user_prompt_repeat"),
124  $lng->txt("user_prompt_repeat_info")
125  );
126  $radg->addOption($op3);
127 
128  // repeat all x days
129  $ti = new ilNumberInputGUI($lng->txt("days"), "days_repeat");
130  $ti->setMaxLength(4);
131  $ti->setSize(4);
132  $ti->setRequired(true);
133  $ti->setMinValue(1);
134  $ti->setValue($prompt_settings->getDays());
135  $op3->addSubItem($ti);
136 
137  $form->addItem($radg);
138 
139 
140  // prompting info text
141  $first = true;
142  foreach ($lng->getInstalledLanguages() as $l) {
143  // info text
144  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_prompt_text_" . $l);
145  $ti->setRows(7);
146  if ($first) {
147  $ti->setInfo($lng->txt("user_profile_prompt_text_info"));
148  }
149  $first = false;
150  $ti->setValue($prompt_settings->getPromptText($l));
151  $form->addItem($ti);
152  }
153 
154  $form->addCommandButton("save", $lng->txt("save"));
155 
156  $form->setTitle($lng->txt("user_profile_info_std"));
157  $form->setFormAction($ctrl->getFormAction($this));
158 
159  return $form;
160  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setMaxLength(int $a_maxlength)
loadLanguageModule(string $a_module)
Load language module.
This class represents a property in a property form.
This class represents a number property in a property form.
getInstalledLanguages()
Get installed languages.
This class represents a text area property in a property form.
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilUserProfileInfoSettingsGUI::save ( )

Definition at line 162 of file class.ilUserProfileInfoSettingsGUI.php.

References $ctrl, $lng, $tpl, ilLanguage\getInstalledLanguages(), initForm(), ILIAS\Repository\int(), ilProfilePromptSettings\MODE_ONCE_AFTER_LOGIN, ilCtrl\redirect(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

162  : void
163  {
164  $lng = $this->lng;
165  $ctrl = $this->ctrl;
166  $tpl = $this->tpl;
167 
168  $form = $this->initForm();
169  if ($form->checkInput()) {
170  $days = ($form->getInput("prompt_mode") == ilProfilePromptSettings::MODE_ONCE_AFTER_LOGIN)
171  ? $form->getInput("days_after_login")
172  : $form->getInput("days_repeat");
173  $info_text = $prompt_text = [];
174  foreach ($lng->getInstalledLanguages() as $l) {
175  $info_text[$l] = $form->getInput("user_profile_info_text_" . $l);
176  $prompt_text[$l] = $form->getInput("user_profile_prompt_text_" . $l);
177  }
178  $this->user_prompt->data()->saveSettings($this->user_prompt->settings(
179  (int) $form->getInput("prompt_mode"),
180  (int) $days,
181  $info_text,
182  $prompt_text
183  ));
184  /*$setting = new ilSetting("user");
185  foreach ($lng->getInstalledLanguages() as $l)
186  {
187  $setting->set("user_profile_info_".$l, $form->getInput("user_profile_info_text_".$l));
188  }*/
189 
190  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
191  $ctrl->redirect($this, "show");
192  } else {
193  $form->setValuesByPost();
194  $tpl->setContent($form->getHTML());
195  }
196  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
setContent(string $a_html)
Sets content for standard template.
getInstalledLanguages()
Get installed languages.
+ Here is the call graph for this function:

◆ show()

ilUserProfileInfoSettingsGUI::show ( )

Definition at line 56 of file class.ilUserProfileInfoSettingsGUI.php.

References $tpl, initForm(), and ilGlobalTemplateInterface\setContent().

56  : void
57  {
58  $tpl = $this->tpl;
59 
60  $form = $this->initForm();
61  $tpl->setContent($form->getHTML());
62  }
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilUserProfileInfoSettingsGUI::$ctrl
protected

Definition at line 26 of file class.ilUserProfileInfoSettingsGUI.php.

Referenced by initForm(), and save().

◆ $lng

ilLanguage ilUserProfileInfoSettingsGUI::$lng
protected

Definition at line 28 of file class.ilUserProfileInfoSettingsGUI.php.

Referenced by initForm(), and save().

◆ $prompt_settings

ilProfilePromptSettings ilUserProfileInfoSettingsGUI::$prompt_settings
protected

Definition at line 30 of file class.ilUserProfileInfoSettingsGUI.php.

Referenced by initForm().

◆ $tpl

ilGlobalTemplateInterface ilUserProfileInfoSettingsGUI::$tpl
protected

Definition at line 27 of file class.ilUserProfileInfoSettingsGUI.php.

Referenced by save(), and show().

◆ $user_prompt

ilUserProfilePromptService ilUserProfileInfoSettingsGUI::$user_prompt
protected

Definition at line 29 of file class.ilUserProfileInfoSettingsGUI.php.


The documentation for this class was generated from the following file: