36 require_once
'classes/class.ilObjectGUI.php';
46 public function __construct($a_data,$a_id,$a_call_by_reference =
true, $a_prepare_output =
true)
49 #define('ILIAS_MODULE','chat');
51 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output);
53 $this->lng->loadLanguageModule(
'chat');
58 $next_class = $this->ctrl->getNextClass($this);
59 $cmd = $this->ctrl->getCmd();
64 case 'ilpermissiongui':
65 include_once(
'Services/AccessControl/classes/class.ilPermissionGUI.php');
67 $ret =& $this->ctrl->forwardCommand($perm_gui);
78 if(!$this->object->server_conf->isAlive())
82 $this->lng->txt(
'chat_cannot_connect_to_server') .
83 (
$cmd !=
'edit' ?
' ' . $this->lng->txt(
'check_configuration') :
'')
98 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
100 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'update'));
102 if($this->object->server_conf->isAlive() or $this->
object->server_conf->getActiveStatus())
106 $sec_cd->setTitle($this->lng->txt(
'chat_ilias'));
107 $this->form_gui->addItem($sec_cd);
111 1 => $this->lng->txt(
'chat_active'),
112 0 => $this->lng->txt(
'chat_inactive')
116 $this->form_gui->addItem($sel);
118 # else if(!$this->object->server_conf->isAlive() && $this->ctrl->getCmd() != 'update')
120 # ilUtil::sendFailure($this->lng->txt('chat_cannot_connect_to_server'));
125 $sec_l->setTitle($this->lng->txt(
'chat_server_settings'));
126 $this->form_gui->addItem($sec_l);
129 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_internal_ip'),
'chat_internal_ip');
132 $inp->setMaxLength(128);
133 $this->form_gui->addItem($inp);
136 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_external_ip'),
'chat_external_ip');
139 $inp->setMaxLength(128);
140 $this->form_gui->addItem($inp);
143 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_port'),
'chat_port');
146 $inp->setMaxLength(5);
147 $this->form_gui->addItem($inp);
150 $chb =
new ilCheckboxInputGUI($this->lng->txt(
'chat_server_ssl_settings'),
'chat_ssl_status');
152 $chb->setChecked(
false);
153 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_ssl_port'),
'chat_ssl_port');
155 $inp->setMaxLength(5);
156 $chb->addSubItem($inp);
157 $this->form_gui->addItem($chb);
160 $inp =
new ilPasswordInputGUI($this->lng->txt(
'chat_moderator_password'),
'chat_moderator');
163 $inp->setMaxLength(16);
164 $this->form_gui->addItem($inp);
167 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_logfile'),
'chat_logfile');
169 $inp->setMaxLength(256);
170 $this->form_gui->addItem($inp);
173 $sel =
new ilSelectInputGUI($this->lng->txt(
'chat_server_loglevel'),
'chat_loglevel');
175 1 => $this->lng->txt(
'chat_level_fatal'),
176 2 => $this->lng->txt(
'chat_level_error'),
177 3 => $this->lng->txt(
'chat_level_info'),
178 5 => $this->lng->txt(
'chat_level_debug'),
179 6 => $this->lng->txt(
'chat_level_all')
183 $this->form_gui->addItem($sel);
186 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_server_allowed'),
'chat_allowed');
187 $inp->
setInfo($this->lng->txt(
'chat_server_allowed_b'));
188 $inp->setRequired(
true);
190 $inp->setMaxLength(256);
191 $this->form_gui->addItem($inp);
195 $sec_cd->setTitle($this->lng->txt(
'chat_general_settings'));
196 $this->form_gui->addItem($sec_cd);
201 $ro =
new ilRadioOption($this->lng->txt(
'chat_sound_status_activate'), 1);
203 $chb->setOptionTitle($this->lng->txt(
'chat_new_invitation_sound_status'));
204 $chb->setChecked(
false);
206 $chb =
new ilCheckBoxInputGUI(
'',
'chat_new_message_sound_status');
207 $chb->setOptionTitle($this->lng->txt(
'chat_new_message_sound_status'));
208 $chb->setChecked(
false);
211 $ro =
new ilRadioOption($this->lng->txt(
'chat_sound_status_deactivate'), 0);
213 $this->form_gui->addItem($rg);
216 $rg =
new ilRadioGroupInputGUI($this->lng->txt(
'chat_message_notify'),
'chat_message_notify_status');
218 $ro =
new ilRadioOption($this->lng->txt(
'chat_message_notify_activate'), 1);
220 $ro =
new ilRadioOption($this->lng->txt(
'chat_message_notify_deactivate'), 0);
222 $this->form_gui->addItem($rg);
227 $ro =
new ilRadioOption($this->lng->txt(
'chat_smilies_activate'), 1);
229 $ro =
new ilRadioOption($this->lng->txt(
'chat_smilies_deactivate'), 0);
231 $this->form_gui->addItem($rg);
235 $ro =
new ilRadioOption($this->lng->txt(
'chat_export_all'), 0);
237 $ro =
new ilRadioOption($this->lng->txt(
'chat_export_moderator'), 1);
239 $rg->
setInfo($this->lng->txt(
'chat_export_info'));
240 $this->form_gui->addItem($rg);
243 $inp =
new ilTextInputGUI($this->lng->txt(
'chat_export_period'),
'chat_export_period');
244 $inp->
setInfo($this->lng->txt(
'chat_export_period_info'));
245 $inp->setValidationRegexp(
'/[1-9][0-9]{0,2}/');
246 $inp->setRequired(
true);
248 $inp->setMaxLength(3);
249 $this->form_gui->addItem($inp);
251 $this->form_gui->addCommandButton(
'update', $this->lng->txt(
'save'));
252 $this->form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
265 if(!$rbacsystem->checkAccess(
'write', $this->ref_id))
267 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
272 include_once
"Modules/Chat/classes/class.ilChatSmilies.php";
275 $keywordscheck = count($keywords) > 0;
277 if(!$this->form_gui->checkInput())
279 $this->tabs_gui->setTabActive(
'edit_smilies');
280 $this->form_gui->setValuesByPost();
281 $this->tpl->setContent($this->form_gui->getHtml());
284 $pathinfo = pathinfo($_FILES[
"chat_image_path"][
"name"]);
285 $target_file = md5(time() + $pathinfo[
'basename']).
".".$pathinfo[
'extension'];
290 $ilCtrl->redirect($this,
"editSmilies");
295 $this->tabs_gui->setTabActive(
'edit_smilies');
296 if(!$rbacsystem->checkAccess(
'write', $this->ref_id)) {
297 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
300 $items = $_REQUEST[
"smiley_id"];
302 if (count($items) == 0)
305 $ilCtrl->redirect($this,
"editSmilies");
308 include_once
'Modules/Chat/classes/class.ilChatSmilies.php';
311 $tpl =
new ilTemplate(
"tpl.chat_smilies_delete_multiple_confirm.html",
true,
true,
"Modules/Chat");
312 $tpl->setVariable(
"SMILIES_DELETE_INTRO", $lng->txt(
'chat_confirm_delete_smiley'));
313 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
'submit'));
314 $tpl->setVariable(
"TXT_CANCEL", $lng->txt(
'cancel'));
315 $tpl->setVariable(
"SMILIES_IDS", join(
",", $items));
316 $tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this,
'update'));
320 foreach($smilies as $s) {
321 $tpl->setCurrentBlock(
"smilies_list");
322 $tpl->setVariable(
"SMILEY_PATH", $s[
"smiley_fullpath"]);
323 $tpl->setVariable(
"SMILEY_KEYWORDS", $s[
"smiley_keywords"]);
324 $tpl->setVariable(
"ROW_CNT", ($i++ % 2) + 1);
325 $tpl->parseCurrentBlock();
327 $this->tpl->setContent(
$tpl->get());
334 if(!$rbacsystem->checkAccess(
'write', $this->ref_id)) {
335 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
338 $ids = $_REQUEST[
"sel_ids"];
339 $parts = explode(
",", $ids);
341 if (count($parts) == 0)
343 $ilCtrl->redirect($this,
"editSmilies");
346 include_once
"Modules/Chat/classes/class.ilChatSmilies.php";
349 $ilCtrl->redirect($this,
"editSmilies");
354 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
356 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=".$_REQUEST[
"_table_nav"] :
"";
357 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'update'). $table_nav);
361 $sec_l->setTitle($this->lng->txt(
'chat_add_smiley'));
362 $this->form_gui->addItem($sec_l);
366 $this->form_gui->addItem($inp);
368 $inp =
new ilTextAreaInputGUI($this->lng->txt(
'chat_smiley_keywords'),
'chat_smiley_keywords');
370 $inp->setUseRte(
false);
371 $inp->setInfo($this->lng->txt(
'chat_smiley_keywords_one_per_line_note'));
372 $this->form_gui->addItem($inp);
375 $this->form_gui->addCommandButton(
'uploadSmiley', $this->lng->txt(
'chat_upload_smiley'));
381 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
384 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=".$_REQUEST[
"_table_nav"] :
"";
386 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'update') . $table_nav);
390 $sec_l->setTitle($this->lng->txt(
'chat_edit_smiley'));
391 $this->form_gui->addItem($sec_l);
393 include_once
"Modules/Chat/classes/class.ilChatSmiliesCurrentSmileyFormElement.php";
396 $this->form_gui->addItem($inp);
400 $inp->setInfo($this->lng->txt(
'chat_smiley_image_only_if_changed'));
401 $this->form_gui->addItem($inp);
403 $inp =
new ilTextAreaInputGUI($this->lng->txt(
'chat_smiley_keywords'),
'chat_smiley_keywords');
405 $inp->setRequired(
true);
406 $inp->setInfo($this->lng->txt(
'chat_smiley_keywords_one_per_line_note'));
407 $this->form_gui->addItem($inp);
410 $this->form_gui->addItem($inp);
412 $this->form_gui->addCommandButton(
'editSmilies', $this->lng->txt(
'cancel'));
413 $this->form_gui->addCommandButton(
'updateSmilies', $this->lng->txt(
'submit'));
423 $data[
'chat_internal_ip'] = $this->
object->server_conf->getInternalIp();
424 $data[
'chat_external_ip'] = $this->
object->server_conf->getExternalIp();
425 $data[
'chat_port'] = $this->
object->server_conf->getPort();
426 $data[
'chat_ssl_status'] = $this->
object->server_conf->getSSLStatus();
427 $data[
'chat_ssl_port'] = $this->
object->server_conf->getSSLPort();
428 $data[
'chat_moderator'] = $this->
object->server_conf->getModeratorPassword();
429 $data[
'chat_moderator_retype'] = $this->
object->server_conf->getModeratorPassword();
430 $data[
'chat_logfile'] = $this->
object->server_conf->getLogfile();
431 $data[
'chat_loglevel'] = $this->
object->server_conf->getLogLevel();
432 $data[
'chat_allowed'] = $this->
object->server_conf->getAllowedHosts();
433 $data[
'chat_active'] = $this->
object->server_conf->getActiveStatus();
434 $data[
'chat_new_invitation_sound_status'] = (bool)$ilSetting->get(
'chat_new_invitation_sound_status');
435 $data[
'chat_new_message_sound_status'] = (bool)$ilSetting->get(
'chat_new_message_sound_status');
436 $data[
'chat_sound_status'] = (int)$ilSetting->get(
'chat_sound_status');
437 $data[
'chat_message_notify_status'] = (int) $ilSetting->get(
'chat_message_notify_status');
438 $data[
'chat_smilies_status'] = (int)$ilSetting->get(
'chat_smilies_status');
439 $data[
'chat_export_status'] = (int)$ilSetting->get(
'chat_export_status');
440 $data[
'chat_export_period'] = (int)$ilSetting->get(
'chat_export_period');
442 $this->form_gui->setValuesByArray(
$data);
449 $this->tabs_gui->setTabActive(
'settings');
451 if(!$rbacsystem->checkAccess(
'read', $this->ref_id))
453 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE);
456 if(null === $this->form_gui)
462 $this->tpl->setContent($this->form_gui->getHTML());
467 $this->tabs_gui->setTabActive(
'edit_smilies');
469 if(!$rbacsystem->checkAccess(
'read', $this->ref_id)) {
470 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE);
474 include_once
"Modules/Chat/classes/class.ilChatSmilies.php";
477 "chat_smiley_id" => $smiley[
"smiley_id"],
478 "chat_smiley_keywords" => $smiley[
"smiley_keywords"],
479 "chat_current_smiley_image_path" => $smiley[
"smiley_fullpath"],
481 $this->form_gui->setValuesByArray($form_data);
483 $tpl =
new ilTemplate(
"tpl.chat_edit_smilies.html",
true,
true,
"Modules/Chat");
484 $tpl->setVariable(
"SMILEY_FORM", $this->form_gui->getHTML());
486 $this->tpl->setContent(
$tpl->get());
491 $this->tabs_gui->setTabActive(
'edit_smilies');
493 if(!$rbacsystem->checkAccess(
'write', $this->ref_id)) {
494 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
497 $tpl =
new ilTemplate(
"tpl.chat_smiley_confirm_delete.html",
true,
true,
"Modules/Chat");
498 $tpl->setVariable(
"TXT_CONFIRM_DELETE_SMILEY", $lng->txt(
'chat_confirm_delete_smiley'));
499 $tpl->setVariable(
"TXT_CONFIRM_DELETE", $lng->txt(
'submit'));
500 $tpl->setVariable(
"TXT_CANCEL_DELETE", $lng->txt(
'cancel'));
501 $tpl->setVariable(
"SMILEY_ID", $_REQUEST[
"smiley_id"]);
504 include_once
'Modules/Chat/classes/class.ilChatSmilies.php';
507 $tpl->setVariable(
"SMILEY_PATH", $smiley[
"smiley_fullpath"]);
508 $tpl->setVariable(
"SMILEY_KEYWORDS", $smiley[
"smiley_keywords"]);
510 $table_nav = $_REQUEST[
"_table_nav"] ?
"&_table_nav=".$_REQUEST[
"_table_nav"] :
"";
512 $tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this). $table_nav);
514 $tpl->parseCurrentBlock();
515 $this->tpl->setContent(
$tpl->get());
521 if(!$rbacsystem->checkAccess(
'write', $this->ref_id)) {
522 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
524 include_once
'Modules/Chat/classes/class.ilChatSmilies.php';
528 $ilCtrl->redirect($this,
"editSmilies");
535 $this->tabs_gui->setTabActive(
'edit_smilies');
537 if(!$rbacsystem->checkAccess(
'read', $this->ref_id)) {
538 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE);
540 include_once
'Modules/Chat/classes/class.ilChatSmilies.php';
544 include_once
"Modules/Chat/classes/class.ilChatSmiliesGUI.php";
547 $tpl =
new ilTemplate(
"tpl.chat_edit_smilies.html",
true,
true,
"Modules/Chat");
548 $tpl->setVariable(
"SMILEY_TABLE", $table);
549 $tpl->setVariable(
"SMILEY_FORM", $this->form_gui->getHTML());
551 $this->tpl->setContent(
$tpl->get());
557 if(!$rbacsystem->checkAccess(
'write', $this->ref_id)) {
558 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
562 include_once
"Modules/Chat/classes/class.ilChatSmilies.php";
565 $keywordscheck = count($keywords) > 0;
567 if(!$this->form_gui->checkInput() || !$keywordscheck) {
568 $this->tabs_gui->setTabActive(
'edit_properties');
569 $this->form_gui->setValuesByPost();
570 $this->tpl->setContent($this->form_gui->getHtml());
575 $data[
"smiley_keywords"] = join(
"\n", $keywords);
576 $data[
"smiley_id"] = $_REQUEST[
"chat_smiley_id"];
578 if ($_FILES[
"chat_image_path"]) {
580 $data[
"smiley_path"] = $_FILES[
"chat_image_path"][
"name"];
586 $ilCtrl->redirect($this,
"editSmilies");
593 if(!$rbacsystem->checkAccess(
'write', $this->ref_id))
595 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'), $this->ilias->error_obj->MESSAGE);
598 $this->tabs_gui->setTabActive(
'settings');
601 if(!$this->form_gui->checkInput())
603 $this->form_gui->setValuesByPost();
604 $this->tpl->setContent($this->form_gui->getHtml());
612 $this->
object->server_conf->setSSLStatus((
int)
$_POST[
'chat_ssl_status'] ? 1 : 0);
614 $this->
object->server_conf->setModeratorPassword(
ilUtil::stripSlashes($_POST[
'chat_moderator']));
619 $this->
object->server_conf->validate();
621 $ilSetting->set(
'chat_sound_status', (
int)$_POST[
'chat_sound_status']);
622 $ilSetting->set(
'chat_new_invitation_sound_status', (
int)$_POST[
'chat_new_invitation_sound_status']);
623 $ilSetting->set(
'chat_new_message_sound_status', (
int)$_POST[
'chat_new_message_sound_status']);
624 $ilSetting->set(
'chat_message_notify_status', (
int)$_POST[
'chat_message_notify_status']);
625 $ilSetting->set(
'chat_smilies_status', (
int)$_POST[
'chat_smilies_status']);
626 $ilSetting->set(
'chat_export_status', (
int)$_POST[
'chat_export_status']);
627 $ilSetting->set(
'chat_export_period', (
int)$_POST[
'chat_export_period']);
629 $this->
object->server_conf->setActiveStatus((
bool)$_POST[
'chat_active']);
630 $this->
object->server_conf->updateStatus();
632 if(!$this->object->server_conf->update())
635 $this->form_gui->setValuesByPost();
636 $this->tpl->setContent($this->form_gui->getHtml());
641 $this->form_gui->setValuesByPost();
656 global $rbacsystem,$rbacreview;
658 $this->ctrl->setParameter($this,
'ref_id',$this->object->getRefId());
660 if($rbacsystem->checkAccess(
'read',$this->object->getRefId()))
662 $force_active = (
$_GET[
'cmd'] ==
'' ||
$_GET[
'cmd'] ==
'view')
665 $tabs_gui->addTarget(
'chat_rooms',
666 $this->ctrl->getLinkTarget($this,
'view'), array(
'view',
''), get_class($this),
669 if($rbacsystem->checkAccess(
'write',$this->object->getRefId()))
671 $force_active_edit = (
$_GET[
"cmd"] ==
"edit") ?
true :
false;
672 $force_active_smilies = (
$_GET[
"cmd"] ==
"edit") ?
true :
false;
673 $tabs_gui->addTarget(
"settings", $this->ctrl->getLinkTarget($this,
"edit"),
"edit", get_class($this),
"", $force_active_edit);
674 $tabs_gui->addTarget(
"edit_smilies", $this->ctrl->getLinkTarget($this,
"editSmilies"),
"edit_smilies", get_class($this),
"", $force_active_smilies);
676 if($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
678 $tabs_gui->addTarget(
'perm_settings',
679 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');