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

Class ilChatroomAdmin. More...

+ Collaboration diagram for ilChatroomAdmin:

Public Member Functions

 __construct ($config_id, stdClass $settings=null)
 Constructor Sets $this->config_id and $this->settings using given $config_id and $settings. More...
 
 getServerSettings ()
 Instantiates ilChatroomServerSettings object, sets data using $this->settings->server_settings and returns object. More...
 
 saveGeneralSettings (stdClass $settings)
 Saves given $settings into settingsTable. More...
 
 saveClientSettings (stdClass $settings)
 Saves given client $settings into settingsTable. More...
 
 loadGeneralSettings ()
 Returns an array containing server settings from settingsTable. More...
 
 loadClientSettings ()
 Returns an array containing client settings from settingsTable. More...
 

Static Public Member Functions

static getDefaultConfiguration ()
 Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable. More...
 

Private Attributes

 $settings
 
 $config_id
 

Static Private Attributes

static $settingsTable = 'chatroom_admconfig'
 

Detailed Description

Class ilChatroomAdmin.

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 10 of file class.ilChatroomAdmin.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomAdmin::__construct (   $config_id,
stdClass  $settings = null 
)

Constructor Sets $this->config_id and $this->settings using given $config_id and $settings.

Parameters
integer$config_id
stdClass$settings

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

References $config_id, $settings, and settings().

35  {
36  $this->config_id = $config_id;
37  $this->settings = $settings;
38  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultConfiguration()

static ilChatroomAdmin::getDefaultConfiguration ( )
static

Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable.

Returns
self

Definition at line 45 of file class.ilChatroomAdmin.php.

References $DIC, $query, and $row.

Referenced by ilChatroomServerConnector\checkServerConnection(), ilObjChatroom\cloneObject(), ilChatroomServerHandler\getConnector(), ilObjChatroomGUI\getConnector(), and ilOnScreenChatAppEventListener\handleEvent().

46  {
47  global $DIC;
48 
49  $DIC->database()->setLimit(1);
50  $query = 'SELECT * FROM ' . self::$settingsTable;
51 
52  $rset = $DIC->database()->query($query);
53  if ($row = $DIC->database()->fetchObject($rset)) {
54  return new self((int) $row->instance_id, $row);
55  }
56  }
global $DIC
Definition: saml.php:7
$query
+ Here is the caller graph for this function:

◆ getServerSettings()

ilChatroomAdmin::getServerSettings ( )

Instantiates ilChatroomServerSettings object, sets data using $this->settings->server_settings and returns object.

Returns
ilChatroomServerSettings

Definition at line 63 of file class.ilChatroomAdmin.php.

References ilChatroomServerSettings\loadDefault().

64  {
65  require_once 'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
67  }
+ Here is the call graph for this function:

◆ loadClientSettings()

ilChatroomAdmin::loadClientSettings ( )

Returns an array containing client settings from settingsTable.

Returns
array

Definition at line 188 of file class.ilChatroomAdmin.php.

References $DIC, $query, $row, $settings, array, and string.

189  {
190  global $DIC;
191 
192  $query = 'SELECT * FROM ' . self::$settingsTable . ' WHERE instance_id = ' . $DIC->database()->quote($this->config_id, 'integer');
193  if (($row = $DIC->database()->fetchAssoc($DIC->database()->query($query))) && $row['client_settings']) {
194  $settings = json_decode($row['client_settings'], true);
195 
196  if (!$settings['osd_intervall']) {
197  $settings['osd_intervall'] = 60;
198  }
199 
200  if (!$settings['client']) {
201  $settings['client'] = CLIENT_ID;
202  }
203 
204  $settings['client_name'] = (string) $settings['name'];
205  if (!$settings['client_name']) {
206  $settings['client_name'] = CLIENT_ID;
207  }
208 
209  return $settings;
210  }
211 
212  return array();
213  }
Add rich text string
global $DIC
Definition: saml.php:7
$query
Create styles array
The data for the language used.

◆ loadGeneralSettings()

ilChatroomAdmin::loadGeneralSettings ( )

Returns an array containing server settings from settingsTable.

Returns
array

Definition at line 165 of file class.ilChatroomAdmin.php.

References $DIC, $query, $row, $settings, and array.

Referenced by ilChatroomAdminViewGUI\clientsettings(), and ilChatroomAdminViewGUI\serversettings().

166  {
167  global $DIC;
168 
169  $query = 'SELECT * FROM ' . self::$settingsTable . ' WHERE instance_id = ' . $DIC->database()->quote($this->config_id, 'integer');
170 
171  if (($row = $DIC->database()->fetchAssoc($DIC->database()->query($query))) && $row['server_settings']) {
172  $settings = json_decode($row['server_settings'], true);
173 
174  if (!$settings['protocol']) {
175  $settings['protocol'] = 'http';
176  }
177 
178  return $settings;
179  }
180 
181  return array();
182  }
global $DIC
Definition: saml.php:7
$query
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ saveClientSettings()

ilChatroomAdmin::saveClientSettings ( stdClass  $settings)

Saves given client $settings into settingsTable.

Parameters
stdClass$settings

Definition at line 114 of file class.ilChatroomAdmin.php.

References $DIC, $res, $row, and array.

Referenced by ilChatroomAdminViewGUI\saveClientSettings().

115  {
116  global $DIC;
117 
118  $res = $DIC->database()->queryF(
119  "
120  SELECT *
121  FROM chatroom_admconfig
122  WHERE instance_id = %s",
123  array('integer'),
124  array($this->config_id)
125  );
126 
127  $row = $DIC->database()->fetchAssoc($res);
128 
129  $DIC->database()->manipulateF(
130  "
131  DELETE
132  FROM chatroom_admconfig
133  WHERE instance_id = %s",
134  array('integer'),
135  array($this->config_id)
136  );
137 
138  $row['default_config'] !== null ? $def_conf = $row['default_config'] : $def_conf = "{}";
139  $row['server_settings'] !== null ? $srv_set = $row['server_settings'] : $srv_set = "{}";
140 
141  $DIC->database()->manipulateF(
142  "
143  INSERT INTO chatroom_admconfig
144  (instance_id, server_settings, default_config, client_settings)
145  VALUES (%s, %s, %s, %s)",
146  array(
147  'integer',
148  'text',
149  'integer',
150  'text'
151  ),
152  array(
153  $this->config_id,
154  $srv_set,
155  $def_conf,
156  json_encode($settings)
157  )
158  );
159  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ saveGeneralSettings()

ilChatroomAdmin::saveGeneralSettings ( stdClass  $settings)

Saves given $settings into settingsTable.

Parameters
stdClass$settings

Definition at line 73 of file class.ilChatroomAdmin.php.

References $DIC, $res, $row, and array.

Referenced by ilChatroomAdminViewGUI\saveSettings().

74  {
75  global $DIC;
76 
77  $res = $DIC->database()->queryF(
78  "
79  SELECT *
80  FROM chatroom_admconfig
81  WHERE instance_id = %s",
82  array('integer'),
83  array($this->config_id)
84  );
85 
86  $row = $DIC->database()->fetchAssoc($res);
87 
88  $DIC->database()->manipulateF(
89  "
90  DELETE
91  FROM chatroom_admconfig
92  WHERE instance_id = %s",
93  array('integer'),
94  array($this->config_id)
95  );
96 
97  $row['default_config'] !== null ? $def_conf = $row['default_config'] : $def_conf = "{}";
98  $row['client_settings'] !== null ? $clnt_set = $row['client_settings'] : $clnt_set = "{}";
99 
100  $DIC->database()->manipulateF(
101  "
102  INSERT INTO chatroom_admconfig
103  (instance_id, server_settings, default_config, client_settings)
104  VALUES (%s, %s, %s, %s)",
105  array('integer', 'text', 'integer', 'text'),
106  array($this->config_id, json_encode($settings), $def_conf, $clnt_set)
107  );
108  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

Field Documentation

◆ $config_id

ilChatroomAdmin::$config_id
private

Definition at line 25 of file class.ilChatroomAdmin.php.

Referenced by __construct().

◆ $settings

ilChatroomAdmin::$settings
private

Definition at line 20 of file class.ilChatroomAdmin.php.

Referenced by __construct(), loadClientSettings(), and loadGeneralSettings().

◆ $settingsTable

ilChatroomAdmin::$settingsTable = 'chatroom_admconfig'
staticprivate

Definition at line 15 of file class.ilChatroomAdmin.php.


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