ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPluginsOverviewGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 include_once("Services/Component/classes/class.ilComponent.php");
6 
7 
17 {
18  private $mode;
19 
20  function ilComponentsTableGUI($a_parent_obj, $a_parent_cmd = "",
21  $a_mode = IL_COMP_MODULE)
22  {
23  global $ilCtrl, $lng;
24 
25  $this->mode = $a_mode;
26 
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28 
29  if ($this->mode == IL_COMP_MODULE)
30  {
31  $this->addColumn($lng->txt("cmps_module"));
32  $this->addColumn($lng->txt("cmps_rep_object"));
33  }
34  else
35  {
36  $this->addColumn($lng->txt("cmps_service"));
37  }
38  $this->addColumn($lng->txt("cmps_plugin_slot"));
39  $this->setEnableHeader(true);
40  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
41  $this->setRowTemplate("tpl.table_row_component.html",
42  "Services/Component");
43  $this->getComponents();
44  $this->setDefaultOrderField("subdir");
45  $this->setLimit(10000);
46 
47  // save options command
48  $this->addCommandButton("saveOptions", $lng->txt("cmps_save_options"));
49 
50  if ($this->mode == IL_COMP_MODULE)
51  {
52  $this->setTitle($lng->txt("cmps_modules"));
53  }
54  else
55  {
56  $this->setTitle($lng->txt("cmps_services"));
57  }
58  }
59 
63  function getComponents()
64  {
65  if ($this->mode == IL_COMP_MODULE)
66  {
67  include_once("./Services/Component/classes/class.ilModule.php");
69  $this->setData($modules);
70  }
71  else
72  {
73  include_once("./Services/Component/classes/class.ilService.php");
75  $this->setData($services);
76  }
77  }
78 
83  protected function fillRow($a_set)
84  {
85  global $lng, $ilCtrl, $ilSetting, $objDefinition;
86 
87  // plugin slots
88  $plugin_slots = ilComponent::lookupPluginSlots($this->mode, $a_set["subdir"]);
89 
90  foreach ($plugin_slots as $slot)
91  {
92  $this->tpl->setCurrentBlock("slot");
93  $this->tpl->setVariable("SLOT_NAME", $slot["name"]);
94  $this->tpl->setVariable("SLOT_ID", $slot["id"]);
95  $this->tpl->setVariable("TXT_DIR", $lng->txt("cmps_dir"));
96  $this->tpl->setVariable("SLOT_DIR", $slot["dir_pres"]);
97  $this->tpl->setVariable("TXT_LANG_PREFIX", $lng->txt("cmps_lang_prefix"));
98  $this->tpl->setVariable("LANG_PREFIX", $slot["lang_prefix"]);
99 
100  $ilCtrl->setParameter($this->parent_obj, "ctype", $this->mode);
101  $ilCtrl->setParameter($this->parent_obj, "cname", $a_set["subdir"]);
102  $ilCtrl->setParameter($this->parent_obj, "slot_id", $slot["id"]);
103  $this->tpl->setVariable("HREF_SHOW_SLOT",
104  $ilCtrl->getLinkTarget($this->parent_obj, "showPluginSlot"));
105  $this->tpl->setVariable("TXT_SHOW_SLOT", $lng->txt("cmps_show_details"));
106  $this->tpl->parseCurrentBlock();
107  }
108 
109 
110  // repository object types
111  if ($this->mode == IL_COMP_MODULE)
112  {
113  $rep_types =
114  $objDefinition->getRepositoryObjectTypesForComponent(IL_COMP_MODULE, $a_set["subdir"]);
115 
116  foreach ($rep_types as $rt)
117  {
118  // group
119  if ($rt["grp"] != "")
120  {
121  $this->tpl->setCurrentBlock("group");
122  $this->tpl->setVariable("TXT_GROUP", $lng->txt("cmps_group"));
123  $gi = $objDefinition->getGroup($rt["grp"]);
124  $this->tpl->setVariable("VAL_GROUP", $gi["name"]);
125  $this->tpl->setVariable("VAL_GROUP_ID", $rt["grp"]);
126  $this->tpl->parseCurrentBlock();
127  }
128 
129  $this->tpl->setCurrentBlock("rep_object");
130  $this->tpl->setVariable("TXT_REP_OBJECT",
131  $rt["class_name"]);
132  $this->tpl->setVariable("TXT_REP_OBJECT_ID",
133  $rt["id"]);
134  $this->tpl->setVariable("IMG_REP_OBJECT",
135  ilUtil::getImagePath("icon_".$rt["id"].".gif"));
136 
137  // add new position
138  $this->tpl->setVariable("TXT_ADD_NEW_POS",
139  $lng->txt("cmps_add_new_rank"));
140  $this->tpl->setVariable("VAR_POS",
141  "obj_pos[".$rt["id"]."]");
142  $pos = ($ilSetting->get("obj_add_new_pos_".$rt["id"]) > 0)
143  ? $ilSetting->get("obj_add_new_pos_".$rt["id"])
144  : $rt["default_pos"];
145  $this->tpl->setVariable("VAL_POS",
147 
148  // disable creation
149  $this->tpl->setVariable("TXT_DISABLE_CREATION",
150  $lng->txt("cmps_disable_creation"));
151  $this->tpl->setVariable("VAR_DISABLE_CREATION",
152  "obj_dis_creation[".$rt["id"]."]");
153  if ($ilSetting->get("obj_dis_creation_".$rt["id"]))
154  {
155  $this->tpl->setVariable("CHECKED_DISABLE_CREATION",
156  ' checked="checked" ');
157  }
158 
159  $this->tpl->parseCurrentBlock();
160  }
161  $this->tpl->setCurrentBlock("rep_object_td");
162  if (count($rep_types) == 0)
163  {
164  $this->tpl->setVariable("DUMMY", "&nbsp;");
165  }
166  $this->tpl->parseCurrentBlock();
167  }
168 
169  $this->tpl->setVariable("TXT_MODULE_NAME", $a_set["subdir"]);
170  }
171 
172 }
173 ?>