ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 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...
 
 sendResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. More...
 

Protected Attributes

 $object
 
- Protected Attributes inherited from ilChatroomGUIHandler
 $gui
 
 $ilUser
 
 $ilCtrl
 
 $ilLng
 
 $webDirectory
 
 $obj_service
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

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)
 

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 24 of file class.ilChatroomSettingsGUI.php.

References ILIAS\GlobalScreen\Provider\__construct().

25  {
26  parent::__construct($gui);
27 
28  require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
29  require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
30  require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
31  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeDefault()

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

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

References general().

153  {
154  $this->general();
155  }
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
Exceptions
ilDateTimeException

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

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

Referenced by executeDefault(), and saveGeneral().

84  {
86  'visible',
87  'read'
88  ), $this->gui->ref_id)
89  ) {
90  $this->ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
91  $this->ilCtrl->redirectByClass('ilrepositorygui', '');
92  }
93 
94  $chatSettings = new ilSetting('chatroom');
95  if (!$chatSettings->get('chat_enabled')) {
96  ilUtil::sendInfo($this->ilLng->txt('server_disabled'), true);
97  }
98 
99  $this->gui->switchToVisibleMode();
100 
101  $formFactory = new ilChatroomFormFactory();
102 
103  $room = ilChatRoom::byObjectId($this->gui->object->getId());
104 
105  if (!$settingsForm) {
106  $settingsForm = $formFactory->getSettingsForm();
107 
108  require_once 'Services/Object/classes/class.ilObjectActivation.php';
109  $settings = array(
110  'title' => $this->gui->object->getTitle(),
111  'desc' => $this->gui->object->getDescription(),
112  'access_period' => array(
113  'start' => $this->gui->object->getAccessBegin() ? new ilDateTime(
114  $this->gui->object->getAccessBegin(),
116  ) : null,
117  'end' => $this->gui->object->getAccessEnd() ? new ilDateTime(
118  $this->gui->object->getAccessEnd(),
120  ) : null
121  ),
122  'access_visibility' => $this->gui->object->getAccessVisibility()
123  );
124 
125  $presentationHeader = new ilFormSectionHeaderGUI();
126  $presentationHeader->setTitle($this->ilLng->txt('settings_presentation_header'));
127  $settingsForm->addItem($presentationHeader);
128  $this->obj_service->commonSettings()->legacyForm($settingsForm, $this->gui->object)->addTileImage();
129 
130  if ($room) {
132  $settingsForm,
133  array_merge($settings, $room->getSettings())
134  );
135  } else {
136  ilChatroomFormFactory::applyValues($settingsForm, $settings);
137  }
138  }
139 
140  $settingsForm->setTitle($this->ilLng->txt('settings_title'));
141  $settingsForm->addCommandButton('settings-saveGeneral', $this->ilLng->txt('save'));
142  $settingsForm->setFormAction($this->ilCtrl->getFormAction($this->gui, 'settings-saveGeneral'));
143 
144  $this->mainTpl->setVariable('ADM_CONTENT', $settingsForm->getHtml());
145  }
This class provides processing control methods.
const ROOT_FOLDER_ID
Definition: constants.php:30
This class represents a section header in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
const IL_CAL_UNIX
Class ilChatroomFormFactory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get form action url for gui class object.
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.
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.
+ 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 36 of file class.ilChatroomSettingsGUI.php.

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

37  {
38  $formFactory = new ilChatroomFormFactory();
39  $settingsForm = $formFactory->getSettingsForm();
40  $this->obj_service->commonSettings()->legacyForm($settingsForm, $this->gui->object)->addTileImage();
41 
42  if (!$settingsForm->checkInput()) {
43  $settingsForm->setValuesByPost();
44  $this->general($settingsForm);
45  } else {
46  $this->gui->object->setTitle($settingsForm->getInput('title'));
47  $this->gui->object->setDescription($settingsForm->getInput('desc'));
48 
49  require_once 'Services/Object/classes/class.ilObjectActivation.php';
50 
51  $period = $settingsForm->getItemByPostVar('access_period');
52  if ($period->getStart() && $period->getEnd()) {
53  $this->gui->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
54  $this->gui->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
55  $this->gui->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
56  $this->gui->object->setAccessVisibility((int) $settingsForm->getInput('access_visibility'));
57  } else {
58  $this->gui->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
59  }
60 
61  $this->gui->object->update();
62  $this->obj_service->commonSettings()->legacyForm($settingsForm, $this->gui->object)->saveTileImage();
63  // @todo: Do not rely on raw post data
64  $settings = $_POST;
65  $room = ilChatRoom::byObjectId($this->gui->object->getId());
66 
67  if (!$room) {
68  $room = new ilChatRoom();
69  $settings['object_id'] = $this->gui->object->getId();
70  }
71  $room->saveSettings($settings);
72 
73  ilUtil::sendSuccess($this->ilLng->txt('saved_successfully'), true);
74  $this->ilCtrl->redirect($this->gui, 'settings-general');
75  }
76  }
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:

Field Documentation

◆ $object

ilChatroomSettingsGUI::$object
protected

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


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