ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPersonalChatSettingsFormGUI Class Reference

Class ilPersonalChatSettingsFormGUI ilPersonalChatSettingsFormGUI: ilPersonalSettingsGUI. More...

+ Inheritance diagram for ilPersonalChatSettingsFormGUI:
+ Collaboration diagram for ilPersonalChatSettingsFormGUI:

Public Member Functions

 __construct ($init_form=true)
 ilPersonalChatSettingsFormGUI constructor. More...
 
 executeCommand ()
 {} More...
 
 isAccessible ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Protected Member Functions

 shouldShowNotificationOptions ()
 
 shouldShowOnScreenChatOptions ()
 
 initForm ()
 
 showChatOptions ()
 
 saveChatOptions ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $lng
 
 $ctrl
 
 $user
 
 $mainTpl
 
 $settings
 
 $chatSettings = array()
 
 $notificationSettings = array()
 
 $event
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPersonalChatSettingsFormGUI::__construct (   $init_form = true)

ilPersonalChatSettingsFormGUI constructor.

Parameters
bool$init_form

Definition at line 55 of file class.ilPersonalChatSettingsFormGUI.php.

References $DIC, initForm(), settings(), and user().

56  {
57  global $DIC;
58 
59  parent::__construct();
60 
61  $this->user = $DIC->user();
62  $this->ctrl = $DIC->ctrl();
63  $this->settings = $DIC['ilSetting'];
64  $this->mainTpl = $DIC['tpl'];
65  $this->lng = $DIC['lng'];
66  $this->event = $DIC->event();
67 
68  $this->chatSettings = new ilSetting('chatroom');
69  $this->notificationSettings = new ilSetting('notifications');
70 
71  if ($init_form) {
72  $this->initForm();
73  }
74  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPersonalChatSettingsFormGUI::executeCommand ( )

{}

Definition at line 79 of file class.ilPersonalChatSettingsFormGUI.php.

References saveChatOptions(), and showChatOptions().

80  {
81  switch ($this->ctrl->getCmd()) {
82  case 'saveChatOptions':
83  $this->saveChatOptions();
84  break;
85 
86  case 'showChatOptions':
87  default:
88  $this->showChatOptions();
89  break;
90  }
91  }
+ Here is the call graph for this function:

◆ initForm()

ilPersonalChatSettingsFormGUI::initForm ( )
protected

Definition at line 127 of file class.ilPersonalChatSettingsFormGUI.php.

References ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilFormGUI\setFormAction(), ilFormPropertyGUI\setInfo(), settings(), ilPropertyFormGUI\setTitle(), shouldShowNotificationOptions(), and shouldShowOnScreenChatOptions().

Referenced by __construct().

128  {
129  $this->lng->loadLanguageModule('chatroom');
130 
131  $this->setFormAction($this->ctrl->getFormAction($this, 'saveChatOptions'));
132  $this->setTitle($this->lng->txt("chat_settings"));
133 
134  if ($this->shouldShowNotificationOptions()) {
135  $chb = new ilCheckboxInputGUI($this->lng->txt('play_invitation_sound'), 'play_invitation_sound');
136  $chb->setInfo($this->lng->txt('play_invitation_sound_info'));
137  $this->addItem($chb);
138  }
139 
140  if ($this->shouldShowOnScreenChatOptions()) {
141  $chb = new ilCheckboxInputGUI($this->lng->txt('chat_osc_accept_msg'), 'chat_osc_accept_msg');
142  $chb->setInfo($this->lng->txt('chat_osc_accept_msg_info'));
143  $chb->setDisabled((bool) $this->settings->get('usr_settings_disable_chat_osc_accept_msg', false));
144  $this->addItem($chb);
145  }
146 
147  $this->addCommandButton('saveChatOptions', $this->lng->txt('save'));
148  }
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
setTitle($a_title)
Set Title.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAccessible()

ilPersonalChatSettingsFormGUI::isAccessible ( )
Returns
bool

Definition at line 96 of file class.ilPersonalChatSettingsFormGUI.php.

References shouldShowNotificationOptions(), and shouldShowOnScreenChatOptions().

Referenced by saveChatOptions(), and showChatOptions().

97  {
98  return (
99  $this->chatSettings->get('chat_enabled', false) && (
101  )
102  );
103  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveChatOptions()

ilPersonalChatSettingsFormGUI::saveChatOptions ( )
protected

Definition at line 171 of file class.ilPersonalChatSettingsFormGUI.php.

References ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), isAccessible(), ilUtil\sendSuccess(), settings(), shouldShowNotificationOptions(), shouldShowOnScreenChatOptions(), showChatOptions(), ilUtil\tf2yn(), and user().

Referenced by executeCommand().

172  {
173  if (!$this->isAccessible()) {
174  $this->ctrl->returnToParent($this);
175  }
176 
177  if (!$this->checkInput()) {
178  $this->showChatOptions();
179  return;
180  }
181 
182  if ($this->shouldShowNotificationOptions()) {
183  $this->user->setPref('chat_play_invitation_sound', (int) $this->getInput('play_invitation_sound'));
184  }
185 
186  if ($this->shouldShowOnScreenChatOptions() && !(bool) $this->settings->get('usr_settings_disable_chat_osc_accept_msg', false)) {
187  $this->user->setPref('chat_osc_accept_msg', ilUtil::tf2yn((bool) $this->getInput('chat_osc_accept_msg')));
188  }
189 
190  $this->user->writePrefs();
191 
192  $this->event->raise(
193  'Modules/Chatroom',
194  'chatSettingsChanged',
195  [
196  'user' => $this->user
197  ]
198  );
199 
200  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
201  $this->showChatOptions();
202  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static tf2yn($a_tf)
convert true/false to "y"/"n"
user()
Definition: user.php:4
checkInput()
Check Post Input.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldShowNotificationOptions()

ilPersonalChatSettingsFormGUI::shouldShowNotificationOptions ( )
protected
Returns
bool

Definition at line 108 of file class.ilPersonalChatSettingsFormGUI.php.

Referenced by initForm(), isAccessible(), and saveChatOptions().

109  {
110  return $this->notificationSettings->get('enable_osd', false) && $this->chatSettings->get('play_invitation_sound', false);
111  }
+ Here is the caller graph for this function:

◆ shouldShowOnScreenChatOptions()

ilPersonalChatSettingsFormGUI::shouldShowOnScreenChatOptions ( )
protected
Returns
bool

Definition at line 116 of file class.ilPersonalChatSettingsFormGUI.php.

References settings().

Referenced by initForm(), isAccessible(), and saveChatOptions().

117  {
118  return (
119  $this->chatSettings->get('enable_osc', false) &&
120  !(bool) $this->settings->get('usr_settings_hide_chat_osc_accept_msg', false)
121  );
122  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showChatOptions()

ilPersonalChatSettingsFormGUI::showChatOptions ( )
protected

Definition at line 153 of file class.ilPersonalChatSettingsFormGUI.php.

References array, ilPropertyFormGUI\getHTML(), isAccessible(), ilPropertyFormGUI\setValuesByArray(), user(), and ilUtil\yn2tf().

Referenced by executeCommand(), and saveChatOptions().

154  {
155  if (!$this->isAccessible()) {
156  $this->ctrl->returnToParent($this);
157  }
158 
159  $this->setValuesByArray(array(
160  'play_invitation_sound' => $this->user->getPref('chat_play_invitation_sound'),
161  'chat_osc_accept_msg' => ilUtil::yn2tf($this->user->getPref('chat_osc_accept_msg'))
162  ));
163 
164  $this->mainTpl->setContent($this->getHTML());
165  $this->mainTpl->show();
166  }
user()
Definition: user.php:4
Create styles array
The data for the language used.
static yn2tf($a_yn)
convert "y"/"n" to true/false
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $chatSettings

ilPersonalChatSettingsFormGUI::$chatSettings = array()
protected

Definition at line 39 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $ctrl

ilPersonalChatSettingsFormGUI::$ctrl
protected

Definition at line 19 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $event

ilPersonalChatSettingsFormGUI::$event
protected

Definition at line 49 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $lng

ilPersonalChatSettingsFormGUI::$lng
protected

Definition at line 14 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $mainTpl

ilPersonalChatSettingsFormGUI::$mainTpl
protected

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

◆ $notificationSettings

ilPersonalChatSettingsFormGUI::$notificationSettings = array()
protected

Definition at line 44 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $settings

ilPersonalChatSettingsFormGUI::$settings
protected

Definition at line 34 of file class.ilPersonalChatSettingsFormGUI.php.

◆ $user

ilPersonalChatSettingsFormGUI::$user
protected

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


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