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

Class ilChatroomFormFactory. More...

+ Collaboration diagram for ilChatroomFormFactory:

Public Member Functions

 __construct ()
 Constructor.
 getCreationForm ()
 Instantiates and returns ilPropertyFormGUI containing ilTextInputGUI and ilTextAreaInputGUI.
 getSettingsForm ()
 Returns settings form.
 getFileUploadForm ()
 Prepares Fileupload form and returns it.
 getPeriodForm ()
 Returns period form.
 getUserChatNameSelectionForm (array $name_options)
 Returns chatname selection form.
 getSessionForm ($sessions)
 Returns session form with period set by given $sessions.
 getGeneralSettingsForm ()
 Returns general settings form.
 getClientSettingsForm ()

Static Public Member Functions

static applyValues (ilPropertyFormGUI $form, $values)
 Applies given values to field in given form.

Private Member Functions

 addDefaultBehaviour (ilPropertyFormGUI $form)
 Adds 'create-save' and 'cancel' button to given $form and returns it.

Detailed Description

Constructor & Destructor Documentation

ilChatroomFormFactory::__construct ( )

Constructor.

Requires ilPropertyFormGUI

Definition at line 21 of file class.ilChatroomFormFactory.php.

{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
}

Member Function Documentation

ilChatroomFormFactory::addDefaultBehaviour ( ilPropertyFormGUI  $form)
private

Adds 'create-save' and 'cancel' button to given $form and returns it.

ilLanguage $lng

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Definition at line 161 of file class.ilChatroomFormFactory.php.

References $lng, and ilPropertyFormGUI\addCommandButton().

Referenced by getCreationForm().

{
global $lng;
$form->addCommandButton( 'create-save', $lng->txt( 'create' ) );
$form->addCommandButton( 'cancel', $lng->txt( 'cancel' ) );
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilChatroomFormFactory::applyValues ( ilPropertyFormGUI  $form,
  $values 
)
static

Applies given values to field in given form.

Parameters
ilPropertyFormGUI$form
array$values
Todo:
: $values typehint array?

Definition at line 57 of file class.ilChatroomFormFactory.php.

References ilPropertyFormGUI\getItemByPostVar().

Referenced by ilChatroomSettingsTask\general().

{
foreach( $values as $key => $value )
{
$field = $form->getItemByPostVar( $key );
if( !$field )
continue;
switch(strtolower( get_class( $field ) ))
{
case 'ilcheckboxinputgui':
if( $value )
{
$field->setChecked( true );
}
break;
default:
$field->setValue( $value );
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatroomFormFactory::getClientSettingsForm ( )

Definition at line 324 of file class.ilChatroomFormFactory.php.

References $lng, ilFormPropertyGUI\setInfo(), ilNumberInputGUI\setMinValue(), and ilFormPropertyGUI\setRequired().

{
global $lng;
$form = new ilPropertyFormGUI();
$cb = new ilCheckboxInputGUI( $lng->txt( 'chat_enabled' ), 'chat_enabled' );
$form->addItem( $cb );
$cb = new ilCheckboxInputGUI( $lng->txt( 'enable_osd' ), 'enable_osd' );
$cb->setInfo($lng->txt('hint_osd'));
$form->addItem( $cb );
$txt = new ilNumberInputGUI( $lng->txt( 'osd_intervall' ), 'osd_intervall' );
$txt->setMinValue(1);
$txt->setRequired( true );
$txt->setInfo($lng->txt('hint_osd_interval'));
$cb->addSubItem( $txt );
$cb1 = new ilCheckboxInputGUI( $lng->txt( 'play_invitation_sound' ), 'play_invitation_sound' );
$cb1->setInfo($lng->txt('play_invitation_sound'));
$cb->addSubItem( $cb1 );
/*$hash = new ilTextInputGUI( $lng->txt( 'hash' ), 'hash' );
$hash->setRequired( true );
$form->addItem( $hash );*/
$cb = new ilCheckboxInputGUI( $lng->txt( 'enable_smilies' ), 'enable_smilies' );
$cb->setInfo($lng->txt('hint_enable_smilies'));
$form->addItem( $cb );
$name = new ilTextInputGUI( $lng->txt( 'instance_name' ), 'name' );
$name->setRequired( true );
$name->setValidationRegexp('/^[a-z0-9_-]+$/i');
$name->setInfo($lng->txt('hint_unique_name'));
$form->addItem( $name );
$url = new ilTextInputGUI( $lng->txt( 'ilias_url' ), 'url' );
$url->setRequired( true );
$form->addItem( $url );
$user = new ilTextInputGUI( $lng->txt( 'soap_user' ), 'user' );
$user->setInfo($lng->txt('soap_user_hint'));
$user->setRequired( true );
$form->addItem( $user );
$password = new ilPasswordInputGUI( $lng->txt( 'soap_user_password' ), 'password' );
$password->setRequired( true );
$form->addItem( $password );
//$client = new ilTextInputGUI( $lng->txt( 'client' ), 'client' );
//$client->setRequired( true );
//$client->setValue( CLIENT_ID );
//$form->addItem( $client );
return $form;
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getCreationForm ( )

Instantiates and returns ilPropertyFormGUI containing ilTextInputGUI and ilTextAreaInputGUI.

Deprecated:
replaced by default creation screens

ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 35 of file class.ilChatroomFormFactory.php.

References $lng, $title, and addDefaultBehaviour().

{
global $lng;
$form = new ilPropertyFormGUI();
$title = new ilTextInputGUI( $lng->txt( 'title' ), 'title' );
$title->setRequired( true );
$form->addItem( $title );
$description = new ilTextAreaInputGUI( $lng->txt( 'description' ), 'desc' );
$form->addItem( $description );
return $this->addDefaultBehaviour( $form );
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getFileUploadForm ( )

Prepares Fileupload form and returns it.

ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 137 of file class.ilChatroomFormFactory.php.

References $lng.

{
global $lng;
$form = new ilPropertyFormGUI();
$file_input = new ilFileInputGUI();
$file_input->setPostVar('file_to_upload');
$file_input->setTitle( $lng->txt( 'upload' ) );
$form->addItem( $file_input );
$form->addCommandButton( 'UploadFile-uploadFile', $lng->txt( 'submit' ) );
$form->setTarget('_blank');
return $form;
}
ilChatroomFormFactory::getGeneralSettingsForm ( )

Returns general settings form.

ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 277 of file class.ilChatroomFormFactory.php.

References $lng, ilRadioOption\addSubItem(), ilNumberInputGUI\setMinValue(), and ilFormPropertyGUI\setRequired().

{
global $lng;
$form = new ilPropertyFormGUI();
$address = new ilTextInputGUI( $lng->txt( 'chatserver_address' ), 'address' );
$address->setRequired( true );
$form->addItem( $address );
$port = new ilNumberInputGUI( $lng->txt( 'chatserver_port' ), 'port' );
$port->setMinValue( 1 );
$port->setMaxValue( 65535 );
$port->setRequired( true );
$port->setInfo($lng->txt('port_info'));
$port->setSize(6);
$form->addItem( $port );
/*
$instance = new ilTextInputGUI( $lng->txt( 'instance' ), 'instance' );
$instance->setRequired( true );
$form->addItem( $instance );
*/
$priv_hosts = new ilTextInputGUI( $lng->txt( 'priv_hosts' ), 'priv_hosts' );
$priv_hosts->setRequired( true );
$form->addItem( $priv_hosts );
$keystore = new ilTextInputGUI( $lng->txt( 'keystore' ), 'keystore' );
$keystore->setRequired( true );
$keypass = new ilTextInputGUI( $lng->txt( 'keypass' ), 'keypass' );
$keypass->setRequired( true );
$storepass = new ilTextInputGUI( $lng->txt( 'storepass' ), 'storepass' );
$storepass->setRequired( true );
$protocol = new ilRadioGroupInputGUI( $lng->txt( 'protocol' ), 'protocol' );
$http = new ilRadioOption( $lng->txt( 'http' ), 'http' );
$https = new ilRadioOption( $lng->txt( 'https' ), 'https' );
$https->addSubItem( $keystore );
$https->addSubItem( $keypass );
$https->addSubItem( $storepass );
$protocol->addOption( $http );
$protocol->addOption( $https );
$form->addItem( $protocol );
return $form;
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getPeriodForm ( )

Returns period form.

ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 177 of file class.ilChatroomFormFactory.php.

References $lng, and ilDateDurationInputGUI\setStartText().

{
global $lng;
$form = new ilPropertyFormGUI();
require_once 'Services/Form/classes/class.ilDateDurationInputGUI.php';
$duration = new ilDateDurationInputGUI( $lng->txt( 'period' ), 'timeperiod' );
$duration->setStartText($lng->txt('duration_from'));
$duration->setEndText($lng->txt('duration_to'));
$duration->setShowTime( true );
$form->addItem( $duration );
return $form;
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getSessionForm (   $sessions)

Returns session form with period set by given $sessions.

ilLanguage $lng

Parameters
array$sessions
Returns
ilPropertyFormGUI
Todo:
: $sessions typehint array?

Definition at line 245 of file class.ilChatroomFormFactory.php.

References $lng, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

{
global $lng;
$form = new ilPropertyFormGUI();
$list = new ilSelectInputGUI( $lng->txt( 'session' ), 'session' );
$options = array();
foreach( $sessions as $session )
{
$start = new ilDateTime( $session['connected'], IL_CAL_UNIX );
$end = new ilDateTime( $session['disconnected'], IL_CAL_UNIX );
$options[$session['connected'] . ',' .
$session['disconnected']] = ilDatePresentation::formatPeriod( $start, $end );
}
$list->setOptions( $options );
$list->setRequired( true );
$form->addItem( $list );
return $form;
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getSettingsForm ( )

Returns settings form.

ilLanguage $lng

Returns
ilPropertyFormGUI

Definition at line 87 of file class.ilChatroomFormFactory.php.

References $lng, $title, ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

{
global $lng;
$form = new ilPropertyFormGUI();
$title = new ilTextInputGUI( $lng->txt( 'title' ), 'title' );
$title->setRequired( true );
$form->addItem( $title );
$description = new ilTextAreaInputGUI( $lng->txt( 'description' ), 'desc' );
$form->addItem( $description );
$cb = new ilCheckboxInputGUI( $lng->txt( 'allow_anonymous' ), 'allow_anonymous' );
$cb->setInfo($lng->txt( 'anonymous_hint' ));
$form->addItem( $cb );
$txt = new ilTextInputGUI( $lng->txt( 'autogen_usernames' ), 'autogen_usernames' );
$txt->setRequired( true );
$txt->setInfo( $lng->txt( 'autogen_usernames_info' ) );
$form->addItem( $txt );
$cb = new ilCheckboxInputGUI( $lng->txt( 'allow_custom_usernames' ), 'allow_custom_usernames' );
$form->addItem( $cb );
$cb_history = new ilCheckboxInputGUI( $lng->txt( 'enable_history' ), 'enable_history' );
$form->addItem( $cb_history );
$num_msg_history = new ilNumberInputGUI( $lng->txt( 'display_past_msgs' ), 'display_past_msgs' );
$num_msg_history->setInfo($lng->txt('hint_display_past_msgs'));
$num_msg_history->setMinValue(0);
$num_msg_history->setMaxValue(100);
$form->addItem( $num_msg_history );
$cb = new ilCheckboxInputGUI( $lng->txt( 'private_rooms_enabled' ), 'private_rooms_enabled' );
$cb->setInfo( $lng->txt( 'private_rooms_enabled_info' ) );
$form->addItem( $cb );
//$cb = new ilCheckboxInputGUI( $lng->txt( 'allow_private_rooms' ), 'allow_private_rooms' );
//$form->addItem( $cb );
return $form;
}

+ Here is the call graph for this function:

ilChatroomFormFactory::getUserChatNameSelectionForm ( array  $name_options)

Returns chatname selection form.

ilLanguage $lng

Parameters
array$name_options
Returns
ilPropertyFormGUI
Todo:
irgendwie anders machen :)

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

References $lng, and ilSubEnabledFormPropertyGUI\addSubItem().

{
global $lng;
$form = new ilPropertyFormGUI();
$radio = new ilRadioGroupInputGUI(
$lng->txt( 'select_custom_username' ), 'custom_username_radio'
);
foreach( $name_options as $key => $option )
{
$opt = new ilRadioOption( $option, $key );
$radio->addOption( $opt );
}
$custom_opt = new ilRadioOption(
$lng->txt( 'custom_username' ), 'custom_username'
);
$radio->addOption( $custom_opt );
$txt = new ilTextInputGUI(
$lng->txt( 'custom_username' ), 'custom_username_text'
);
$custom_opt->addSubItem( $txt );
$form->addItem( $radio );
$radio->setValue( 'fullname' );
return $form;
}

+ Here is the call graph for this function:


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