ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAppEventHandler.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 
56 {
60  function __construct()
61  {
62  // this information should be determined by service/module
63  // xml files in the future
64  $this->listener["Services/News"] = array("Modules/Forum");
65  $this->listener['Modules/Group'] = array('Services/Calendar');
66  $this->listener['Modules/Session'] = array('Services/Calendar');
67  $this->listener['Modules/Course'] = array('Services/Calendar','Services/WebServices/ECS','Services/ContainerReference');
68  $this->listener['Modules/Category'] = array('Services/ContainerReference');
69  $this->listener['Modules/RemoteCourse'] = array('Services/WebServices/ECS');
70  $this->listener["Services/Object"] = array("Services/Tagging",'Services/Search',
71  'Modules/MediaPool');
72  $this->listener['Services/Authentication'] = array();
73  }
74 
75 
83  function raise($a_component, $a_event, $a_parameter = "")
84  {
85  if (is_array($this->listener[$a_component]))
86  {
87  foreach ($this->listener[$a_component] as $listener)
88  {
89  // Allow listeners like Services/WebServices/ECS
90  $last_slash = strripos($listener,'/');
91  $comp = substr($listener,0,$last_slash);
92  $class = 'il'.substr($listener,$last_slash + 1).'AppEventListener';
93  $file = "./".$listener."/classes/class.".$class.".php";
94 
95  // detemine class and file
96  #$comp = explode("/", $listener);
97  #$class = "il".$comp[1]."AppEventListener";
98  #$file = "./".$listener."/classes/class.".$class.".php";
99 
100  // if file exists, call listener
101  if (is_file($file))
102  {
103  include_once($file);
104  call_user_func(array($class, 'handleEvent'), $a_component, $a_event, $a_parameter);
105  }
106  }
107  }
108 
109  // get all event hook plugins and forward the event to them
110  include_once("./Services/Component/classes/class.ilPluginAdmin.php");
111  $plugins = ilPluginAdmin::getActivePluginsForSlot("Services", "EventHandling", "evhk");
112  foreach ($plugins as $pl)
113  {
114  $plugin = ilPluginAdmin::getPluginObject("Services", "EventHandling",
115  "evhk", $pl);
116  $plugin->handleEvent($a_component, $a_event, $a_parameter);
117  }
118 
119  }
120 }
121 ?>