ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilRepositoryObjectPluginSlot.php
Go to the documentation of this file.
1<?php
2
25{
26 // Adds objects that can be created to the add new object list array
27 public static function addCreatableSubObjects(array $a_obj_array): array
28 {
29 global $DIC;
30
31 $component_repository = $DIC["component.repository"];
32 $plugins = $component_repository->getPluginSlotById("robj")->getActivePlugins();
33 foreach ($plugins as $plugin) {
34 $pl_id = $plugin->getId();
35 $a_obj_array[$pl_id] = ["name" => $pl_id, "lng" => $pl_id, "plugin" => true];
36 }
37
38 return $a_obj_array;
39 }
40
41 // Checks whether a repository type is a plugin or not
42 public static function isTypePlugin(
43 string $a_type,
44 bool $a_active_status = true
45 ): bool {
46 global $DIC;
47
48 $component_repository = $DIC["component.repository"];
49
50 if (!$component_repository->hasPluginId($a_type)) {
51 return false;
52 }
53
54 if (!$a_active_status) {
55 return true;
56 }
57
58 $plugin = $component_repository->getPluginById($a_type);
59 return $plugin->isActive();
60 }
61
62 // Check whether a repository type is a plugin which has active learning progress
63 public static function isTypePluginWithLP(
64 string $a_type,
65 bool $a_active_status = true
66 ): bool {
67 global $DIC;
68 $component_repository = $DIC["component.repository"];
69
70 if (!$component_repository->hasPluginId($a_type)) {
71 return false;
72 }
73 $slot = $component_repository->getPluginSlotById("robj");
74 if ($slot->hasPluginId($a_type)) {
75 $plugin = $slot->getPluginById($a_type);
76 if (!$a_active_status || $plugin->isActive()) {
77 if ($plugin->supportsLearningProgress()) {
78 return true;
79 }
80 }
81 }
82 return false;
83 }
84}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isTypePlugin(string $a_type, bool $a_active_status=true)
static isTypePluginWithLP(string $a_type, bool $a_active_status=true)
global $DIC
Definition: shib_login.php:26