ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChatroomAdminViewGUI Class Reference

Class ilChatroomAdminViewGUI. More...

+ Inheritance diagram for ilChatroomAdminViewGUI:
+ Collaboration diagram for ilChatroomAdminViewGUI:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 
 executeDefault (string $requestedMethod)
 
 forcePublicRoom ()
 
 createPublicRoom ()
 
 saveClientSettings ()
 
- Public Member Functions inherited from ilChatroomGUIHandler
 execute (string $method)
 
 executeDefault (string $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, bool $isJson=false)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission (string $permission)
 

Protected Member Functions

 checkServerConnection (array $serverSettings)
 
 createSettingTemplate (ilPropertyFormGUI $form)
 
 getReadmePath ()
 
- Protected Member Functions inherited from ilChatroomGUIHandler
 getRequestValue (string $key, Transformation $trafo, $default=null)
 
 hasRequestValue (string $key)
 
 getRoomByObjectId (int $objectId)
 
 exitIfNoRoomExists (?ilChatroom $room)
 Checks if a ilChatroom exists. More...
 
 exitIfNoRoomModeratePermission (ilChatroom $room, int $subRoom, ilChatroomUser $chatUser)
 Check if user can moderate a chatroom. More...
 
 canModerate (ilChatroom $room, int $subRoom, int $usrId)
 
 isMainRoom (int $subRoomId)
 

Protected Attributes

ilSetting $commonSettings
 
- Protected Attributes inherited from ilChatroomGUIHandler
ilChatroomObjectGUI $gui
 
ilObjUser $ilUser
 
ilCtrlInterface $ilCtrl
 
ilLanguage $ilLng
 
Filesystem $webDirectory
 
ilObjectService $obj_service
 
FileUpload $upload
 
ilRbacSystem $rbacsystem
 
ilGlobalTemplateInterface $mainTpl
 
ILIAS $ilias
 
ilNavigationHistory $navigationHistory
 
ilTree $tree
 
ilTabsGUI $tabs
 
UIFactory $uiFactory
 
UIRenderer $uiRenderer
 
GlobalHttpState $http
 
Refinery $refinery
 

Private Member Functions

 defaultActions ()
 

Private Attributes

const CHATROOM_README_PATH = '/Modules/Chatroom/README.md'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilChatroomAdminViewGUI::__construct ( ilChatroomObjectGUI  $gui)

Definition at line 34 of file class.ilChatroomAdminViewGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

35  {
36  global $DIC;
37 
38  parent::__construct($gui);
39  $this->commonSettings = new ilSetting('common');
40  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkServerConnection()

ilChatroomAdminViewGUI::checkServerConnection ( array  $serverSettings)
protected

Definition at line 89 of file class.ilChatroomAdminViewGUI.php.

References ilChatroomServerConnector\checkServerConnection().

Referenced by saveClientSettings().

89  : void
90  {
91  if (
92  isset($serverSettings['port'], $serverSettings['address']) &&
94  ) {
95  $this->mainTpl->setOnScreenMessage('info', $this->ilLng->txt('chat_cannot_connect_to_server'));
96  }
97  }
static checkServerConnection(bool $use_cache=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPublicRoom()

ilChatroomAdminViewGUI::createPublicRoom ( )

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

Referenced by forcePublicRoom().

83  : void
84  {
85  ilChatroomInstaller::createDefaultPublicRoom(true);
86  $this->mainTpl->setOnScreenMessage('success', $this->ilLng->txt('public_chat_created'), true);
87  }
+ Here is the caller graph for this function:

◆ createSettingTemplate()

ilChatroomAdminViewGUI::createSettingTemplate ( ilPropertyFormGUI  $form)
protected

Definition at line 99 of file class.ilChatroomAdminViewGUI.php.

References ilPropertyFormGUI\getHTML(), and getReadmePath().

Referenced by saveClientSettings().

99  : ilTemplate
100  {
101  $furtherInformation = sprintf($this->ilLng->txt('server_further_information'), $this->getReadmePath());
102  $serverTpl = new ilTemplate('tpl.chatroom_serversettings.html', true, true, 'Modules/Chatroom');
103  $serverTpl->setVariable('VAL_SERVERSETTINGS_FORM', $form->getHTML());
104  $serverTpl->setVariable('LBL_SERVERSETTINGS_FURTHER_INFORMATION', $furtherInformation);
105 
106  return $serverTpl;
107  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultActions()

ilChatroomAdminViewGUI::defaultActions ( )
private

Definition at line 47 of file class.ilChatroomAdminViewGUI.php.

References forcePublicRoom().

Referenced by saveClientSettings().

47  : void
48  {
49  $chatSettings = new ilSetting('chatroom');
50  if ($chatSettings->get('chat_enabled', '0')) {
51  $this->forcePublicRoom();
52  }
53  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeDefault()

ilChatroomAdminViewGUI::executeDefault ( string  $requestedMethod)

Definition at line 42 of file class.ilChatroomAdminViewGUI.php.

42  : void
43  {
44  $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
45  }

◆ forcePublicRoom()

ilChatroomAdminViewGUI::forcePublicRoom ( )

Definition at line 55 of file class.ilChatroomAdminViewGUI.php.

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

Referenced by defaultActions().

55  : void
56  {
58  if (!$ref_id) {
59  $this->createPublicRoom();
60  return;
61  }
62 
63  $instance = ilObjectFactory::getInstanceByRefId($ref_id, false);
64  if (!($instance instanceof ilObjChatroom)) {
65  $this->createPublicRoom();
66  return;
67  }
68 
70  if (!$obj_id) {
71  $this->createPublicRoom();
72  return;
73  }
74 
75  if (!ilObject::_hasUntrashedReference($obj_id)) {
76  $this->createPublicRoom();
77  return;
78  }
79 
80  ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
81  }
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReadmePath()

ilChatroomAdminViewGUI::getReadmePath ( )
protected

Definition at line 109 of file class.ilChatroomAdminViewGUI.php.

References ilUtil\_getHttpPath().

Referenced by createSettingTemplate().

109  : string
110  {
111  return ilUtil::_getHttpPath() . self::CHATROOM_README_PATH;
112  }
static _getHttpPath()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveClientSettings()

ilChatroomAdminViewGUI::saveClientSettings ( )

Definition at line 114 of file class.ilChatroomAdminViewGUI.php.

References $factory, ILIAS\LTI\ToolProvider\$settings, checkServerConnection(), ilChatroom\checkUserPermissions(), createSettingTemplate(), defaultActions(), ilChatroomAdmin\loadGeneralSettings(), ilChatroomGUIHandler\redirectIfNoPermission(), and ilChatroomAdmin\saveClientSettings().

114  : void
115  {
116  $this->redirectIfNoPermission('write');
117 
119  $form = $factory->getClientSettingsForm();
120 
121  if (!$form->checkInput()) {
122  $form->setValuesByPost();
123  $this->clientsettings($form);
124  return;
125  }
126 
127  $convIdleStateTime = max(1, (int) $form->getInput('conversation_idle_state_in_minutes'));
128 
129  $settings = [
130  'name' => (string) $form->getInput('client_name'),
131  'enable_osc' => (bool) $form->getInput('enable_osc'),
132  'enable_browser_notifications' => (bool) $form->getInput('enable_browser_notifications'),
133  'conversation_idle_state_in_minutes' => $convIdleStateTime,
134  'chat_enabled' => (bool) $form->getInput('chat_enabled'),
135  'enable_smilies' => (bool) $form->getInput('enable_smilies'),
136  'auth' => $form->getInput('auth')
137  ];
138 
139  if (!$settings['chat_enabled']) {
140  $settings['enable_osc'] = false;
141  }
142 
143  $chatSettings = new ilSetting('chatroom');
144  $chatSettings->set('chat_enabled', (string) $settings['chat_enabled']);
145  $chatSettings->set('enable_browser_notifications', (string) $settings['enable_browser_notifications']);
146  $chatSettings->set('conversation_idle_state_in_minutes', (string) $convIdleStateTime);
147  $chatSettings->set('enable_osc', (string) $settings['enable_osc']);
148 
149  $adminSettings = new ilChatroomAdmin($this->gui->getObject()->getId());
150  $adminSettings->saveClientSettings((object) $settings);
151 
152  $fileHandler = new ilChatroomConfigFileHandler();
153  $fileHandler->createClientConfigFile($settings);
154 
155  $this->mainTpl->setOnScreenMessage('success', $this->ilLng->txt('settings_has_been_saved'), true);
156  $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
157  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
Class ilChatroomFormFactory.
Class ilChatroomAdmin.
saveClientSettings(stdClass $settings)
Saves given client $settings into settingsTable.
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:

Field Documentation

◆ $commonSettings

ilSetting ilChatroomAdminViewGUI::$commonSettings
protected

Definition at line 32 of file class.ilChatroomAdminViewGUI.php.

◆ CHATROOM_README_PATH

const ilChatroomAdminViewGUI::CHATROOM_README_PATH = '/Modules/Chatroom/README.md'
private

Definition at line 30 of file class.ilChatroomAdminViewGUI.php.


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