ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilRepositoryObjectPlugin Class Reference

Abstract parent class for all repository object plugin classes. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getComponentType ()
 Get Component Type. More...
 
 getComponentName ()
 Get Component Name. More...
 
 getSlot ()
 Get Slot Name. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 getParentTypes ()
 
 allowCopy ()
 decides if this repository plugin can be copied More...
 
 useOrguPermissions ()
 Decide if this repository plugin uses OrgUnit Permissions. More...
 
- Public Member Functions inherited from ilPlugin
 __construct ()
 
 getComponentType ()
 Get Component Type. More...
 
 getComponentName ()
 Get Component Name. More...
 
 getSlot ()
 Get Slot Name. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 getPluginName ()
 Get Plugin Name. More...
 
 getId ()
 
 getLastUpdateVersion ()
 Get Version of last update. More...
 
 getVersion ()
 
 getIliasMinVersion ()
 
 getIliasMaxVersion ()
 Get Required ILIAS max. More...
 
 getActive ()
 
 setDBVersion (int $a_dbversion)
 
 getDBVersion ()
 
 writeDBVersion (int $a_dbversion)
 
 getDirectory ()
 Get Plugin Directory. More...
 
 includeClass ($a_class_file_name)
 Include (once) a class file. More...
 
 getPrefix ()
 Get plugin prefix, used for lang vars. More...
 
 getTablePrefix ()
 Get db table plugin prefix. More...
 
 updateLanguages ($a_lang_keys=null)
 
 updateDatabase ()
 Update database. More...
 
 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)
 gets a ilTemplate instance of a html-file in the plugin /templates More...
 
 getImagePath (string $a_img)
 Get image path. More...
 
 getStyleSheetLocation (string $a_css_file)
 
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 Add template content to placeholder variable. More...
 
 isActive ()
 Check whether plugin is active. More...
 
 needsUpdate ()
 Check whether update is needed. More...
 
 install ()
 
 activate ()
 Activate. More...
 
 deactivate ()
 Deactivate. More...
 
 uninstall ()
 
 update ()
 Update plugin. More...
 
 promoteGlobalScreenProvider ()
 
 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 _getIcon ($a_type, $a_size)
 Get Icon. More...
 
static _getName ($a_id)
 Get class name. More...
 
- Static Public Member Functions inherited from ilPlugin
static _getDirectory (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 Get plugin directory. More...
 
static getAvailableLangFiles (string $a_lang_directory)
 Get array of all language files in the plugin. More...
 
static hasConfigureClass (string $a_slot_dir, array $plugin_data, array $plugin_db_data)
 Has the plugin a configure class? More...
 
static getConfigureClassName (array $plugin_data)
 Get plugin configure class name. More...
 
static getDBUpdateScriptName (string $a_ctype, string $a_cname, string $a_slot_name, string $a_pname)
 
static lookupTxt (string $a_mod_prefix, string $a_pl_id, string $a_lang_var)
 
static langExitsById (string $pluginId, string $langVar)
 Is searched lang var available in plugin lang files. More...
 
static _getImagePath (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
 
static createPluginRecord (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static getPluginRecord (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static getPluginObject (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 
static lookupStoredData (string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
 Lookup information data in il_plugin. More...
 
static getActivePluginsForSlot (string $a_ctype, string $a_cname, string $a_slot_id)
 
static getActivePluginIdsForSlot (string $a_ctype, string $a_cname, string $a_slot_id)
 Get All active plugin ids for a slot. More...
 
static lookupNameForId (string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
 
static lookupIdForName (string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_name)
 
static lookupTypeInformationsForId (string $id)
 

Protected Member Functions

 slotInit ()
 Object initialization done by slot. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 beforeUninstallCustom ()
 
 uninstallCustom ()
 
 beforeUninstall ()
 
- Protected Member Functions inherited from ilPlugin
 setSlotObject (ilPluginSlot $a_slot)
 
 getSlotObject ()
 
 getClassesDirectory ()
 
 getLanguageDirectory ()
 
 slotInit ()
 Object initialization done by slot. More...
 
 init ()
 Object initialization. More...
 
 afterInstall ()
 After install processing. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 afterActivation ()
 After activation processing. More...
 
 afterDeactivation ()
 After deactivation processing. More...
 
 beforeUninstall ()
 
 afterUninstall ()
 This is Plugin-Specific and is triggered after the uninstall command of a plugin. More...
 
 readEventListening ()
 Read the event listening definitions from the plugin.xml (if file exists) More...
 
 clearEventListening ()
 Clear the entries of this plugin in the event handling table. More...
 
 beforeUpdate ()
 Before update processing. More...
 
 afterUpdate ()
 After update processing. More...
 

Protected Attributes

 $lng
 
 $db
 
- Protected Attributes inherited from ilPlugin
 $slot
 
 $active = false
 
 $iliasmaxversion = ""
 
 $iliasminversion = ""
 
 $version = ""
 
 $lastupdateversion = ""
 
 $dbversion = 0
 
 $lang_initialised = false
 
 $id = ''
 
 $provider_collection
 

Detailed Description

Abstract parent class for all repository object plugin classes.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilRepositoryObjectPlugin::__construct ( )

Constructor.

Reimplemented from ilPlugin.

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

30 {
31 global $DIC;
33
34 $this->db = $DIC->database();
35 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getIcon()

static ilRepositoryObjectPlugin::_getIcon (   $a_type,
  $a_size 
)
static

Get Icon.

Reimplemented in ilOrgUnitExtensionPlugin.

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

89 {
92 "Repository",
93 "robj",
95 "icon_" . $a_type . ".svg"
96 );
97 }
const IL_COMP_SERVICE
static lookupNameForId(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
static _getImagePath(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname, string $a_img)
$a_type
Definition: workflow.php:92

References $a_type, ilPlugin\_getImagePath(), IL_COMP_SERVICE, and ilPlugin\lookupNameForId().

+ Here is the call graph for this function:

◆ _getName()

static ilRepositoryObjectPlugin::_getName (   $a_id)
static

Get class name.

Reimplemented in ilOrgUnitExtensionPlugin.

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

103 {
104 $name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $a_id);
105 if ($name != "") {
106 return $name;
107 }
108 }
if($format !==null) $name
Definition: metadata.php:230

References $name, IL_COMP_SERVICE, and ilPlugin\lookupNameForId().

+ Here is the call graph for this function:

◆ allowCopy()

ilRepositoryObjectPlugin::allowCopy ( )

decides if this repository plugin can be copied

Returns
bool

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

256 {
257 return false;
258 }

Referenced by beforeActivation().

+ Here is the caller graph for this function:

◆ beforeActivation()

ilRepositoryObjectPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented from ilPlugin.

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

114 {
116
117 // before activating, we ensure, that the type exists in the ILIAS
118 // object database and that all permissions exist
119 $type = $this->getId();
120
121 if (substr($type, 0, 1) != "x") {
122 throw new ilPluginException("Object plugin type must start with an x. Current type is " . $type . ".");
123 }
124
125 // check whether type exists in object data, if not, create the type
126 $set = $ilDB->query(
127 "SELECT * FROM object_data " .
128 " WHERE type = " . $ilDB->quote("typ", "text") .
129 " AND title = " . $ilDB->quote($type, "text")
130 );
131 if ($rec = $ilDB->fetchAssoc($set)) {
132 $t_id = $rec["obj_id"];
133 } else {
134 $t_id = $ilDB->nextId("object_data");
135 $ilDB->manipulate("INSERT INTO object_data " .
136 "(obj_id, type, title, description, owner, create_date, last_update) VALUES (" .
137 $ilDB->quote($t_id, "integer") . "," .
138 $ilDB->quote("typ", "text") . "," .
139 $ilDB->quote($type, "text") . "," .
140 $ilDB->quote("Plugin " . $this->getPluginName(), "text") . "," .
141 $ilDB->quote(-1, "integer") . "," .
142 $ilDB->quote(ilUtil::now(), "timestamp") . "," .
143 $ilDB->quote(ilUtil::now(), "timestamp") .
144 ")");
145 }
146
147 // add rbac operations
148 // 1: edit_permissions, 2: visible, 3: read, 4:write, 6:delete
149 $ops = array(1, 2, 3, 4, 6);
150 if ($this->allowCopy()) {
152 }
153 foreach ($ops as $op) {
154 // check whether type exists in object data, if not, create the type
155 $set = $ilDB->query(
156 "SELECT * FROM rbac_ta " .
157 " WHERE typ_id = " . $ilDB->quote($t_id, "integer") .
158 " AND ops_id = " . $ilDB->quote($op, "integer")
159 );
160 if (!$ilDB->fetchAssoc($set)) {
161 $ilDB->manipulate("INSERT INTO rbac_ta " .
162 "(typ_id, ops_id) VALUES (" .
163 $ilDB->quote($t_id, "integer") . "," .
164 $ilDB->quote($op, "integer") .
165 ")");
166 }
167 }
168
169 // now add creation permission, if not existing
170 $set = $ilDB->query(
171 "SELECT * FROM rbac_operations " .
172 " WHERE class = " . $ilDB->quote("create", "text") .
173 " AND operation = " . $ilDB->quote("create_" . $type, "text")
174 );
175 if ($rec = $ilDB->fetchAssoc($set)) {
176 $create_ops_id = $rec["ops_id"];
177 } else {
178 $create_ops_id = $ilDB->nextId("rbac_operations");
179 $ilDB->manipulate("INSERT INTO rbac_operations " .
180 "(ops_id, operation, description, class) VALUES (" .
181 $ilDB->quote($create_ops_id, "integer") . "," .
182 $ilDB->quote("create_" . $type, "text") . "," .
183 $ilDB->quote("create " . $type, "text") . "," .
184 $ilDB->quote("create", "text") .
185 ")");
186 }
187
188 // assign creation operation to root, cat, crs, grp and fold
189 $par_types = $this->getParentTypes();
190 foreach ($par_types as $par_type) {
191 $set = $ilDB->query(
192 "SELECT obj_id FROM object_data " .
193 " WHERE type = " . $ilDB->quote("typ", "text") .
194 " AND title = " . $ilDB->quote($par_type, "text")
195 );
196 if ($rec = $ilDB->fetchAssoc($set)) {
197 if ($rec["obj_id"] > 0) {
198 $set = $ilDB->query(
199 "SELECT * FROM rbac_ta " .
200 " WHERE typ_id = " . $ilDB->quote($rec["obj_id"], "integer") .
201 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")
202 );
203 if (!$ilDB->fetchAssoc($set)) {
204 $ilDB->manipulate("INSERT INTO rbac_ta " .
205 "(typ_id, ops_id) VALUES (" .
206 $ilDB->quote($rec["obj_id"], "integer") . "," .
207 $ilDB->quote($create_ops_id, "integer") .
208 ")");
209 }
210 }
211 }
212 }
213
214 return true;
215 }
static _getOperationIdByName($a_operation)
get operation id by name of operation @access public @access static
allowCopy()
decides if this repository plugin can be copied
static now()
Return current timestamp in Y-m-d H:i:s format.
$type
global $ilDB

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

+ Here is the call graph for this function:

◆ beforeUninstall()

ilRepositoryObjectPlugin::beforeUninstall ( )
finalprotected

Reimplemented from ilPlugin.

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

227 {
228 if ($this->beforeUninstallCustom()) {
229 include_once "Services/Repository/classes/class.ilRepUtil.php";
230 $rep_util = new ilRepUtil();
231 $rep_util->deleteObjectType($this->getId());
232
233 // custom database tables may be needed by plugin repository object
234 $this->uninstallCustom();
235
236 return true;
237 }
238 return false;
239 }
Repository Utilities (application layer, put GUI related stuff into ilRepUtilGUI)

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

+ Here is the call graph for this function:

◆ beforeUninstallCustom()

ilRepositoryObjectPlugin::beforeUninstallCustom ( )
protected

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

218 {
219 // plugin-specific
220 // false would indicate that anything went wrong
221 return true;
222 }

Referenced by beforeUninstall().

+ Here is the caller graph for this function:

◆ getComponentName()

ilRepositoryObjectPlugin::getComponentName ( )

Get Component Name.

Returns
string Component Name

Reimplemented from ilPlugin.

Reimplemented in ilOrgUnitExtensionPlugin.

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

53 {
54 return "Repository";
55 }

◆ getComponentType()

ilRepositoryObjectPlugin::getComponentType ( )

Get Component Type.

Returns
string Component Type

Reimplemented from ilPlugin.

Reimplemented in ilOrgUnitExtensionPlugin.

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

43 {
44 return IL_COMP_SERVICE;
45 }

References IL_COMP_SERVICE.

◆ getParentTypes()

ilRepositoryObjectPlugin::getParentTypes ( )
Returns
string[]

Reimplemented in ilOrgUnitExtensionPlugin.

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

245 {
246 $par_types = array("root", "cat", "crs", "grp", "fold");
247 return $par_types;
248 }

Referenced by beforeActivation().

+ Here is the caller graph for this function:

◆ getSlot()

ilRepositoryObjectPlugin::getSlot ( )

Get Slot Name.

Returns
string Slot Name

Reimplemented from ilPlugin.

Reimplemented in ilOrgUnitExtensionPlugin.

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

63 {
64 return "RepositoryObject";
65 }

◆ getSlotId()

ilRepositoryObjectPlugin::getSlotId ( )

Get Slot ID.

Returns
string Slot Id

Reimplemented from ilPlugin.

Reimplemented in ilOrgUnitExtensionPlugin.

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

73 {
74 return "robj";
75 }

◆ slotInit()

ilRepositoryObjectPlugin::slotInit ( )
protected

Object initialization done by slot.

Reimplemented from ilPlugin.

Reimplemented in ilOrgUnitExtensionPlugin.

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

81 {
82 // nothing to do here
83 }

◆ 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.

Returns
bool

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

265 : bool
266 {
267 return false;
268 }

Field Documentation

◆ $db

ilRepositoryObjectPlugin::$db
protected

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

Referenced by beforeActivation().

◆ $lng

ilRepositoryObjectPlugin::$lng
protected

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


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