ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilRepositoryObjectPlugin Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilRepositoryObjectPlugin:
+ Collaboration diagram for ilRepositoryObjectPlugin:

Public Member Functions

 getParentTypes ()
 
 allowCopy ()
 decides if this repository plugin can be copied More...
 
 useOrguPermissions ()
 Decide if this repository plugin uses OrgUnit Permissions. More...
 
 getPrefix ()
 
- Public Member Functions inherited from ilPlugin
 getMessage ()
 
 __construct (\ilDBInterface $db, \ilComponentRepositoryWrite $component_repository, string $id)
 
 getPluginName ()
 
 getId ()
 
 getVersion ()
 Only very little classes seem to care about this: More...
 
 getDirectory ()
 Only very little classes seem to care about this: More...
 
 isActive ()
 Only very little classes seem to care about this: More...
 
 needsUpdate ()
 
 install ()
 
 uninstall ()
 
 activate ()
 This will update (if required) and activate the plugin. More...
 
 deactivate ()
 
 update ()
 
 loadLanguageModule ()
 Load language module for plugin. More...
 
 txt (string $a_var)
 Get Language Variable (prefix will be prepended automatically) More...
 
 getTemplate (string $a_template, bool $a_par1=true, bool $a_par2=true)
 @deprecate ILIAS is moving towards UI components and plugins are expected to use these components. More...
 
 getStyleSheetLocation (string $a_css_file)
 @deprecate ILIAS is moving towards UI components and plugins are expected to use these components. More...
 
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 @deprecate ILIAS is moving towards UI components and plugins are expected to use these components. More...
 
 getGlobalScreenProviderCollection ()
 
 exchangeUIRendererAfterInitialization (\ILIAS\DI\Container $dic)
 This methods allows to replace the UI Renderer (see src/UI) of ILIAS after initialization by returning a closure returning a custom renderer. More...
 
 exchangeUIFactoryAfterInitialization (string $dic_key, \ILIAS\DI\Container $dic)
 This methods allows to replace some factory for UI Components (see src/UI) of ILIAS after initialization by returning a closure returning a custom factory. More...
 

Static Public Member Functions

static _getImagePath (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
 Only very little classes seem to care about this: More...
 
static _getIcon (string $a_type)
 
static _getName (string $a_id)
 

Protected Member Functions

 beforeActivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 beforeUninstallCustom ()
 
 uninstallCustom ()
 
 beforeUninstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead. More...
 
- Protected Member Functions inherited from ilPlugin
 init ()
 Object initialization. More...
 
 getPluginInfo ()
 
 getComponentInfo ()
 
 getPluginSlotInfo ()
 
 afterInstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the install method in your subclass instead. More...
 
 beforeUninstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead. More...
 
 afterUninstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead. More...
 
 beforeActivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 afterActivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 afterDeactivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 updateDatabase ()
 
 beforeUpdate ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the update method in your subclass instead. More...
 
 afterUpdate ()
 
 getLanguageHandler ()
 
 buildLanguageHandler ()
 

Protected Attributes

ilLanguage $lng
 
- Protected Attributes inherited from ilPlugin
ilDBInterface $db
 
ilComponentRepositoryWrite $component_repository
 
string $id
 
ilPluginLanguage $language_handler = null
 
bool $lang_initialised = false
 
ProviderCollection $provider_collection
 
string $message = ''
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Abstract parent class for all repository object plugin classes.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilRepositoryObjectPlugin.php.

Member Function Documentation

◆ _getIcon()

static ilRepositoryObjectPlugin::_getIcon ( string  $a_type)
static

Reimplemented in ilOrgUnitExtensionPlugin.

Definition at line 68 of file class.ilRepositoryObjectPlugin.php.

68 : string
69 {
70 global $DIC;
71 $component_repository = $DIC["component.repository"];
74 "Repository",
75 "robj",
76 $component_repository->getPluginById($a_type)->getName(),
77 "icon_" . $a_type . ".svg"
78 );
79 }
ilComponentRepositoryWrite $component_repository
static _getImagePath(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
Only very little classes seem to care about this:
getPluginById(string $id)
Get a plugin by id.
global $DIC
Definition: shib_login.php:26

References ilPlugin\$component_repository, $DIC, _getImagePath(), ilComponentRepository\getPluginById(), and ilComponentInfo\TYPES.

+ Here is the call graph for this function:

◆ _getImagePath()

static ilRepositoryObjectPlugin::_getImagePath ( string  $a_ctype,
string  $a_cname,
string  $a_slot_id,
string  $a_pname,
string  $a_img 
)
static

Only very little classes seem to care about this:

  • Services/Repository/classes/class.ilRepositoryObjectPlugin.php
  • Modules/OrgUnit/classes/Extension/class.ilOrgUnitExtensionPlugin.php
Parameters
string$a_ctype
string$a_cname
string$a_slot_id
string$a_pname
string$a_img
Returns
string

Definition at line 41 of file class.ilRepositoryObjectPlugin.php.

41 : string
42 {
43 global $DIC;
44
45 $img = ilUtil::getImagePath($a_img);
46 if (is_int(strpos($img, "Customizing"))) {
47 return $img;
48 }
49
50 $component_repository = $DIC["component.repository"];
51
53 $component = $component_repository->getComponentByTypeAndName($a_ctype, $a_cname);
54
55 $d2 = $component->getId() . "_" . $a_slot_id . "_" . $plugin->getId();
56
57 $img = ilUtil::getImagePath($d2 . "/" . $a_img);
58 if (is_int(strpos($img, "Customizing"))) {
59 return $img;
60 }
61
62 $d = $plugin->getPath();
63 return $d . "/templates/images/" . $a_img;
64 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getPluginByName(string $name)
Get a plugin by name.
getComponentByTypeAndName(string $type, string $name)
Get a component by type and name.

References ilPlugin\$component_repository, Vendor\Package\$d, $DIC, XapiProxy\$plugin, ilComponentRepository\getComponentByTypeAndName(), ilUtil\getImagePath(), and ilComponentRepository\getPluginByName().

Referenced by ilOrgUnitExtensionPlugin\_getIcon(), and _getIcon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getName()

static ilRepositoryObjectPlugin::_getName ( string  $a_id)
static

Reimplemented in ilOrgUnitExtensionPlugin.

Definition at line 81 of file class.ilRepositoryObjectPlugin.php.

81 : string
82 {
83 global $DIC;
84 $component_repository = $DIC["component.repository"];
86 return "";
87 }
88 return $component_repository->getPluginById($a_id)->getName();
89 }
hasPluginId(string $id)
Check if a plugin exists.

References ilPlugin\$component_repository, $DIC, ilComponentRepository\getPluginById(), and ilComponentRepository\hasPluginId().

+ Here is the call graph for this function:

◆ allowCopy()

ilRepositoryObjectPlugin::allowCopy ( )

decides if this repository plugin can be copied

Definition at line 228 of file class.ilRepositoryObjectPlugin.php.

228 : bool
229 {
230 return false;
231 }

Referenced by beforeActivation().

+ Here is the caller graph for this function:

◆ beforeActivation()

ilRepositoryObjectPlugin::beforeActivation ( )
protected

@deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead.

Reimplemented from ilPlugin.

Definition at line 91 of file class.ilRepositoryObjectPlugin.php.

91 : bool
92 {
94
95 // before activating, we ensure, that the type exists in the ILIAS
96 // object database and that all permissions exist
97 $type = $this->getId();
98
99 if (strpos($type, "x") !== 0) {
100 throw new ilPluginException("Object plugin type must start with an x. Current type is " . $type . ".");
101 }
102
103 // check whether type exists in object data, if not, create the type
104 $set = $ilDB->query(
105 "SELECT * FROM object_data " .
106 " WHERE type = " . $ilDB->quote("typ", "text") .
107 " AND title = " . $ilDB->quote($type, "text")
108 );
109 if ($rec = $ilDB->fetchAssoc($set)) {
110 $t_id = $rec["obj_id"];
111 } else {
112 $t_id = $ilDB->nextId("object_data");
113 $ilDB->manipulate("INSERT INTO object_data " .
114 "(obj_id, type, title, description, owner, create_date, last_update) VALUES (" .
115 $ilDB->quote($t_id, "integer") . "," .
116 $ilDB->quote("typ", "text") . "," .
117 $ilDB->quote($type, "text") . "," .
118 $ilDB->quote("Plugin " . $this->getPluginName(), "text") . "," .
119 $ilDB->quote(-1, "integer") . "," .
120 $ilDB->quote(ilUtil::now(), "timestamp") . "," .
121 $ilDB->quote(ilUtil::now(), "timestamp") .
122 ")");
123 }
124
125 // add rbac operations
126 // 1: edit_permissions, 2: visible, 3: read, 4:write, 6:delete
127 $ops = [1, 2, 3, 4, 6];
128 if ($this->allowCopy()) {
130 }
131 foreach ($ops as $op) {
132 // check whether type exists in object data, if not, create the type
133 $set = $ilDB->query(
134 "SELECT * FROM rbac_ta " .
135 " WHERE typ_id = " . $ilDB->quote($t_id, "integer") .
136 " AND ops_id = " . $ilDB->quote($op, "integer")
137 );
138 if (!$ilDB->fetchAssoc($set)) {
139 $ilDB->manipulate("INSERT INTO rbac_ta " .
140 "(typ_id, ops_id) VALUES (" .
141 $ilDB->quote($t_id, "integer") . "," .
142 $ilDB->quote($op, "integer") .
143 ")");
144 }
145 }
146
147 // now add creation permission, if not existing
148 $set = $ilDB->query(
149 "SELECT * FROM rbac_operations " .
150 " WHERE class = " . $ilDB->quote("create", "text") .
151 " AND operation = " . $ilDB->quote("create_" . $type, "text")
152 );
153 if ($rec = $ilDB->fetchAssoc($set)) {
154 $create_ops_id = $rec["ops_id"];
155 } else {
156 $create_ops_id = $ilDB->nextId("rbac_operations");
157 $ilDB->manipulate("INSERT INTO rbac_operations " .
158 "(ops_id, operation, description, class) VALUES (" .
159 $ilDB->quote($create_ops_id, "integer") . "," .
160 $ilDB->quote("create_" . $type, "text") . "," .
161 $ilDB->quote("create " . $type, "text") . "," .
162 $ilDB->quote("create", "text") .
163 ")");
164 }
165
166 // assign creation operation to root, cat, crs, grp and fold
167 $par_types = $this->getParentTypes();
168 foreach ($par_types as $par_type) {
169 $set = $ilDB->query(
170 "SELECT obj_id FROM object_data " .
171 " WHERE type = " . $ilDB->quote("typ", "text") .
172 " AND title = " . $ilDB->quote($par_type, "text")
173 );
174 if (($rec = $ilDB->fetchAssoc($set)) && $rec["obj_id"] > 0) {
175 $set = $ilDB->query(
176 "SELECT * FROM rbac_ta " .
177 " WHERE typ_id = " . $ilDB->quote($rec["obj_id"], "integer") .
178 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")
179 );
180 if (!$ilDB->fetchAssoc($set)) {
181 $ilDB->manipulate("INSERT INTO rbac_ta " .
182 "(typ_id, ops_id) VALUES (" .
183 $ilDB->quote($rec["obj_id"], "integer") . "," .
184 $ilDB->quote($create_ops_id, "integer") .
185 ")");
186 }
187 }
188 }
189
190 return true;
191 }
ilDBInterface $db
static _getOperationIdByName(string $a_operation)
get operation id by name of operation
allowCopy()
decides if this repository plugin can be copied
static now()
Return current timestamp in Y-m-d H:i:s format.

References ilPlugin\$db, $ilDB, ilRbacReview\_getOperationIdByName(), allowCopy(), ilPlugin\getId(), getParentTypes(), and ilUtil\now().

+ Here is the call graph for this function:

◆ beforeUninstall()

ilRepositoryObjectPlugin::beforeUninstall ( )
finalprotected

@deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead.

Reimplemented from ilPlugin.

Definition at line 202 of file class.ilRepositoryObjectPlugin.php.

202 : bool
203 {
204 if ($this->beforeUninstallCustom()) {
205 $rep_util = new ilRepUtil();
206 $rep_util->deleteObjectType($this->getId());
207
208 // custom database tables may be needed by plugin repository object
209 $this->uninstallCustom();
210
211 return true;
212 }
213 return false;
214 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References beforeUninstallCustom(), ilPlugin\getId(), and uninstallCustom().

+ Here is the call graph for this function:

◆ beforeUninstallCustom()

ilRepositoryObjectPlugin::beforeUninstallCustom ( )
protected

Definition at line 193 of file class.ilRepositoryObjectPlugin.php.

193 : bool
194 {
195 // plugin-specific
196 // false would indicate that anything went wrong
197 return true;
198 }

Referenced by beforeUninstall().

+ Here is the caller graph for this function:

◆ getParentTypes()

ilRepositoryObjectPlugin::getParentTypes ( )
Returns
string[]

Reimplemented in ilOrgUnitExtensionPlugin.

Definition at line 219 of file class.ilRepositoryObjectPlugin.php.

219 : array
220 {
221 $par_types = ["root", "cat", "crs", "grp", "fold"];
222 return $par_types;
223 }

Referenced by beforeActivation().

+ Here is the caller graph for this function:

◆ getPrefix()

ilRepositoryObjectPlugin::getPrefix ( )

Definition at line 241 of file class.ilRepositoryObjectPlugin.php.

241 : string
242 {
243 $lh = $this->getLanguageHandler();
244 return $lh->getPrefix();
245 }

References ilPlugin\getLanguageHandler().

+ Here is the call graph for this function:

◆ uninstallCustom()

ilRepositoryObjectPlugin::uninstallCustom ( )
abstractprotected

Referenced by beforeUninstall().

+ Here is the caller graph for this function:

◆ useOrguPermissions()

ilRepositoryObjectPlugin::useOrguPermissions ( )

Decide if this repository plugin uses OrgUnit Permissions.

Definition at line 236 of file class.ilRepositoryObjectPlugin.php.

236 : bool
237 {
238 return false;
239 }

Field Documentation

◆ $lng

ilLanguage ilRepositoryObjectPlugin::$lng
protected

Definition at line 26 of file class.ilRepositoryObjectPlugin.php.


The documentation for this class was generated from the following file: