ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilPluginsOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("Services/Table/classes/class.ilTable2GUI.php");
5include_once("Services/Component/classes/class.ilComponent.php");
6
7
17{
18 private $mode;
19
20 function __construct($a_parent_obj, $a_parent_cmd = "")
21 {
22 global $ilCtrl, $lng;
23
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25
26 $this->setId("cmpspl");
27
28 $this->addColumn($lng->txt("cmps_plugin"), "plugin_name");
29 $this->addColumn($lng->txt("id"), "plugin_id");
30 $this->addColumn($lng->txt("cmps_plugin_slot"), "slot_name");
31 $this->addColumn($lng->txt("cmps_component"), "component_name");
32 $this->addColumn($lng->txt("active"), "plugin_active");
33 $this->addColumn($lng->txt("action"));
34
35 $this->setDefaultOrderField("plugin_name");
36
37 $this->setEnableHeader(true);
38 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39 $this->setRowTemplate("tpl.plugin_overview_row.html",
40 "Services/Component");
41 $this->getComponents();
42 $this->setLimit(10000);
43
44 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
45 }
46
50 function getComponents()
51 {
52 $plugins = array();
53
54 include_once("./Services/Component/classes/class.ilModule.php");
56 foreach ($modules as $m)
57 {
59 $m["subdir"]);
60 foreach ($plugin_slots as $ps)
61 {
62 include_once("./Services/Component/classes/class.ilPluginSlot.php");
63 $slot = new ilPluginSlot(IL_COMP_MODULE, $m["subdir"], $ps["id"]);
64 foreach ($slot->getPluginsInformation() as $p)
65 {
66 $plugins[] = $this->gatherPluginData(IL_COMP_MODULE, $slot, $m["subdir"], $p);
67 }
68 }
69 }
70 include_once("./Services/Component/classes/class.ilService.php");
72 foreach ($services as $s)
73 {
75 $s["subdir"]);
76 foreach ($plugin_slots as $ps)
77 {
78 $slot = new ilPluginSlot(IL_COMP_SERVICE, $s["subdir"], $ps["id"]);
79 foreach ($slot->getPluginsInformation() as $p)
80 {
81 $plugins[] = $this->gatherPluginData(IL_COMP_SERVICE, $slot, $s["subdir"], $p);
82 }
83 }
84 }
85 $this->setData($plugins);
86 }
87
97 protected function gatherPluginData($a_type, ilPluginSlot $a_slot, $a_slot_subdir, array $a_plugin)
98 {
99 global $ilCtrl;
100
101 $conf = false;
102 if(ilPlugin::hasConfigureClass($a_slot->getPluginsDirectory(), $a_plugin["name"]) &&
103 $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($a_plugin["name"])))
104 {
105 $conf = true;
106 }
107
108 return array("slot_name" => $a_slot->getSlotName(),
109 "component_type" => $a_type,
110 "component_name" => $a_slot_subdir,
111 "slot_id" => $a_slot->getSlotId(),
112 "plugin_id" => $a_plugin["id"],
113 "plugin_name" => $a_plugin["name"],
114 "plugin_active" => $a_plugin["is_active"],
115 "activation_possible" => $a_plugin["activation_possible"],
116 "needs_update" => $a_plugin["needs_update"],
117 "has_conf" => $conf,
118 "has_lang" => (bool)sizeof(ilPlugin::getAvailableLangFiles(
119 $a_slot->getPluginsDirectory()."/".$a_plugin["name"]."/lang")));
120 }
121
126 protected function fillRow($a_set)
127 {
128 global $ilCtrl, $lng;
129
130 // actions
131
132 $ilCtrl->setParameter($this->parent_obj, "ctype", $a_set["component_type"]);
133 $ilCtrl->setParameter($this->parent_obj, "cname", $a_set["component_name"]);
134 $ilCtrl->setParameter($this->parent_obj, "slot_id", $a_set["slot_id"]);
135
136 $action = array();
137
138 $ilCtrl->setParameter($this->parent_obj, "plugin_id", $a_set["plugin_id"]);
139 $action[$lng->txt("info")] = $ilCtrl->getLinkTarget($this->parent_obj, "showPlugin");
140 $ilCtrl->setParameter($this->parent_obj, "plugin_id", "");
141
142 $ilCtrl->setParameter($this->parent_obj, "pname", $a_set["plugin_name"]);
143
144 if ($a_set["plugin_active"])
145 {
146 if ($a_set["has_lang"])
147 {
148 $action[$lng->txt("cmps_refresh")] =
149 $ilCtrl->getLinkTarget($this->parent_obj, "refreshLanguages");
150 }
151
152 if ($a_set["has_conf"])
153 {
154 $action[$lng->txt("cmps_configure")] =
155 $ilCtrl->getLinkTargetByClass(strtolower(ilPlugin::getConfigureClassName($a_set["plugin_name"])), "configure");
156 }
157
158 $action[$lng->txt("cmps_deactivate")] =
159 $ilCtrl->getLinkTarget($this->parent_obj, "deactivatePlugin");
160 }
161 else if ($a_set["activation_possible"])
162 {
163 $action[$lng->txt("cmps_activate")] =
164 $ilCtrl->getLinkTarget($this->parent_obj, "activatePlugin");
165 }
166
167 // update button
168 if ($a_set["needs_update"])
169 {
170 $action[$lng->txt("cmps_update")] =
171 $ilCtrl->getLinkTarget($this->parent_obj, "updatePlugin");
172 }
173
174 // #17428
175 $action[$lng->txt("cmps_uninstall")] =
176 $ilCtrl->getLinkTarget($this->parent_obj, "confirmUninstallPlugin");
177
178 $ilCtrl->setParameter($this->parent_obj, "pname", "");
179
180 if(sizeof($action))
181 {
182 $alist = new ilAdvancedSelectionListGUI();
183 $alist->setId($a_set["plugin_id"]);
184 $alist->setListTitle($lng->txt("actions"));
185
186 foreach($action as $caption => $cmd)
187 {
188 $alist->addItem($caption, "", $cmd);
189 }
190
191 $this->tpl->setVariable("ACTION_SELECTOR", $alist->getHTML());
192 }
193
194 $this->tpl->setVariable("TXT_SLOT_NAME", $a_set["slot_name"]);
195 $this->tpl->setVariable("TXT_COMP_NAME",
196 $a_set["component_type"]."/".$a_set["component_name"]);
197
198 $act_str = ($a_set["plugin_active"])
199 ? "<b>".$lng->txt("yes")."</b>"
200 : $lng->txt("no");
201 $this->tpl->setVariable("TXT_PLUGIN_NAME", $a_set["plugin_name"]);
202 $this->tpl->setVariable("TXT_PLUGIN_ID", $a_set["plugin_id"]);
203 $this->tpl->setVariable("TXT_ACTIVE", $act_str);
204 }
205}
206
207?>
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
const IL_COMP_MODULE
User interface class for advanced drop-down selection lists.
static lookupPluginSlots($a_type, $a_name)
Lookup all plugin slots of a component.
static getAvailableCoreModules()
Get all available core modules.
getSlotId()
Get Slot ID.
getPluginsDirectory()
Get directory of.
getSlotName()
Get Slot Name.
static getAvailableLangFiles($a_lang_directory)
Get array of all language files in the plugin.
static getConfigureClassName($a_name)
Get plugin configure class name.
static hasConfigureClass($a_slot_dir, $a_name)
Has the plugin a configure class?
TableGUI class for components listing.
fillRow($a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
gatherPluginData($a_type, ilPluginSlot $a_slot, $a_slot_subdir, array $a_plugin)
Process plugin data for table row.
static getAvailableCoreServices()
Get all available core services.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
$cmd
Definition: sahs_server.php:35
$a_type
Definition: workflow.php:93