ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 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
 $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  {
73  $this->initForm();
74  }
75  }
ILIAS Setting Class.
user()
Definition: user.php:4
settings()
Definition: settings.php:2
global $DIC
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPersonalChatSettingsFormGUI::executeCommand ( )

{}

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

References saveChatOptions(), and showChatOptions().

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

◆ initForm()

ilPersonalChatSettingsFormGUI::initForm ( )
protected

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

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

Referenced by __construct().

130  {
131  $this->lng->loadLanguageModule('chatroom');
132 
133  $this->setFormAction($this->ctrl->getFormAction($this, 'saveChatOptions'));
134  $this->setTitle($this->lng->txt("chat_settings"));
135 
136  if($this->shouldShowNotificationOptions())
137  {
138  $chb = new ilCheckboxInputGUI($this->lng->txt('play_invitation_sound'), 'play_invitation_sound');
139  $this->addItem($chb);
140  }
141 
142  if($this->shouldShowOnScreenChatOptions())
143  {
144  $chb = new ilCheckboxInputGUI($this->lng->txt('chat_osc_accept_msg'), 'chat_osc_accept_msg');
145  $chb->setInfo($this->lng->txt('chat_osc_accept_msg_info'));
146  $chb->setDisabled((bool)$this->settings->get('usr_settings_disable_chat_osc_accept_msg', false));
147  $this->addItem($chb);
148  }
149 
150  $this->addCommandButton('saveChatOptions', $this->lng->txt('save'));
151  }
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 98 of file class.ilPersonalChatSettingsFormGUI.php.

References shouldShowNotificationOptions(), and shouldShowOnScreenChatOptions().

Referenced by saveChatOptions(), and showChatOptions().

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

◆ saveChatOptions()

ilPersonalChatSettingsFormGUI::saveChatOptions ( )
protected

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

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

Referenced by executeCommand().

176  {
177  if(!$this->isAccessible())
178  {
179  $this->ctrl->returnToParent($this);
180  }
181 
182  if(!$this->checkInput())
183  {
184  $this->showChatOptions();
185  return;
186  }
187 
188  if($this->shouldShowNotificationOptions())
189  {
190  $this->user->setPref('chat_play_invitation_sound', (int)$this->getInput('play_invitation_sound'));
191  }
192 
193  if($this->shouldShowOnScreenChatOptions() && !(bool)$this->settings->get('usr_settings_disable_chat_osc_accept_msg', false))
194  {
195  $this->user->setPref('chat_osc_accept_msg', ilUtil::tf2yn((bool)$this->getInput('chat_osc_accept_msg')));
196  }
197 
198  $this->user->writePrefs();
199 
200  $this->event->raise(
201  'Services/User',
202  'chatSettingsChanged',
203  [
204  'user' => $this->user
205  ]
206  );
207 
208  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
209  $this->showChatOptions();
210  }
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 110 of file class.ilPersonalChatSettingsFormGUI.php.

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

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

◆ shouldShowOnScreenChatOptions()

ilPersonalChatSettingsFormGUI::shouldShowOnScreenChatOptions ( )
protected
Returns
bool

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

References settings().

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

119  {
120  return (
121  $this->chatSettings->get('enable_osc', false) &&
122  !(bool)$this->settings->get('usr_settings_hide_chat_osc_accept_msg', false)
123  );
124  }
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 156 of file class.ilPersonalChatSettingsFormGUI.php.

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

Referenced by executeCommand(), and saveChatOptions().

157  {
158  if(!$this->isAccessible())
159  {
160  $this->ctrl->returnToParent($this);
161  }
162 
163  $this->setValuesByArray(array(
164  'play_invitation_sound' => $this->user->getPref('chat_play_invitation_sound'),
165  'chat_osc_accept_msg' => ilUtil::yn2tf($this->user->getPref('chat_osc_accept_msg'))
166  ));
167 
168  $this->mainTpl->setContent($this->getHTML());
169  $this->mainTpl->show();
170  }
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: