ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilChatroomSettingsGUI Class Reference

Class ilChatroomSettingsGUI. More...

+ Inheritance diagram for ilChatroomSettingsGUI:
+ Collaboration diagram for ilChatroomSettingsGUI:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor Requires ilChatroomFormFactory, ilChatroom and ilChatroomInstaller, sets $this->gui using given $gui and calls ilChatroomInstaller::install() method. More...
 
 saveGeneral ()
 Saves settings fetched from $_POST. More...
 
 general (ilPropertyFormGUI $settingsForm=null)
 Prepares and displays settings form. More...
 
 executeDefault ($requestedMethod)
 
- Public Member Functions inherited from ilChatroomGUIHandler
 __construct (ilChatroomObjectGUI $gui)
 
 sendResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. More...
 
 execute ($method)
 Executes given $method if existing, otherwise executes executeDefault() method. More...
 
 executeDefault ($requestedMethod)
 
 redirectIfNoPermission ($permission)
 Checks for requested permissions and redirects if the permission check failed. More...
 
 isSuccessful ($response)
 Checks for success param in an json decoded response. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilChatroomGUIHandler
 getRoomByObjectId ($objectId)
 
 exitIfNoRoomExists ($room)
 Checks if a ilChatroom exists. More...
 
 exitIfNoRoomPermission ($room, $subRoom, $chat_user)
 Check if user can moderate a chatroom. More...
 
 canModerate ($room, $subRoom, $user_id)
 Checks if the user has permission to moderate a ilChatroom. More...
 
 isMainRoom ($subRoomId)
 
- Protected Attributes inherited from ilChatroomGUIHandler
 $gui
 
 $ilUser
 
 $ilCtrl
 
 $ilLng
 
 $webDirectory
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilChatroomSettingsGUI::__construct ( ilChatroomObjectGUI  $gui)

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

Parameters
ilChatroomObjectGUI$gui

Definition at line 19 of file class.ilChatroomSettingsGUI.php.

20  {
21  parent::__construct($gui);
22 
23  require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
24  require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
25  require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
26  }

Member Function Documentation

◆ executeDefault()

ilChatroomSettingsGUI::executeDefault (   $requestedMethod)
Parameters
string$requestedMethod
Returns
void

Definition at line 132 of file class.ilChatroomSettingsGUI.php.

References general().

133  {
134  $this->general();
135  }
general(ilPropertyFormGUI $settingsForm=null)
Prepares and displays settings form.
+ Here is the call graph for this function:

◆ general()

ilChatroomSettingsGUI::general ( ilPropertyFormGUI  $settingsForm = null)

Prepares and displays settings form.

Parameters
ilPropertyFormGUI$settingsForm

Definition at line 75 of file class.ilChatroomSettingsGUI.php.

References ilChatroomFormFactory\applyValues(), ilChatroom\checkUserPermissions(), ilCtrl\getFormAction(), IL_CAL_UNIX, ilCtrl\redirectByClass(), ilUtil\sendInfo(), and ilCtrl\setParameterByClass().

Referenced by executeDefault(), and saveGeneral().

76  {
78  'read',
79  'write'
80  ), $this->gui->ref_id)
81  ) {
82  $this->ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
83  $this->ilCtrl->redirectByClass('ilrepositorygui', '');
84  }
85 
86  $chatSettings = new ilSetting('chatroom');
87  if (!$chatSettings->get('chat_enabled')) {
88  ilUtil::sendInfo($this->ilLng->txt('server_disabled'), true);
89  }
90 
91  $this->gui->switchToVisibleMode();
92 
93  $formFactory = new ilChatroomFormFactory();
94 
95  $room = ilChatRoom::byObjectId($this->gui->object->getId());
96 
97  if (!$settingsForm) {
98  $settingsForm = $formFactory->getSettingsForm();
99 
100  require_once 'Services/Object/classes/class.ilObjectActivation.php';
101  $settings = array(
102  'title' => $this->gui->object->getTitle(),
103  'desc' => $this->gui->object->getDescription(),
104  'access_period' => array(
105  'start' => $this->gui->object->getAccessBegin() ? new ilDateTime($this->gui->object->getAccessBegin(), IL_CAL_UNIX) : null,
106  'end' => $this->gui->object->getAccessEnd() ? new ilDateTime($this->gui->object->getAccessEnd(), IL_CAL_UNIX) : null
107  ),
108  'access_visibility' => $this->gui->object->getAccessVisibility()
109  );
110 
111  if ($room) {
113  $settingsForm,
114  array_merge($settings, $room->getSettings())
115  );
116  } else {
117  ilChatroomFormFactory::applyValues($settingsForm, $settings);
118  }
119  }
120 
121  $settingsForm->setTitle($this->ilLng->txt('settings_title'));
122  $settingsForm->addCommandButton('settings-saveGeneral', $this->ilLng->txt('save'));
123  $settingsForm->setFormAction($this->ilCtrl->getFormAction($this->gui, 'settings-saveGeneral'));
124 
125  $this->mainTpl->setVariable('ADM_CONTENT', $settingsForm->getHtml());
126  }
This class provides processing control methods.
setFormAction($a_formaction)
Set FormAction.
const IL_CAL_UNIX
Class ilChatroomFormFactory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setTitle($a_title)
Set Title.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
Date and time handling
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
static applyValues(ilPropertyFormGUI $form, array $values)
Applies given values to field in given form.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGeneral()

ilChatroomSettingsGUI::saveGeneral ( )

Saves settings fetched from $_POST.

Definition at line 31 of file class.ilChatroomSettingsGUI.php.

References $_POST, general(), IL_CAL_UNIX, ilCtrl\redirect(), ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

32  {
33  $formFactory = new ilChatroomFormFactory();
34  $settingsForm = $formFactory->getSettingsForm();
35 
36  if (!$settingsForm->checkInput()) {
37  $settingsForm->setValuesByPost();
38  $this->general($settingsForm);
39  } else {
40  $this->gui->object->setTitle($settingsForm->getInput('title'));
41  $this->gui->object->setDescription($settingsForm->getInput('desc'));
42 
43  require_once 'Services/Object/classes/class.ilObjectActivation.php';
44 
45  $period = $settingsForm->getItemByPostVar('access_period');
46  if ($period->getStart() && $period->getEnd()) {
47  $this->gui->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
48  $this->gui->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
49  $this->gui->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
50  $this->gui->object->setAccessVisibility((int) $settingsForm->getInput('access_visibility'));
51  } else {
52  $this->gui->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
53  }
54 
55  $this->gui->object->update();
56  // @todo: Do not rely on raw post data
57  $settings = $_POST;
58  $room = ilChatRoom::byObjectId($this->gui->object->getId());
59 
60  if (!$room) {
61  $room = new ilChatRoom();
62  $settings['object_id'] = $this->gui->object->getId();
63  }
64  $room->saveSettings($settings);
65 
66  ilUtil::sendSuccess($this->ilLng->txt('saved_successfully'), true);
67  $this->ilCtrl->redirect($this->gui, 'settings-general');
68  }
69  }
This class provides processing control methods.
const IL_CAL_UNIX
Class ilChatroomFormFactory.
general(ilPropertyFormGUI $settingsForm=null)
Prepares and displays settings form.
$_POST["username"]
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.
+ Here is the call graph for this function:

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