ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
43  final static function getComponentType()
44  {
45  return IL_COMP_SERVICE;
46  }
47 
53  final 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 static function getAvailableCoreServices()
70  {
71  $services_dir = ILIAS_ABSOLUTE_PATH."/Services";
72 
73  if (!@is_dir($services_dir))
74  {
75  return array();
76  }
77 
78  // read current directory
79  $dir = opendir($services_dir);
80 
81  $services = array();
82  while($file = readdir($dir))
83  {
84  if ($file != "." and
85  $file != "..")
86  {
87  // directories
88  if (@is_dir($services_dir."/".$file))
89  {
90  if (@is_file($services_dir."/".$file."/service.xml"))
91  {
92  $services[] = array("subdir" => $file);
93  }
94  }
95  }
96  }
97  return $services;
98  }
99 }
100 ?>