47 private function activateTab(array $commandParts, $config)
54 if(count($commandParts) > 1)
56 if(isset($config[$commandParts[0]]))
58 $ilTabs->activateTab($commandParts[0]);
60 if(isset($config[$commandParts[0]][
'subtabs'][$commandParts[1]]))
62 $ilTabs->activateSubTab($commandParts[1]);
66 else if(count($commandParts) == 1)
68 $ilTabs->activateTab($commandParts[0]);
77 public function getAdminTabsForCommand($command)
87 $stopCommands = array(
'create');
89 if(in_array($command, $stopCommands))
95 $public_room_ref = $settings->get(
'public_room_ref');
97 $query =
'SELECT ref_id FROM object_reference INNER JOIN object_data ON object_data.obj_id = object_reference.obj_id WHERE type = ' . $ilDB->quote(
'chta',
'text');
98 $rset = $ilDB->query(
$query);
99 $data = $ilDB->fetchAssoc($rset);
100 $admin_ref =
$data[
'ref_id'];
102 $ilCtrl->setParameterByClass(
'ilObjChatroomAdminGUI',
'ref_id', $admin_ref);
107 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomAdminGUI',
'view-clientsettings'),
108 'permission' =>
'read',
110 'clientsettings' => array(
111 'lng' =>
'client_settings',
112 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomAdminGUI',
'view-clientsettings'),
113 'permission' =>
'read'
115 'serversettings' => array(
116 'lng' =>
'server_settings',
117 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomAdminGUI',
'view-serversettings'),
118 'permission' =>
'read'
124 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomAdminGUI',
'smiley'),
125 'permission' =>
'read'
128 $ilCtrl->setParameterByClass(
'ilObjChatroomGUI',
'ref_id', $public_room_ref);
130 $config[
'settings'] = array(
131 'lng' =>
'public_chat_settings',
132 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomGUI',
'settings-general'),
133 'permission' =>
'write',
137 'link' => $ilCtrl->getLinkTarget($this->gui,
'settings-general'),
138 'permission' =>
'write'
142 'link' => $ilCtrl->getLinkTargetByClass(
'ilObjChatroomGUI',
'ban-show'),
143 'permission' =>
'moderate'
148 $ilCtrl->setParameterByClass(
'ilPermissionGUI',
'ref_id', $public_room_ref);
149 $config[
'perm'] = array(
150 'lng' =>
'public_chat_permissions',
151 'link' => $ilCtrl->getLinkTargetByClass(
'ilPermissionGUI',
'perm'),
152 'permission' =>
'write',
154 $ilCtrl->clearParametersByClass(
'ilPermissionGUI');
156 $ilCtrl->setParameterByClass(
'ilPermissionGUI',
'ref_id', $admin_ref);
157 $config[
'perm_settings'] = array(
158 'lng' =>
'perm_settings',
159 'link' => $ilCtrl->getLinkTargetByClass(
'ilpermissiongui',
'perm'),
160 'permission' =>
'write',
162 $ilCtrl->clearParametersByClass(
'ilPermissionGUI');
164 $commandParts = explode(
'_', $command, 2);
165 if($command ==
'ban_show')
167 $commandParts[0] =
'settings';
168 $commandParts[1] =
'ban';
170 else if($command ==
'settings_general')
172 $commandParts[0] =
'settings';
173 $commandParts[1] =
'settings';
175 else if($ilCtrl->getCmdClass() ==
'ilpermissiongui' &&
$_REQUEST[
'ref_id'] == $public_room_ref)
177 $commandParts[0] =
'perm';
178 $ilCtrl->setParameterByClass(
'ilPermissionGUI',
'ref_id', $public_room_ref);
180 else if($ilCtrl->getCmdClass() ==
'ilpermissiongui' &&
$_REQUEST[
'ref_id'] == $admin_ref)
182 $commandParts[0] =
'perm_settings';
183 $ilCtrl->setParameterByClass(
'ilPermissionGUI',
'ref_id', $admin_ref);
186 $this->buildTabs($ilTabs, $config, $commandParts);
187 $this->activateTab($commandParts, $config);
195 public function getTabsForCommand($command)
204 $stopCommands = array(
'create');
206 if(in_array($command, $stopCommands))
211 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
217 'link' => $ilCtrl->getLinkTarget($this->gui,
'view'),
218 'permission' =>
'read'
222 'link' => $ilCtrl->getLinkTarget($this->gui,
'history-byday'),
223 'permission' =>
'read',
224 'enabled' => $room ? $room->getSetting(
'enable_history') :
false,
227 'lng' =>
'history_by_day',
228 'link' => $ilCtrl->getLinkTarget($this->gui,
'history-byday'),
229 'permission' =>
'read'
231 'bysession' => array(
232 'lng' =>
'history_by_session',
233 'link' => $ilCtrl->getLinkTarget($this->gui,
'history-bysession'),
234 'permission' =>
'read'
239 'lng' =>
'info_short',
240 'link' => $ilCtrl->getLinkTargetByClass(array(get_class($this->gui),
'ilinfoscreengui'),
'info'),
241 'permission' =>
'read'
245 'link' => $ilCtrl->getLinkTarget($this->gui,
'settings-general'),
246 'permission' =>
'write',
249 'lng' =>
'settings_general',
250 'link' => $ilCtrl->getLinkTarget($this->gui,
'settings-general'),
251 'permission' =>
'write'
257 'link' => $ilCtrl->getLinkTarget($this->gui,
'ban-show'),
258 'permission' =>
'moderate',
261 'lng' =>
'bans_table',
262 'link' => $ilCtrl->getLinkTarget($this->gui,
'ban-show'),
263 'permission' =>
'moderate'
268 'lng' =>
'permissions',
269 'link' => $ilCtrl->getLinkTargetByClass(
'ilpermissiongui',
'perm'),
270 'permission' =>
'write'
274 $commandParts = explode(
'_', $command, 2);
276 if($ilCtrl->getCmdClass() ==
'ilpermissiongui')
278 $commandParts[0] =
'perm';
281 $this->buildTabs($ilTabs, $config, $commandParts);
282 $this->activateTab($commandParts, $config);
292 private function buildTabs(
ilTabsGUI $tabs, $config, $command)
299 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
300 foreach($config as $id => $tabDefinition)
306 else if(isset($tabDefinition[
'enabled']) && !$tabDefinition[
'enabled'])
311 $tabs->
addTab($id, $this->
getLabel($tabDefinition, $id), $tabDefinition[
'link']);
313 if($command[0] == $id && isset($tabDefinition[
'subtabs']) &&
314 is_array($tabDefinition[
'subtabs'])
317 foreach($tabDefinition[
'subtabs'] as $subid => $subTabDefinition)
319 if(!$rbacsystem->checkAccess($subTabDefinition[
'permission'], $this->gui->getRefId()))
323 else if(isset($subTabDefinition[
'enabled']) && !$subTabDefinition[
'enabled'])
328 $subid, $this->
getLabel($subTabDefinition, $subid),
329 $subTabDefinition[
'link']
347 if(isset($tabDefinition[
'lng']))
348 return $this->lng->txt($tabDefinition[
'lng']);
350 return $this->lng->txt($id);
360 return strtolower(preg_replace(
'/(.*?)-(.*?)/',
'$1_$2', $value));
371 $tokens = (array)explode(
'_', $value);
374 foreach($tokens as $token)
376 $value .= ucfirst($token);
379 if($upper_case_first === FALSE)
381 $value = strtolower($value, 0, 1) . substr($value, 1);