/**
  * Returns connector
  *
  * Instantiates ilChatroomServerConnector with server settings and
  * returns it.
  *
  * @return ilChatroomServerConnector
  */
 public function getConnector()
 {
     require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
     require_once 'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
     require_once 'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
     //$settings = new ilChatroomServerSettings();
     $settings = ilChatroomAdmin::getDefaultConfiguration()->getServerSettings();
     $connector = new ilChatroomServerConnector($settings);
     return $connector;
 }
 /**
  * @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();
 }
Ejemplo n.º 3
0
 /**
  * @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());
 }