ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilService.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2008 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
24
25include_once("./Services/Component/classes/class.ilComponent.php");
26
36abstract class ilService extends ilComponent
37{
43 final public static function getComponentType()
44 {
45 return IL_COMP_SERVICE;
46 }
47
53 final public function getName()
54 {
55 // class is always il<ModuleName>Service
56 $class = get_class($this);
57
58 return substr($class, 2, strlen($class) - 9);
59 }
60
69 final public static function getAvailableCoreServices()
70 {
71 $services_dir = ILIAS_ABSOLUTE_PATH . "/Services";
72
73 if (!@is_dir($services_dir)) {
74 return array();
75 }
76
77 // read current directory
78 $dir = opendir($services_dir);
79
80 $services = array();
81 while ($file = readdir($dir)) {
82 if ($file != "." and
83 $file != "..") {
84 // directories
85 if (@is_dir($services_dir . "/" . $file)) {
86 if (@is_file($services_dir . "/" . $file . "/service.xml")) {
87 $services[] = array("subdir" => $file);
88 }
89 }
90 }
91 }
92 return $services;
93 }
94}
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
ILIAS Service (A service provides cross-sectional functionalities, used by other components)
getName()
Get Name.
static getAvailableCoreServices()
Get all available core services.
static getComponentType()
Get Component Type.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file