ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRepositoryObjectPlugin Class Reference

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

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

Public Member Functions

 getComponentType ()
 Get Component Type. More...
 
 getComponentName ()
 Get Component Name. More...
 
 getSlot ()
 Get Slot Name. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 _getName ($a_id)
 Get class name. More...
 
- Public Member Functions inherited from ilPlugin
 __construct ()
 Constructor. More...
 
 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 ()
 Get Id. More...
 
 getLastUpdateVersion ()
 Get Version of last update. More...
 
 getVersion ()
 Get Current Version (from plugin.php file). More...
 
 getIliasMinVersion ()
 Get Required ILIAS min. More...
 
 getIliasMaxVersion ()
 Get Required ILIAS max. More...
 
 getActive ()
 Get Active. More...
 
 setDBVersion ($a_dbversion)
 Set DB Version. More...
 
 getDBVersion ()
 Get DB Version. More...
 
 writeDBVersion ($a_dbversion)
 Write DB version to database. More...
 
 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 ()
 Update all languages. More...
 
 updateDatabase ()
 Update database. More...
 
 loadLanguageModule ()
 Load language module for plugin. More...
 
 txt ($a_var)
 Get Language Variable (prefix will be prepended automatically) More...
 
 getTemplate ($a_template, $a_par1=true, $a_par2=true)
 Get template from plugin. More...
 
 getImagePath ($a_img)
 Get image path. More...
 
 getStyleSheetLocation ($a_css_file)
 Get css file location. More...
 
 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...
 
 activate ()
 Activate. More...
 
 deactivate ()
 Deactivate. More...
 
 update ()
 Update plugin. More...
 
 lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id. More...
 
 lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name. More...
 

Static Public Member Functions

static _getIcon ($a_type, $a_size)
 Get Icon. More...
 
- Static Public Member Functions inherited from ilPlugin
static _getDirectory ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get plugin directory. More...
 
static getAvailableLangFiles ($a_lang_directory)
 Get array of all language files in the plugin. More...
 
static hasConfigureClass ($a_slot_dir, $a_name)
 Has the plugin a configure class? More...
 
static getConfigureClassName ($a_name)
 Get plugin configure class name. More...
 
static getDBUpdateScriptName ($a_ctype, $a_cname, $a_slot_name, $a_pname)
 Get DB update script filename (full path) More...
 
static lookupTxt ($a_mod_prefix, $a_pl_id, $a_lang_var)
 Lookup language text. More...
 
static _getImagePath ($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
 Get image path. More...
 
static createPluginRecord ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Create plugin record, if not existing. More...
 
static getPluginRecord ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get record from il_plugin table. More...
 
static getPluginObject ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Get plugin object. More...
 
static lookupStoredData ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Lookup information data in il_plugin. More...
 
static getActivePluginsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get all active plugins for a slot. More...
 

Protected Member Functions

 slotInit ()
 Object initialization done by slot. More...
 
 beforeActivation ()
 Before activation processing. More...
 
- Protected Member Functions inherited from ilPlugin
 setSlotObject ($a_slot)
 Set Plugin Slot. More...
 
 getSlotObject ()
 Get Plugin Slot. More...
 
 getClassesDirectory ()
 Get Plugin's classes Directory. More...
 
 getLanguageDirectory ()
 Get Plugin's language Directory. More...
 
 slotInit ()
 Object initialization done by slot. More...
 
 init ()
 Object initialization. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 afterActivation ()
 After activation processing. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilPlugin
 $lang_initialised = false
 

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.

Member Function Documentation

◆ _getIcon()

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

Get Icon.

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

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

67  {
68  switch($a_size)
69  {
70  case "small": $suff = ""; break;
71  case "tiny": $suff = "_s"; break;
72  default: $suff = "_b"; break;
73  }
74  return ilPlugin::_getImagePath(IL_COMP_SERVICE, "Repository", "robj",
75  ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj",$a_type),
76  "icon_".$a_type.$suff.".png");
77  }
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
const IL_COMP_SERVICE
+ Here is the call graph for this function:

◆ _getName()

ilRepositoryObjectPlugin::_getName (   $a_id)

Get class name.

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

References IL_COMP_SERVICE, and ilPlugin\lookupNameForId().

83  {
84  $name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj",$a_id);
85  if ($name != "")
86  {
87  return $name;
88  }
89  }
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
const IL_COMP_SERVICE
+ Here is the call graph for this function:

◆ beforeActivation()

ilRepositoryObjectPlugin::beforeActivation ( )
protected

Before activation processing.

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

References $lng, ilPlugin\getId(), ilPlugin\getPluginName(), and ilUtil\now().

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

◆ getComponentName()

ilRepositoryObjectPlugin::getComponentName ( )
final

Get Component Name.

Returns
string Component Name

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

31  {
32  return "Repository";
33  }

◆ getComponentType()

ilRepositoryObjectPlugin::getComponentType ( )
final

Get Component Type.

Returns
string Component Type

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

References IL_COMP_SERVICE.

21  {
22  return IL_COMP_SERVICE;
23  }
const IL_COMP_SERVICE

◆ getSlot()

ilRepositoryObjectPlugin::getSlot ( )
final

Get Slot Name.

Returns
string Slot Name

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

41  {
42  return "RepositoryObject";
43  }

◆ getSlotId()

ilRepositoryObjectPlugin::getSlotId ( )
final

Get Slot ID.

Returns
string Slot Id

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

51  {
52  return "robj";
53  }

◆ slotInit()

ilRepositoryObjectPlugin::slotInit ( )
finalprotected

Object initialization done by slot.

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

59  {
60  // nothing to do here
61  }

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