ILIAS  release_8 Revision v8.24
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 ()
 
 readEventListening ()
 
 clearEventListening ()
 

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 69 of file class.ilRepositoryObjectPlugin.php.

69 : string
70 {
71 global $DIC;
72 $component_repository = $DIC["component.repository"];
75 "Repository",
76 "robj",
77 $component_repository->getPluginById($a_type)->getName(),
78 "icon_" . $a_type . ".svg"
79 );
80 }
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:
global $DIC
Definition: feed.php:28
getPluginById(string $id)
Get a plugin by id.

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

+ 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:

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
64 return $d . "/templates/images/" . $a_img;
65 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$img
Definition: imgupload.php:83
getPluginByName(string $name)
Get a plugin by name.
getComponentByTypeAndName(string $type, string $name)
Get a component by type and name.

References ilPlugin\$component_repository, $d, $DIC, $img, 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 82 of file class.ilRepositoryObjectPlugin.php.

82 : string
83 {
84 global $DIC;
85 $component_repository = $DIC["component.repository"];
87 return "";
88 }
89 return $component_repository->getPluginById($a_id)->getName();
90 }
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 229 of file class.ilRepositoryObjectPlugin.php.

229 : bool
230 {
231 return false;
232 }

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 92 of file class.ilRepositoryObjectPlugin.php.

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

References ilPlugin\$db, $ilDB, $type, 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 203 of file class.ilRepositoryObjectPlugin.php.

203 : bool
204 {
205 if ($this->beforeUninstallCustom()) {
206 $rep_util = new ilRepUtil();
207 $rep_util->deleteObjectType($this->getId());
208
209 // custom database tables may be needed by plugin repository object
210 $this->uninstallCustom();
211
212 return true;
213 }
214 return false;
215 }
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 194 of file class.ilRepositoryObjectPlugin.php.

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

Referenced by beforeUninstall().

+ Here is the caller graph for this function:

◆ getParentTypes()

ilRepositoryObjectPlugin::getParentTypes ( )
Returns
string[]

Reimplemented in ilOrgUnitExtensionPlugin.

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

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

Referenced by beforeActivation().

+ Here is the caller graph for this function:

◆ getPrefix()

ilRepositoryObjectPlugin::getPrefix ( )

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

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

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 237 of file class.ilRepositoryObjectPlugin.php.

237 : bool
238 {
239 return false;
240 }

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: