ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
25 include_once("./Services/Component/classes/class.ilComponent.php");
26 
36 abstract class ilService extends ilComponent
37 {
41  final public function getComponentType() : string
42  {
43  return IL_COMP_SERVICE;
44  }
45 
51  final public function getName()
52  {
53  // class is always il<ModuleName>Service
54  $class = get_class($this);
55 
56  return substr($class, 2, strlen($class) - 9);
57  }
58 
67  final public static function getAvailableCoreServices()
68  {
69  $services_dir = ILIAS_ABSOLUTE_PATH . "/Services";
70 
71  if (!@is_dir($services_dir)) {
72  return array();
73  }
74 
75  // read current directory
76  $dir = opendir($services_dir);
77 
78  $services = array();
79  while ($file = readdir($dir)) {
80  if ($file != "." and
81  $file != "..") {
82  // directories
83  if (@is_dir($services_dir . "/" . $file)) {
84  if (@is_file($services_dir . "/" . $file . "/service.xml")) {
85  $services[] = array("subdir" => $file);
86  }
87  }
88  }
89  }
90  return $services;
91  }
92 }
getName()
Get Name.
static getAvailableCoreServices()
Get all available core services.
ILIAS Service (A service provides cross-sectional functionalities, used by other components) ...
const IL_COMP_SERVICE