49 $DIC->database()->setLimit(1);
50 $query =
'SELECT * FROM ' . self::$settingsTable;
52 $rset = $DIC->database()->query(
$query);
53 if ($row = $DIC->database()->fetchObject($rset)) {
54 return new self((int) $row->instance_id, $row);
65 require_once
'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
77 $res = $DIC->database()->queryF(
80 FROM chatroom_admconfig 81 WHERE instance_id = %s",
83 array($this->config_id)
86 $row = $DIC->database()->fetchAssoc(
$res);
88 $DIC->database()->manipulateF(
91 FROM chatroom_admconfig 92 WHERE instance_id = %s",
94 array($this->config_id)
100 if ($row[
'default_config'] !== null) {
101 $def_conf = $row[
'default_config'];
104 if ($row[
'client_settings'] !== null) {
105 $clnt_set = $row[
'client_settings'];
109 $DIC->database()->manipulateF(
111 INSERT INTO chatroom_admconfig 112 (instance_id, server_settings, default_config, client_settings) 113 VALUES (%s, %s, %s, %s)",
114 array(
'integer',
'text',
'integer',
'text'),
115 array($this->config_id, json_encode($settings), $def_conf, $clnt_set)
127 $res = $DIC->database()->queryF(
130 FROM chatroom_admconfig 131 WHERE instance_id = %s",
133 array($this->config_id)
136 $row = $DIC->database()->fetchAssoc(
$res);
138 $DIC->database()->manipulateF(
141 FROM chatroom_admconfig 142 WHERE instance_id = %s",
144 array($this->config_id)
147 $row[
'default_config'] !== null ? $def_conf = $row[
'default_config'] : $def_conf =
"{}";
148 $row[
'server_settings'] !== null ? $srv_set = $row[
'server_settings'] : $srv_set =
"{}";
150 $DIC->database()->manipulateF(
152 INSERT INTO chatroom_admconfig 153 (instance_id, server_settings, default_config, client_settings) 154 VALUES (%s, %s, %s, %s)",
165 json_encode($settings)
178 $query =
'SELECT * FROM ' . self::$settingsTable .
' WHERE instance_id = ' . $DIC->database()->quote($this->config_id,
'integer');
180 if (($row = $DIC->database()->fetchAssoc($DIC->database()->query(
$query))) && $row[
'server_settings']) {
181 $settings = json_decode($row[
'server_settings'],
true);
205 $query =
'SELECT * FROM ' . self::$settingsTable .
' WHERE instance_id = ' . $DIC->database()->quote($this->config_id,
'integer');
206 if (($row = $DIC->database()->fetchAssoc($DIC->database()->query(
$query))) && $row[
'client_settings']) {
207 $settings = json_decode($row[
'client_settings'],
true);
222 if (is_numeric(
$settings[
'conversation_idle_state_in_minutes'])) {
223 $settings[
'conversation_idle_state_in_minutes'] = max(1,
$settings[
'conversation_idle_state_in_minutes']);
225 $settings[
'conversation_idle_state_in_minutes'] = 1;
saveGeneralSettings(stdClass $settings)
Saves given $settings into settingsTable.
static getDefaultConfiguration()
Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable...
foreach($_POST as $key=> $value) $res
loadGeneralSettings()
Returns an array containing server settings from settingsTable.
loadClientSettings()
Returns an array containing client settings from settingsTable.
__construct($config_id, stdClass $settings=null)
Constructor Sets $this->config_id and $this->settings using given $config_id and $settings.
saveClientSettings(stdClass $settings)
Saves given client $settings into settingsTable.
getServerSettings()
Instantiates ilChatroomServerSettings object, sets data using $this->settings->server_settings and re...