ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChatroomServerSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
14 {
15 
16  private $port = '8585';
17  private $protocol = 'http://';
18  private $domain = '192.168.1.94';
19  private $instance = '123456';
20 
26  public function getPort()
27  {
28  return $this->port;
29  }
30 
36  public function setPort($port)
37  {
38  $this->port = $port;
39  }
40 
46  public function getProtocol()
47  {
48  return $this->protocol;
49  }
50 
56  public function setProtocol($protocol)
57  {
58  $this->protocol = $protocol . '://';
59  }
60 
66  public function getDomain()
67  {
68  return $this->domain;
69  }
70 
76  public function setDomain($domain)
77  {
78  $this->domain = $domain;
79  }
80 
89  public function getURL($action, $scope)
90  {
91  return $this->getBaseURL() .
92  '/backend/' . $action . '/' . $this->getInstance() . '/' . $scope;
93  }
94 
103  public function getBaseURL()
104  {
105  return $this->getProtocol() . $this->getDomain() . ':' . $this->getPort();
106  }
107 
113  public function getInstance()
114  {
115  return $this->instance;
116  }
117 
123  public function setInstance($instance)
124  {
125  $this->instance = $instance;
126  }
127 
128  public function setSmiliesEnabled($a_bool) {
129  $this->smilies_enabled = $a_bool;
130  }
131 
132  public function getSmiliesEnabled() {
133  return (bool) $this->smilies_enabled;
134  }
135 
136  public static function loadDefault() {
137  global $ilDB;
138 
139  $query = 'SELECT * FROM chatroom_admconfig';
140  $rset = $ilDB->query($query);
141  $row = $ilDB->fetchAssoc($rset);
142 
143  $client_settings = json_decode($row['client_settings']);
144  $server_settings = json_decode($row['server_settings']);
145 
146  $settings = new ilChatroomServerSettings();
147  $settings->setPort($server_settings->port);
148  $settings->setProtocol($server_settings->protocol);
149  $settings->setInstance($client_settings->name);
150  $settings->setDomain($server_settings->address);
151  $settings->setSmiliesEnabled($client_settings->enable_smilies);
152  return $settings;
153  }
154 
155 }
156 
157 ?>