ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilChatroomViewTask Class Reference

Class ilChatroomViewTask. More...

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

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor Sets $this->gui using given $gui. More...
 
 forcePublicRoom ()
 
 __construct (ilChatroomObjectGUI $gui)
 
 renderFileUploadForm (ilTemplate $roomTpl)
 Prepares Fileupload form and displays it. More...
 
- Public Member Functions inherited from ilChatroomTaskHandler
 __construct (ilChatroomObjectGUI $gui)
 
 executeDefault ($requestedMethod)
 

Protected Member Functions

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

Private Member Functions

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

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

◆ __construct() [1/2]

ilChatroomViewTask::__construct ( ilChatroomObjectGUI  $gui)

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

Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomTaskHandler.

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

30 {
31 $this->gui = $gui;
32 $this->commonSettings = new ilSetting('common');
33 }
ILIAS Setting Class.

References $gui.

◆ __construct() [2/2]

ilChatroomViewTask::__construct ( ilChatroomObjectGUI  $gui)
Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomTaskHandler.

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

24 {
25 $this->gui = $gui;
26 }

References $gui.

Member Function Documentation

◆ cancelJoin()

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.

33 {
34 ilUtil::sendFailure($message);
35 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ checkDirectory()

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.

245 {
246 $srv_prp_path = ilUtil::getDataDir() . '/chatroom/';
247
248 if(!file_exists($srv_prp_path))
249 {
250 if(!ilUtil::makeDir($srv_prp_path))
251 {
252 throw new Exception('Directory cannot be created');
253 }
254 }
255
256 return $srv_prp_path;
257 }
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

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

Referenced by writeClientSettingsToFile(), and writeDataToFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPrivHosts()

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.

267 {
268 $ipnumbers = preg_replace("/[^0-9.,]+/", "", $ipnumbers);
269 $ips = explode(',', $ipnumbers);
270
271 foreach($ips as $ip)
272 {
273 $ip_parts = explode('.', $ip);
274
275 if(!($ip_parts[0] <= 255 && $ip_parts[1] <= 255 && $ip_parts[2] <= 255 && $ip_parts[3] <= 255 &&
276 preg_match("!^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$!", $ip))
277 )
278 {
279 return false;
280 }
281 }
282
283 return true;
284 }

◆ defaultActions()

ilChatroomViewTask::defaultActions ( )
private

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

442 {
443 $chatSettings = new ilSetting('chatroom');
444 if($chatSettings->get('chat_enabled', false))
445 {
446 $this->forcePublicRoom();
447 }
448 }

References forcePublicRoom().

+ Here is the call graph for this function:

◆ forcePublicRoom()

ilChatroomViewTask::forcePublicRoom ( )

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

454 {
456 if(!$ref_id)
457 {
458 $this->createPublicRoom();
459 return;
460 }
461
463 if(!$instance)
464 {
465 $this->createPublicRoom();
466 return;
467 }
468
470 if(!$obj_id)
471 {
472 $this->createPublicRoom();
473 return;
474 }
475
477 {
478 $this->createPublicRoom();
479 return;
480 }
481
482 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
483 ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
484 }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId($a_id)
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
$ref_id
Definition: sahs_server.php:39

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

Referenced by defaultActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClientFileContent()

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.

183 {
184 $linebreak = "\n";
185
186 $content = 'hash = ' . $settings['hash'] . $linebreak;
187 $content .= 'name = ' . $settings['name'] . $linebreak;
188 $content .= 'url = ' . $settings['url'] . $linebreak;
189 $content .= 'user = ' . $settings['user'] . $linebreak;
190 $content .= 'password = ' . $settings['password'] . $linebreak;
191 $content .= 'client = ' . $settings['client'];
192
193 return $content;
194 }

Referenced by writeClientSettingsToFile().

+ Here is the caller graph for this function:

◆ getFileContent()

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.

222 {
223 $linebreak = "\n";
224
225 $content = 'host = ' . $settings['address'] . $linebreak;
226 $content .= 'port = ' . $settings['port'] . $linebreak;
227 $content .= 'privileged_hosts = ' . $settings['priv_hosts'] . $linebreak;
228
229 $settings['protocol'] == 'https' ? $https = 1 : $https = 0;
230
231 $content .= 'https = ' . $https . $linebreak;
232 $content .= 'keystore = ' . $settings['keystore'] . $linebreak;
233 $content .= 'keypass = ' . $settings['keypass'] . $linebreak;
234 $content .= 'storepass = ' . $settings['storepass'];
235
236 return $content;
237 }
global $https
Definition: imgupload.php:15

References $https.

Referenced by writeDataToFile().

+ Here is the caller graph for this function:

◆ renderFileUploadForm()

ilChatroomViewTask::renderFileUploadForm ( ilTemplate  $roomTpl)

Prepares Fileupload form and displays it.

Parameters
ilTemplate$roomTpl

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

660 {
661 // @todo: Not implemented yet
662 return;
663
664 require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
665 $formFactory = new ilChatroomFormFactory();
666 $file_upload = $formFactory->getFileUploadForm();
667 //$file_upload->setFormAction( $ilCtrl->getFormAction($this->gui, 'UploadFile-uploadFile') );
668 $roomTpl->setVariable('FILE_UPLOAD', $file_upload->getHTML());
669 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:626
Class ilChatroomFormFactory.

References HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ writeClientSettingsToFile()

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.

163 {
164 if($srv_prp_path = $this->checkDirectory())
165 {
166 $handle = fopen($srv_prp_path . 'client.properties', 'w');
167
168 if(!fwrite($handle, $this->getClientFileContent($settings)))
169 {
170 throw new Exception('Cannot write to file');
171 }
172
173 fclose($handle);
174 }
175 }
getClientFileContent(array $settings)
Formats content for client settings file.
checkDirectory()
Checks if external chatroom directory exists or can be created.

References checkDirectory(), and getClientFileContent().

+ Here is the call graph for this function:

◆ writeDataToFile()

ilChatroomViewTask::writeDataToFile ( array  $settings)
protected

Writes server settings to server.properties file.

Parameters
array$settings

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

202 {
203 if($srv_prp_path = $this->checkDirectory())
204 {
205 $handle = fopen($srv_prp_path . 'server.properties', 'w');
206
207 if(!fwrite($handle, $this->getFileContent($settings)))
208 {
209 throw new Exception('Cannot write to file');
210 }
211
212 fclose($handle);
213 }
214 }
getFileContent(array $settings)
Builds and formats content tot write in server.properties file.

References checkDirectory(), and getFileContent().

+ Here is the call graph for this function:

Field Documentation

◆ $commonSettings

ilChatroomViewTask::$commonSettings
private

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

◆ $gui

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: