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

Class ilChatroomSettingsTask. More...

+ Inheritance diagram for ilChatroomSettingsTask:
+ Collaboration diagram for ilChatroomSettingsTask:

Public Member Functions

 __construct (ilDBayObjectGUI $gui)
 Constructor.
 general (ilPropertyFormGUI $settingsForm=null)
 Prepares and displays settings form.
 saveGeneral ()
 Saves settings fetched from $_POST.
 executeDefault ($requestedMethod)
 executeDefault
- Public Member Functions inherited from ilDBayTaskHandler
 execute ($method)
 Executes given $method if existing, otherwise executes executeDefault() method.

Private Attributes

 $gui

Detailed Description

Constructor & Destructor Documentation

ilChatroomSettingsTask::__construct ( ilDBayObjectGUI  $gui)

Constructor.

Requires ilChatroomFormFactory, ilChatroom and ilChatroomInstaller, sets $this->gui using given $gui and calls ilChatroomInstaller::install() method.

Parameters
ilDBayObjectGUI$gui

Reimplemented from ilDBayTaskHandler.

Definition at line 27 of file class.ilChatroomSettingsTask.php.

References $gui.

{
$this->gui = $gui;
require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
//ilChatroomInstaller::install();
}

Member Function Documentation

ilChatroomSettingsTask::executeDefault (   $requestedMethod)

executeDefault

Parameters
string$requestedMethod

Reimplemented from ilDBayTaskHandler.

Definition at line 143 of file class.ilChatroomSettingsTask.php.

References general().

{
$this->general();
}

+ Here is the call graph for this function:

ilChatroomSettingsTask::general ( ilPropertyFormGUI  $settingsForm = null)

Prepares and displays settings form.

ilLanguage $lng ilTemplate $tpl ilCtrl2 $ilCtrl

Parameters
ilPropertyFormGUI$settingsForm

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

References $ilCtrl, $lng, $tpl, ilChatroomFormFactory\applyValues(), ilChatroom\checkUserPermissions(), ilUtil\redirect(), and ilUtil\sendInfo().

Referenced by executeDefault(), and saveGeneral().

{
global $lng, $tpl, $ilCtrl;
if ( !ilChatroom::checkUserPermissions( array('read', 'write') , $this->gui->ref_id ) )
{
ilUtil::redirect("repository.php");
}
$chatSettings = new ilSetting('chatroom');
if( !$chatSettings->get('chat_enabled') )
{
ilUtil::sendInfo($lng->txt('server_disabled'), true);
}
$this->gui->switchToVisibleMode();
$formFactory = new ilChatroomFormFactory();
if( !$settingsForm )
{
$settingsForm = $formFactory->getSettingsForm();
}
$room = ilChatRoom::byObjectId( $this->gui->object->getId() );
$settings = array(
'title' => $this->gui->object->getTitle(),
'desc' => $this->gui->object->getDescription(),
);
if( $room )
{
//$settingsForm->setValuesByArray(array_merge($settings, $room->getSettings()));
$settingsForm, array_merge( $settings, $room->getSettings() )
);
}
else
{
//$settingsForm->setValuesByArray($settings);
ilChatroomFormFactory::applyValues( $settingsForm, $settings );
}
$settingsForm->setTitle( $lng->txt('settings_title') );
$settingsForm->addCommandButton( 'settings-saveGeneral', $lng->txt( 'save' ) );
$settingsForm->addCommandButton( 'settings-general', $lng->txt( 'cancel' ) );
$settingsForm->setFormAction(
$ilCtrl->getFormAction( $this->gui, 'settings-saveGeneral' )
);
$tpl->setVariable( 'ADM_CONTENT', $settingsForm->getHtml() );
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatroomSettingsTask::saveGeneral ( )

Saves settings fetched from $_POST.

ilCtrl2 $ilCtrl

Definition at line 104 of file class.ilChatroomSettingsTask.php.

References $_POST, $ilCtrl, $lng, general(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$formFactory = new ilChatroomFormFactory();
$settingsForm = $formFactory->getSettingsForm();
if( !$settingsForm->checkInput() )
{
$this->general( $settingsForm );
}
else
{
$this->gui->object->setTitle( $_POST['title'] );
$this->gui->object->setDescription( $_POST['desc'] );
$this->gui->object->update();
$settings = $_POST;
$room = ilChatRoom::byObjectId( $this->gui->object->getId() );
if( !$room )
{
$room = new ilChatRoom();
$settings['object_id'] = $this->gui->object->getId();
}
//var_dump($settings);exit;
$room->saveSettings( $settings );
ilUtil::sendSuccess($lng->txt('saved_successfully'), true);
$ilCtrl->redirect( $this->gui, 'settings-general' );
}
}

+ Here is the call graph for this function:

Field Documentation

ilChatroomSettingsTask::$gui
private

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

Referenced by __construct().


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