ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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: goto.php:24

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, $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->setRequired(true);
160  $ti->setMinValue(1);
161  $ti->setValue($prompt_settings->getDays());
162  $op3->addSubItem($ti);
163 
164  $form->addItem($radg);
165 
166 
167  // prompting info text
168  $first = true;
169  foreach ($lng->getInstalledLanguages() as $l) {
170  // info text
171  include_once("Services/Form/classes/class.ilTextAreaInputGUI.php");
172  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_prompt_text_" . $l);
173  $ti->setRows(7);
174  if ($first) {
175  $ti->setInfo($lng->txt("user_profile_prompt_text_info"));
176  }
177  $first = false;
178  $ti->setValue($prompt_settings->getPromptText($l));
179  $form->addItem($ti);
180  }
181 
182  $form->addCommandButton("save", $lng->txt("save"));
183 
184  $form->setTitle($lng->txt("user_profile_info_std"));
185  $form->setFormAction($ctrl->getFormAction($this));
186 
187  return $form;
188  }
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.
This class represents a number property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
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 193 of file class.ilUserProfileInfoSettingsGUI.php.

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

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

◆ show()

ilUserProfileInfoSettingsGUI::show ( )

Show settings.

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

References $tpl, and initForm().

78  {
79  $tpl = $this->tpl;
80 
81  $form = $this->initForm();
82  $tpl->setContent($form->getHTML());
83  }
+ 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: