ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUIHookProcessor.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
14  var $append = array();
15  var $prepend = array();
16  var $replace = "";
17 
24  function __construct($a_comp, $a_part, $a_pars)
25  {
26  global $ilPluginAdmin;
27 
28  include_once("./Services/UIComponent/classes/class.ilUIHookPluginGUI.php");
29 
30  // user interface hook [uihk]
31  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
32  $this->replaced = false;
33  foreach ($pl_names as $pl)
34  {
35  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
36  $gui_class = $ui_plugin->getUIClassInstance();
37  $resp = $gui_class->getHTML($a_comp, $a_part, $a_pars);
38 
39  if ($resp["mode"] != ilUIHookPluginGUI::KEEP)
40  {
41  switch($resp["mode"])
42  {
44  $this->prepend[] = $resp["html"];
45  break;
46 
48  $this->append[] = $resp["html"];
49  break;
50 
52  if (!$this->replaced)
53  {
54  $this->replace = $resp["html"];
55  $this->replaced = true;
56  }
57  break;
58  }
59  }
60  }
61  }
62 
68  function replaced()
69  {
70  return $this->replaced;
71  }
72 
79  function getHTML($html)
80  {
81  if ($this->replaced)
82  {
83  $html = $this->replace;
84  }
85  foreach ($this->append as $a)
86  {
87  $html.= $a;
88  }
89  foreach ($this->prepend as $p)
90  {
91  $html = $p.$html;
92  }
93  return $html;
94  }
95 
96 }
97 
98 ?>