ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilECSServerSettings.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
25
35{
36 private static $instance = null;
37
38 private $servers = array();
39
40
44 protected function __construct()
45 {
46 $this->readActiveServers();
47 }
48
54 public static function getInstance()
55 {
56 if (self::$instance) {
57 return self::$instance;
58 }
59 return self::$instance = new ilECSServerSettings();
60 }
61
66 public function activeServerExists()
67 {
68 return count($this->getServers()) ? true : false;
69 }
70
75 public function serverExists()
76 {
77 return count($this->getServers()) ? true : false;
78 }
79
84 public function getServers()
85 {
86 return (array) $this->servers;
87 }
88
93 public function readInactiveServers()
94 {
95 global $DIC;
96
97 $ilDB = $DIC['ilDB'];
98
99 $query = 'SELECT server_id FROM ecs_server ' .
100 'WHERE active = ' . $ilDB->quote(0, 'integer') . ' ' .
101 'ORDER BY title ';
102 $res = $ilDB->query($query);
103
104 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
105 $this->servers[$row->server_id] = ilECSSetting::getInstanceByServerId($row->server_id);
106 }
107 }
108
113 private function readActiveServers()
114 {
115 global $DIC;
116
117 $ilDB = $DIC['ilDB'];
118
119 $query = 'SELECT server_id FROM ecs_server ' .
120 'WHERE active = ' . $ilDB->quote(1, 'integer') . ' ' .
121 'ORDER BY title ';
122 $res = $ilDB->query($query);
123
124 $this->servers = array();
125 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
126 $this->servers[$row->server_id] = ilECSSetting::getInstanceByServerId($row->server_id);
127 }
128 }
129}
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
Collection of ECS settings.
readActiveServers()
Read all actice servers @global ilDB $ilDB.
readInactiveServers()
Read inactive servers @global ilDB $ilDB.
serverExists()
Check if there is any server.
__construct()
Singleton contructor.
static getInstance()
Get singleton instance.
activeServerExists()
Check if there is any active server.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB