ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatroomAdmin Class Reference

Class ilChatroomAdmin. More...

+ Collaboration diagram for ilChatroomAdmin:

Public Member Functions

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

Static Public Member Functions

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

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 13 of file class.ilChatroomAdmin.php.

Constructor & Destructor Documentation

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 29 of file class.ilChatroomAdmin.php.

References $config_id, and $settings.

{
$this->config_id = $config_id;
$this->settings = $settings;
}

Member Function Documentation

static ilChatroomAdmin::getDefaultConfiguration ( )
static

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

ilDBMySQL $ilDB

Returns
ilChatroomAdmin

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

References $ilDB, $query, $row, and $settingsTable.

Referenced by ilChatroomServerConnector\checkServerConnection(), ilChatroomServerHandler\getConnector(), and ilObjChatroomGUI\getConnector().

{
global $ilDB;
$ilDB->setLimit( 1 );
$query = 'SELECT * FROM ' . self::$settingsTable; // . ' WHERE default_config = 1';
$rset = $ilDB->query( $query );
if( $row = $ilDB->fetchObject( $rset ) )
{
$obj = new ilChatroomAdmin( $row->instance_id, $row );
return $obj;
}
}

+ Here is the caller graph for this function:

ilChatroomAdmin::getServerSettings ( )

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

Returns
ilChatroomServerSettings

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

References ilChatroomServerSettings\loadDefault().

{
require_once 'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
/*$data = json_decode( $this->settings->server_settings );
$settings = new ilChatroomServerSettings();
$settings->setDomain( $data->address );
$settings->setPort( $data->port );
$settings->setProtocol( $data->protocol );
$settings->setInstance( $data->instance );
return $settings;*/
}

+ Here is the call graph for this function:

ilChatroomAdmin::loadClientSettings ( )

Returns an array containing client settings from settingsTable.

ilDBMySQL $ilDB

Returns
mixed

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

References $ilDB, $query, and $row.

{
global $ilDB;
$query = 'SELECT * FROM ' . self::$settingsTable . ' WHERE instance_id = ' .
$ilDB->quote( $this->config_id, 'integer' );
if( ($row = $ilDB->fetchAssoc( $ilDB->query( $query ) )) && $row['client_settings'] )
{
return json_decode( $row['client_settings'] );
}
return null;
}
ilChatroomAdmin::loadGeneralSettings ( )

Returns an array containing server settings from settingsTable.

ilDBMySQL $ilDB

Returns
mixed

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

References $ilDB, $query, and $row.

Referenced by ilChatroomViewTask\serversettings().

{
global $ilDB;
$query = 'SELECT * FROM ' . self::$settingsTable . ' WHERE instance_id = ' .
$ilDB->quote( $this->config_id, 'integer' );
if( ($row = $ilDB->fetchAssoc( $ilDB->query( $query ) )) && $row['server_settings'] )
{
return json_decode( $row['server_settings'] );
}
return null;
}

+ Here is the caller graph for this function:

ilChatroomAdmin::saveClientSettings ( stdClass  $settings)

Saves given client $settings into settingsTable.

ilDBMySQL $ilDB

Parameters
stdClass$settings

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

References $ilDB, $res, and $row.

Referenced by ilChatroomViewTask\saveClientSettings().

{
global $ilDB;
$res = $ilDB->queryF("
SELECT *
FROM chatroom_admconfig
WHERE instance_id = %s",
array('integer'),
array($this->config_id)
);
$row = $ilDB->fetchAssoc($res);
$ilDB->manipulateF("
DELETE
FROM chatroom_admconfig
WHERE instance_id = %s",
array('integer'),
array($this->config_id)
);
$row['default_config'] !== null ? $def_conf = $row['default_config'] : $def_conf = "{}";
$row['server_settings'] !== null ? $srv_set = $row['server_settings'] : $srv_set = "{}";
$ilDB->manipulateF("
INSERT INTO chatroom_admconfig
(instance_id, server_settings, default_config, client_settings)
VALUES (%s, %s, %s, %s)",
array('integer', 'text', 'integer', 'text'),
array($this->config_id, $srv_set, $def_conf, json_encode( $settings ))
);
}

+ Here is the caller graph for this function:

ilChatroomAdmin::saveGeneralSettings ( stdClass  $settings)

Saves given $settings into settingsTable.

ilDBMySQL $ilDB

Parameters
stdClass$settings

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

References $ilDB, $res, and $row.

Referenced by ilChatroomViewTask\saveSettings().

{
global $ilDB;
$res = $ilDB->queryF("
SELECT *
FROM chatroom_admconfig
WHERE instance_id = %s",
array('integer'),
array($this->config_id)
);
$row = $ilDB->fetchAssoc($res);
$ilDB->manipulateF("
DELETE
FROM chatroom_admconfig
WHERE instance_id = %s",
array('integer'),
array($this->config_id)
);
$row['default_config'] !== null ? $def_conf = $row['default_config'] : $def_conf = "{}";
$row['client_settings'] !== null ? $clnt_set = $row['client_settings'] : $clnt_set = "{}";
$ilDB->manipulateF("
INSERT INTO chatroom_admconfig
(instance_id, server_settings, default_config, client_settings)
VALUES (%s, %s, %s, %s)",
array('integer', 'text', 'integer', 'text'),
array($this->config_id, json_encode( $settings ), $def_conf, $clnt_set)
);
}

+ Here is the caller graph for this function:

Field Documentation

ilChatroomAdmin::$config_id
private

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

Referenced by __construct().

ilChatroomAdmin::$settings
private

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

Referenced by __construct().

ilChatroomAdmin::$settingsTable = 'chatroom_admconfig'
staticprivate

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

Referenced by getDefaultConfiguration().


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