/** * @return string */ public function getHTML() { ilYuiUtil::initJson(); $chatSetting = new ilSetting('chatroom'); if ($this->getCurrentDetailLevel() == 0 || !$chatSetting->get('chat_enabled', 0) || !(bool) @ilChatroomServerConnector::checkServerConnection()) { return ''; } else { return parent::getHTML(); } }
/** * @return bool */ public static function checkServerConnection() { require_once 'Modules/Chatroom/classes/class.ilChatroomAdmin.php'; $settings = ilChatroomAdmin::getDefaultConfiguration()->getServerSettings(); $connector = new ilChatroomServerConnector($settings); return $connector->isServerAlive(); }
/** * @param ilPropertyFormGUI $form */ public function clientsettings(ilPropertyFormGUI $form = null) { /** * @var $tpl ilTemplate * @var $ilCtrl ilCtrl * @var $lng ilLanguage */ global $tpl, $ilCtrl, $lng; ilChatroom::checkUserPermissions('read', $this->gui->ref_id); $this->defaultActions(); $this->gui->switchToVisibleMode(); $this->showSoapWarningIfNeeded(); require_once 'Modules/Chatroom/classes/class.ilChatroomAdmin.php'; $adminSettings = new ilChatroomAdmin($this->gui->object->getId()); if ($form === null) { require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php'; $factory = new ilChatroomFormFactory(); $form = $factory->getClientSettingsForm(); if (!$this->commonSettings->get('soap_user_administration')) { $form->getItemByPostVar('chat_enabled')->setDisabled(!(bool) $this->commonSettings->get('soap_user_administration')); $form->getItemByPostVar('chat_enabled')->setChecked(0); } $data = (array) $adminSettings->loadClientSettings(); if (!$data['osd_intervall']) { $data['osd_intervall'] = 60; } if (!$data) { $data = array(); } if (!$data['url']) { $data['url'] = ilUtil::_getHttpPath(); } if (!$data['client']) { $data['client'] = CLIENT_ID; } $data['password_retype'] = $data['password']; $form->setValuesByArray($data); } require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php'; $serverSettings = (array) $adminSettings->loadGeneralSettings(); if ($serverSettings['port'] && $serverSettings['address'] && !(bool) @ilChatroomServerConnector::checkServerConnection()) { ilUtil::sendInfo($lng->txt('chat_cannot_connect_to_server')); } $form->setTitle($lng->txt('general_settings_title')); $form->addCommandButton('view-saveClientSettings', $lng->txt('save')); $form->setFormAction($ilCtrl->getFormAction($this->gui, 'view-saveClientSettings')); $settingsTpl = new ilTemplate('tpl.chatroom_serversettings.html', true, true, 'Modules/Chatroom'); $settingsTpl->setVariable('VAL_SERVERSETTINGS_FORM', $form->getHTML()); $settingsTpl->setVariable('LBL_SERVERSETTINGS_FURTHER_INFORMATION', sprintf($lng->txt('server_further_information'), ilUtil::_getHttpPath() . '/Modules/Chatroom/server/README.txt')); $tpl->setVariable('ADM_CONTENT', $settingsTpl->get()); }
public function getServerStatus() { require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php'; echo array('server_alive' => (bool) @ilChatroomServerConnector::checkServerConnection()); }