ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilUserProfileInfoSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "./Services/Object/classes/class.ilObjectGUI.php";
6 
17 {
21  protected $ctrl;
22 
26  protected $tpl;
27 
31  protected $lng;
32 
36  public function __construct()
37  {
38  global $DIC;
39 
40  $this->ctrl = $DIC->ctrl();
41  $this->tpl = $DIC["tpl"];
42  $this->lng = $DIC->language();
43  }
44 
45 
49  public function executeCommand()
50  {
51  $next_class = $this->ctrl->getNextClass($this);
52  $cmd = $this->ctrl->getCmd("show");
53 
54  switch ($next_class) {
55  default:
56  if (in_array($cmd, array("show", "save"))) {
57  $this->$cmd();
58  }
59  }
60  }
61 
65  public function show()
66  {
67  $tpl = $this->tpl;
68 
69  $form = $this->initForm();
70  $tpl->setContent($form->getHTML());
71  }
72 
77  public function initForm()
78  {
79  $lng = $this->lng;
81 
82  $lng->loadLanguageModule("meta");
83 
84  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
85  $form = new ilPropertyFormGUI();
86 
87  $setting = new ilSetting("user");
88 
89  $first = true;
90  foreach ($lng->getInstalledLanguages() as $l) {
91  // info text
92  include_once("Services/Form/classes/class.ilTextAreaInputGUI.php");
93  $ti = new ilTextAreaInputGUI($lng->txt("meta_l_" . $l), "user_profile_info_text_" . $l);
94  $ti->setRows(7);
95  if ($first) {
96  $ti->setInfo($lng->txt("user_profile_info_text_info"));
97  }
98  $first = false;
99  $ti->setValue($setting->get("user_profile_info_" . $l));
100  $form->addItem($ti);
101  }
102 
103  $form->addCommandButton("save", $lng->txt("save"));
104 
105  $form->setTitle($lng->txt("user_profile_info"));
106  $form->setFormAction($ctrl->getFormAction($this));
107 
108  return $form;
109  }
110 
114  public function save()
115  {
116  $lng = $this->lng;
117  $ctrl = $this->ctrl;
118  $tpl = $this->tpl;
119 
120  $form = $this->initForm();
121  if ($form->checkInput()) {
122  $setting = new ilSetting("user");
123  foreach ($lng->getInstalledLanguages() as $l) {
124  $setting->set("user_profile_info_" . $l, $form->getInput("user_profile_info_text_" . $l));
125  }
126 
127  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
128  $ctrl->redirect($this, "show");
129  } else {
130  $form->setValuesByPost();
131  $tpl->setContent($form->getHtml());
132  }
133  }
134 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
User profile info settings UI class.
if(isset($_POST['submit'])) $form
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
This class represents a text area property in a property form.