ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilUserProfileInfoSettingsGUI Class Reference

User profile info settings UI class. More...

+ Collaboration diagram for ilUserProfileInfoSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 show ()
 Show settings. More...
 
 initForm ()
 Init form. More...
 
 save ()
 Save. More...
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $user_prompt
 
 $prompt_settings
 

Detailed Description

User profile info settings UI class.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

ilUserProfileInfoSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilUserProfileInfoSettingsGUI::__construct ( )

Constructor.

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

References $DIC.

47  {
48  global $DIC;
49 
50  $this->ctrl = $DIC->ctrl();
51  $this->tpl = $DIC["tpl"];
52  $this->lng = $DIC->language();
53  $this->user_prompt = new ilUserProfilePromptService();
54  $this->prompt_settings = $this->user_prompt->data()->getSettings();
55  }
User profile prompt subservice.
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ executeCommand()

ilUserProfileInfoSettingsGUI::executeCommand ( )

Execute command.

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

62  {
63  $next_class = $this->ctrl->getNextClass($this);
64  $cmd = $this->ctrl->getCmd("show");
65 
66  switch ($next_class) {
67  default:
68  if (in_array($cmd, array("show", "save"))) {
69  $this->$cmd();
70  }
71  }
72  }

◆ initForm()

ilUserProfileInfoSettingsGUI::initForm ( )

Init form.

Returns
ilPropertyFormGUI

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

References $ctrl, $form, $l, $lng, $prompt_settings, ilProfilePromptSettings\MODE_INCOMPLETE_ONLY, ilProfilePromptSettings\MODE_ONCE_AFTER_LOGIN, ilProfilePromptSettings\MODE_REPEAT, ilNumberInputGUI\setMaxLength(), ilTextAreaInputGUI\setRows(), and ilRadioGroupInputGUI\setValue().

Referenced by save(), and show().

90  {
91  $lng = $this->lng;
94 
95  $lng->loadLanguageModule("meta");
96 
97  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
98  $form = new ilPropertyFormGUI();
99 
100  // default info text
101  $first = true;
102  foreach ($lng->getInstalledLanguages() as $l) {
103  // info text
104  include_once("Services/Form/classes/class.ilTextAreaInputGUI.php");
105  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_info_text_" . $l);
106  $ti->setRows(7);
107  if ($first) {
108  $ti->setInfo($lng->txt("user_profile_info_text_info"));
109  }
110  $first = false;
111  $ti->setValue($prompt_settings->getInfoText($l));
112  $form->addItem($ti);
113  }
114 
115  // prompting settings
116  $sec = new ilFormSectionHeaderGUI();
117  $sec->setTitle($lng->txt('user_prompting_settings'));
118  $form->addItem($sec);
119 
120  // prompt mode
121  $radg = new ilRadioGroupInputGUI($lng->txt("user_prompting_recurrence"), "prompt_mode");
122  $radg->setValue($prompt_settings->getMode());
123 
124  // ... only if incomplete
125  $op1 = new ilRadioOption(
126  $lng->txt("user_prompt_incomplete"),
128  $lng->txt("user_prompt_incomplete_info")
129  );
130  $radg->addOption($op1);
131 
132  // ... once after login
133  $op2 = new ilRadioOption(
134  $lng->txt("user_prompt_once_after_login"),
136  $lng->txt("user_prompt_once_after_login_info")
137  );
138  $radg->addOption($op2);
139 
140  // days after login
141  $ti = new ilNumberInputGUI($lng->txt("days"), "days_after_login");
142  $ti->setMaxLength(4);
143  $ti->setSize(4);
144  $ti->setValue($prompt_settings->getDays());
145  $op2->addSubItem($ti);
146 
147  // ... repeatly
148  $op3 = new ilRadioOption(
149  $lng->txt("user_prompt_repeat"),
151  $lng->txt("user_prompt_repeat_info")
152  );
153  $radg->addOption($op3);
154 
155  // repeat all x days
156  $ti = new ilNumberInputGUI($lng->txt("days"), "days_repeat");
157  $ti->setMaxLength(4);
158  $ti->setSize(4);
159  $ti->setValue($prompt_settings->getDays());
160  $op3->addSubItem($ti);
161 
162  $form->addItem($radg);
163 
164 
165  // prompting info text
166  $first = true;
167  foreach ($lng->getInstalledLanguages() as $l) {
168  // info text
169  include_once("Services/Form/classes/class.ilTextAreaInputGUI.php");
170  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_prompt_text_" . $l);
171  $ti->setRows(7);
172  if ($first) {
173  $ti->setInfo($lng->txt("user_profile_prompt_text_info"));
174  }
175  $first = false;
176  $ti->setValue($prompt_settings->getPromptText($l));
177  $form->addItem($ti);
178  }
179 
180  $form->addCommandButton("save", $lng->txt("save"));
181 
182  $form->setTitle($lng->txt("user_profile_info_std"));
183  $form->setFormAction($ctrl->getFormAction($this));
184 
185  return $form;
186  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
global $l
Definition: afr.php:30
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilUserProfileInfoSettingsGUI::save ( )

Save.

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

References $ctrl, $form, $l, $lng, $tpl, initForm(), and ilProfilePromptSettings\MODE_ONCE_AFTER_LOGIN.

192  {
193  $lng = $this->lng;
194  $ctrl = $this->ctrl;
195  $tpl = $this->tpl;
196 
197  $form = $this->initForm();
198  if ($form->checkInput()) {
199  $days = ($form->getInput("prompt_mode") == ilProfilePromptSettings::MODE_ONCE_AFTER_LOGIN)
200  ? $form->getInput("days_after_login")
201  : $form->getInput("days_repeat");
202  $info_text = $prompt_text = [];
203  foreach ($lng->getInstalledLanguages() as $l) {
204  $info_text[$l] = $form->getInput("user_profile_info_text_" . $l);
205  $prompt_text[$l] = $form->getInput("user_profile_prompt_text_" . $l);
206  }
207  $this->user_prompt->data()->saveSettings($this->user_prompt->settings(
208  $form->getInput("prompt_mode"),
209  $days,
210  $info_text,
211  $prompt_text
212  ));
213  /*$setting = new ilSetting("user");
214  foreach ($lng->getInstalledLanguages() as $l)
215  {
216  $setting->set("user_profile_info_".$l, $form->getInput("user_profile_info_text_".$l));
217  }*/
218 
219  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
220  $ctrl->redirect($this, "show");
221  } else {
222  $form->setValuesByPost();
223  $tpl->setContent($form->getHtml());
224  }
225  }
if(isset($_POST['submit'])) $form
global $l
Definition: afr.php:30
+ Here is the call graph for this function:

◆ show()

ilUserProfileInfoSettingsGUI::show ( )

Show settings.

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

References $form, $tpl, and initForm().

78  {
79  $tpl = $this->tpl;
80 
81  $form = $this->initForm();
82  $tpl->setContent($form->getHTML());
83  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilUserProfileInfoSettingsGUI::$ctrl
protected

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

Referenced by initForm(), and save().

◆ $lng

ilUserProfileInfoSettingsGUI::$lng
protected

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

Referenced by initForm(), and save().

◆ $prompt_settings

ilUserProfileInfoSettingsGUI::$prompt_settings
protected

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

Referenced by initForm().

◆ $tpl

ilUserProfileInfoSettingsGUI::$tpl
protected

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

Referenced by save(), and show().

◆ $user_prompt

ilUserProfileInfoSettingsGUI::$user_prompt
protected

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


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