24 $this->lng = $DIC->language();
25 $this->ctrl = $DIC->ctrl();
30 $this->
setId(
"cmpspl");
32 $this->
addColumn($this->lng->txt(
"cmps_plugin"), self::F_PLUGIN_NAME);
33 $this->
addColumn($this->lng->txt(
"id"), self::F_PLUGIN_ID);
34 $this->
addColumn($this->lng->txt(
"cmps_plugin_slot"), self::F_SLOT_NAME);
35 $this->
addColumn($this->lng->txt(
"cmps_component"), self::F_COMPONENT_NAME);
36 $this->
addColumn($this->lng->txt(
"active"), self::F_PLUGIN_ACTIVE);
37 $this->
addColumn($this->lng->txt(
"action"));
42 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
44 "tpl.plugin_overview_row.html",
62 $active_filters = array_filter($this->filter_data,
static function ($value) :
bool {
63 return !empty($value);
66 $plugins = array_filter($plugins,
static function (array $plugin_data) use ($active_filters) :
bool {
67 $matches_filter =
true;
68 if (isset($active_filters[self::F_PLUGIN_NAME])) {
69 $matches_filter = strpos($plugin_data[self::F_PLUGIN_NAME], $active_filters[self::F_PLUGIN_NAME]) !==
false;
71 if (isset($active_filters[self::F_PLUGIN_ID])) {
72 $matches_filter = strpos($plugin_data[self::F_PLUGIN_ID], $active_filters[self::F_PLUGIN_ID]) !==
false;
74 if (isset($active_filters[self::F_PLUGIN_ACTIVE])) {
75 $v = (int)$active_filters[self::F_PLUGIN_ACTIVE] === 1;
76 $matches_filter = $plugin_data[self::F_PLUGIN_ACTIVE] === $v && $matches_filter;
78 if (isset($active_filters[self::F_SLOT_NAME])) {
79 $matches_filter = in_array($plugin_data[self::F_SLOT_NAME], $active_filters[self::F_SLOT_NAME],
true) && $matches_filter;
81 if (isset($active_filters[self::F_COMPONENT_NAME])) {
82 $matches_filter = in_array($plugin_data[
'component_type'] .
'/' . $plugin_data[
'component_name'], $active_filters[self::F_COMPONENT_NAME],
true) && $matches_filter;
85 return $matches_filter;
106 protected function addPluginData(array &$plugins, array $core_items,
string $core_type)
108 foreach ($core_items as $core_item) {
110 foreach ($plugin_slots as $plugin_slot) {
111 $slot =
new ilPluginSlot($core_type, $core_item[
"subdir"], $plugin_slot[
"id"]);
112 foreach ($slot->getPluginsInformation() as
$plugin) {
113 if ($core_type && $slot && $core_item[
"subdir"] && is_array(
$plugin) && count(
$plugin) > 0) {
131 if (!$a_plugin[
"component_type"]) {
134 $plugin_db_data =
ilPlugin::getPluginRecord($a_plugin[
"component_type"], $a_plugin[self::F_COMPONENT_NAME], $a_plugin[
"slot_id"], $a_plugin[
"name"]);
136 $config_class = null;
145 "component_type" => $a_type,
146 self::F_COMPONENT_NAME => $a_slot_subdir,
148 self::F_PLUGIN_ID => $a_plugin[
"id"],
149 self::F_PLUGIN_NAME => $a_plugin[
"name"],
150 "must_install" => $a_plugin[
"must_install"],
151 self::F_PLUGIN_ACTIVE => $a_plugin[
"is_active"],
152 "activation_possible" => $a_plugin[
"activation_possible"],
153 "needs_update" => $a_plugin[
"needs_update"],
154 "config_class" => $config_class,
155 "has_lang" => (bool)
sizeof(
166 $rbacsystem = $DIC->rbac()->system();
168 $this->tpl->setVariable(
"TXT_SLOT_NAME", $a_set[self::F_SLOT_NAME]);
169 $this->tpl->setVariable(
171 $a_set[
"component_type"] .
"/" . $a_set[self::F_COMPONENT_NAME]
174 if ($a_set[self::F_PLUGIN_ACTIVE]) {
175 $this->tpl->setCurrentBlock(
"active");
176 $this->tpl->setVariable(
"TXT_ACTIVE", $this->lng->txt(
"yes"));
177 $this->tpl->parseCurrentBlock();
179 $this->tpl->setCurrentBlock(
"inactive");
180 $this->tpl->setVariable(
"TXT_INACTIVE", $this->lng->txt(
"no"));
181 $this->tpl->parseCurrentBlock();
184 $this->tpl->setVariable(
"TXT_PLUGIN_NAME", $a_set[self::F_PLUGIN_NAME]);
185 $this->tpl->setVariable(
"TXT_PLUGIN_ID", $a_set[self::F_PLUGIN_ID]);
187 if ($rbacsystem->checkAccess(
'write',
$_GET[
'ref_id'])) {
189 $this->tpl->setVariable(
"ACTION_SELECTOR", $this->
getActionMenu($actions, $a_set[self::F_PLUGIN_ID]));
198 protected function getActionMenu(array $actions,
string $plugin_id) : string
201 $alist->setId($plugin_id);
202 $alist->setListTitle($this->lng->txt(
"actions"));
204 foreach ($actions as $caption => $cmd) {
205 $alist->addItem($caption,
"", $cmd);
208 return $alist->getHTML();
220 $this->ctrl->setParameter($this->parent_obj, self::F_PLUGIN_ID, $a_set[self::F_PLUGIN_ID]);
222 $this->ctrl->setParameter($this->parent_obj, self::F_PLUGIN_ID, null);
224 if ($a_set[
"must_install"]) {
227 if ($a_set[
"config_class"]) {
228 $actions[$this->lng->txt(
"cmps_configure")]
232 if ($a_set[
"has_lang"]) {
236 if ($a_set[self::F_PLUGIN_ACTIVE]) {
240 if ($a_set[
"activation_possible"]) {
245 if ($a_set[
"needs_update"]) {
276 $actions[$this->lng->txt($caption)]
277 = $this->ctrl->getLinkTarget($this->parent_obj, $command);
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct(ilObjComponentSettingsGUI $a_parent_obj, array $filter_data, string $a_parent_cmd="")
getSlotName()
Get Slot Name.
setParameter(array $a_set)
static getAvailableLangFiles(string $a_lang_directory)
Get array of all language files in the plugin.
getActionMenu(array $actions, string $plugin_id)
const CMD_DEACTIVATE_PLUGIN
getActionMenuEntries(array $a_set)
const CMD_CONFIRM_UNINSTALL_PLUGIN
static getPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
gatherPluginData(string $a_type, ilPluginSlot $a_slot, string $a_slot_subdir, array $a_plugin)
const CMD_ACTIVATE_PLUGIN
static getAvailableCoreServices()
Get all available core services.
static hasConfigureClass(string $a_slot_dir, array $plugin_data, array $plugin_db_data)
Has the plugin a configure class?
addPluginData(array &$plugins, array $core_items, string $core_type)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static getConfigureClassName(array $plugin_data)
Get plugin configure class name.
TableGUI class for components listing.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Components (Modules, Services, Plugins) Settings.
__construct(Container $dic, ilPlugin $plugin)
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.
getPluginsDirectory()
Get directory of.
setEnableHeader($a_enableheader)
Set Enable Header.
setLimit($a_limit=0, $a_default_limit=0)
static getAvailableCoreModules()
Get all available core modules.
static lookupPluginSlots($a_type, $a_name)
Lookup all plugin slots of a component.
addCommandToActions(array &$actions, string $caption, string $command)
const CMD_REFRESH_LANGUAGES