ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatroomViewTask Class Reference

Class ilChatroomViewTask. More...

+ Inheritance diagram for ilChatroomViewTask:
+ Collaboration diagram for ilChatroomViewTask:

Public Member Functions

 __construct (ilDBayObjectGUI $gui)
 Constructor Sets $this->gui using given $gui.
 forcePublicRoom ()
 __construct (ilDBayObjectGUI $gui)
 renderFileUploadForm (ilTemplate $roomTpl)
 Prepares Fileupload form and displays it.
- Public Member Functions inherited from ilDBayTaskHandler
 executeDefault ($requestedMethod)
 execute ($method)
 Executes given $method if existing, otherwise executes executeDefault() method.

Protected Member Functions

 writeClientSettingsToFile (array $settings)
 Writes client settings to client.properties file.
 getClientFileContent (array $settings)
 Formats content for client settings file.
 writeDataToFile (array $settings)
 Writes server settings to server.properties file.
 getFileContent (array $settings)
 Builds and formats content tot write in server.properties file.
 checkDirectory ()
 Checks if external chatroom directory exists or can be created.
 checkPrivHosts ($ipnumbers)
 Checks if a valid IP number or a comma-separated string of valid IP numbers is given.

Private Member Functions

 defaultActions ()
 cancelJoin ($message)
 Calls ilUtil::sendFailure method using given $message as parameter.

Private Attributes

 $gui
 $commonSettings

Detailed Description

Class ilChatroomViewTask.

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

Definition at line 12 of file class.ilChatroomViewTask.php.

Constructor & Destructor Documentation

ilChatroomViewTask::__construct ( ilDBayObjectGUI  $gui)

Constructor Sets $this->gui using given $gui.

Parameters
ilDBayObjectGUI$gui

Reimplemented from ilDBayTaskHandler.

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

References $gui.

{
$this->gui = $gui;
$this->commonSettings = new ilSetting('common');
}
ilChatroomViewTask::__construct ( ilDBayObjectGUI  $gui)
Parameters
ilDBayObjectGUI$gui

Reimplemented from ilDBayTaskHandler.

Definition at line 23 of file class.ilChatroomViewTask.php.

References $gui.

{
$this->gui = $gui;
}

Member Function Documentation

ilChatroomViewTask::cancelJoin (   $message)
private

Calls ilUtil::sendFailure method using given $message as parameter.

Parameters
string$message

Definition at line 32 of file class.ilChatroomViewTask.php.

References ilUtil\sendFailure().

{
}

+ Here is the call graph for this function:

ilChatroomViewTask::checkDirectory ( )
protected

Checks if external chatroom directory exists or can be created.

Returns
string
Exceptions
Exception

Definition at line 244 of file class.ilChatroomViewTask.php.

References ilUtil\getDataDir(), and ilUtil\makeDir().

Referenced by writeClientSettingsToFile(), and writeDataToFile().

{
$srv_prp_path = ilUtil::getDataDir() . '/chatroom/';
if(!file_exists($srv_prp_path))
{
if(!ilUtil::makeDir($srv_prp_path))
{
throw new Exception('Directory cannot be created');
}
}
return $srv_prp_path;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatroomViewTask::checkPrivHosts (   $ipnumbers)
protected

Checks if a valid IP number or a comma-separated string of valid IP numbers is given.

Parameters
string$ipnumbers
Returns
bool

Definition at line 266 of file class.ilChatroomViewTask.php.

{
$ipnumbers = preg_replace("/[^0-9.,]+/", "", $ipnumbers);
$ips = explode(',', $ipnumbers);
foreach($ips as $ip)
{
$ip_parts = explode('.', $ip);
if(!($ip_parts[0] <= 255 && $ip_parts[1] <= 255 && $ip_parts[2] <= 255 && $ip_parts[3] <= 255 &&
preg_match("!^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$!", $ip))
)
{
return false;
}
}
return true;
}
ilChatroomViewTask::defaultActions ( )
private

Definition at line 441 of file class.ilChatroomViewTask.php.

References forcePublicRoom().

{
$chatSettings = new ilSetting('chatroom');
if($chatSettings->get('chat_enabled', false))
{
$this->forcePublicRoom();
}
}

+ Here is the call graph for this function:

ilChatroomViewTask::forcePublicRoom ( )

Definition at line 453 of file class.ilChatroomViewTask.php.

References $ref_id, ilObjChatroom\_getPublicRefId(), ilObject\_hasUntrashedReference(), ilObject\_lookupObjId(), and ilObjectFactory\getInstanceByRefId().

Referenced by defaultActions().

{
if(!$ref_id)
{
$this->createPublicRoom();
return;
}
if(!$instance)
{
$this->createPublicRoom();
return;
}
if(!$obj_id)
{
$this->createPublicRoom();
return;
}
{
$this->createPublicRoom();
return;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatroomViewTask::getClientFileContent ( array  $settings)
protected

Formats content for client settings file.

Parameters
array$settings
Returns
string

Definition at line 182 of file class.ilChatroomViewTask.php.

Referenced by writeClientSettingsToFile().

{
$linebreak = "\n";
$content = 'hash = ' . $settings['hash'] . $linebreak;
$content .= 'name = ' . $settings['name'] . $linebreak;
$content .= 'url = ' . $settings['url'] . $linebreak;
$content .= 'user = ' . $settings['user'] . $linebreak;
$content .= 'password = ' . $settings['password'] . $linebreak;
$content .= 'client = ' . $settings['client'];
return $content;
}

+ Here is the caller graph for this function:

ilChatroomViewTask::getFileContent ( array  $settings)
protected

Builds and formats content tot write in server.properties file.

Parameters
array$settings
Returns
string

Definition at line 221 of file class.ilChatroomViewTask.php.

References $https.

Referenced by writeDataToFile().

{
$linebreak = "\n";
$content = 'host = ' . $settings['address'] . $linebreak;
$content .= 'port = ' . $settings['port'] . $linebreak;
$content .= 'privileged_hosts = ' . $settings['priv_hosts'] . $linebreak;
$settings['protocol'] == 'https' ? $https = 1 : $https = 0;
$content .= 'https = ' . $https . $linebreak;
$content .= 'keystore = ' . $settings['keystore'] . $linebreak;
$content .= 'keypass = ' . $settings['keypass'] . $linebreak;
$content .= 'storepass = ' . $settings['storepass'];
return $content;
}

+ Here is the caller graph for this function:

ilChatroomViewTask::renderFileUploadForm ( ilTemplate  $roomTpl)

Prepares Fileupload form and displays it.

Parameters
ilTemplate$roomTpl

Definition at line 637 of file class.ilChatroomViewTask.php.

References HTML_Template_IT\setVariable().

{
// @todo: Not implemented yet
return;
require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
$formFactory = new ilChatroomFormFactory();
$file_upload = $formFactory->getFileUploadForm();
//$file_upload->setFormAction( $ilCtrl->getFormAction($this->gui, 'UploadFile-uploadFile') );
$roomTpl->setVariable('FILE_UPLOAD', $file_upload->getHTML());
}

+ Here is the call graph for this function:

ilChatroomViewTask::writeClientSettingsToFile ( array  $settings)
protected

Writes client settings to client.properties file.

Parameters
array$settings
Exceptions
Exception

Definition at line 162 of file class.ilChatroomViewTask.php.

References checkDirectory(), and getClientFileContent().

{
if($srv_prp_path = $this->checkDirectory())
{
$handle = fopen($srv_prp_path . 'client.properties', 'w');
if(!fwrite($handle, $this->getClientFileContent($settings)))
{
throw new Exception('Cannot write to file');
}
fclose($handle);
}
}

+ Here is the call graph for this function:

ilChatroomViewTask::writeDataToFile ( array  $settings)
protected

Writes server settings to server.properties file.

Parameters
array$settings

Definition at line 201 of file class.ilChatroomViewTask.php.

References checkDirectory(), and getFileContent().

{
if($srv_prp_path = $this->checkDirectory())
{
$handle = fopen($srv_prp_path . 'server.properties', 'w');
if(!fwrite($handle, $this->getFileContent($settings)))
{
throw new Exception('Cannot write to file');
}
fclose($handle);
}
}

+ Here is the call graph for this function:

Field Documentation

ilChatroomViewTask::$commonSettings
private

Definition at line 22 of file class.ilChatroomViewTask.php.

ilChatroomViewTask::$gui
private

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

Referenced by __construct().


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