ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups 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.
 getComponentName ()
 Get Component Name.
 getSlot ()
 Get Slot Name.
 getSlotId ()
 Get Slot ID.
 _getName ($a_id)
 Get class name.
- Public Member Functions inherited from ilPlugin
 __construct ()
 Constructor.
 getPluginName ()
 Get Plugin Name.
 getId ()
 Get Id.
 getLastUpdateVersion ()
 Get Version of last update.
 getVersion ()
 Get Current Version (from plugin.php file).
 getIliasMinVersion ()
 Get Required ILIAS min.
 getIliasMaxVersion ()
 Get Required ILIAS max.
 getActive ()
 Get Active.
 setDBVersion ($a_dbversion)
 Set DB Version.
 getDBVersion ()
 Get DB Version.
 writeDBVersion ($a_dbversion)
 Write DB version to database.
 getDirectory ()
 Get Plugin Directory.
 includeClass ($a_class_file_name)
 Include (once) a class file.
 getPrefix ()
 Get plugin prefix, used for lang vars.
 getTablePrefix ()
 Get db table plugin prefix.
 updateLanguages ()
 Update all languages.
 updateDatabase ()
 Update database.
 loadLanguageModule ()
 Load language module for plugin.
 txt ($a_var)
 Get Language Variable (prefix will be prepended automatically)
 getTemplate ($a_template, $a_par1=true, $a_par2=true)
 Get template from plugin.
 getImagePath ($a_img)
 Get image path.
 getStyleSheetLocation ($a_css_file)
 Get css file location.
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 Add template content to placeholder variable.
 isActive ()
 Check whether plugin is active.
 needsUpdate ()
 Check whether update is needed.
 activate ()
 Activate.
 deactivate ()
 Deactivate.
 update ()
 Update plugin.
 lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id.
 lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name.

Static Public Member Functions

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

Protected Member Functions

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

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

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().

{
switch($a_size)
{
case "small": $suff = ""; break;
case "tiny": $suff = "_s"; break;
default: $suff = "_b"; break;
}
return ilPlugin::_getImagePath(IL_COMP_SERVICE, "Repository", "robj",
ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj",$a_type),
"icon_".$a_type.$suff.".gif");
}

+ Here is the call graph for this function:

ilRepositoryObjectPlugin::_getName (   $a_id)

Get class name.

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

References IL_COMP_SERVICE, and ilPlugin\lookupNameForId().

{
$name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj",$a_id);
if ($name != "")
{
return $name;
}
}

+ Here is the call graph for this function:

ilRepositoryObjectPlugin::beforeActivation ( )
protected

Before activation processing.

Reimplemented from ilPlugin.

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

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

{
global $lng, $ilDB;
// before activating, we ensure, that the type exists in the ILIAS
// object database and that all permissions exist
$type = $this->getId();
if (substr($type, 0, 1) != "x")
{
throw new ilPluginException("Object plugin type must start with an x. Current type is ".$type.".");
}
// check whether type exists in object data, if not, create the type
$set = $ilDB->query("SELECT * FROM object_data ".
" WHERE type = ".$ilDB->quote("typ", "text").
" AND title = ".$ilDB->quote($type, "text")
);
if ($rec = $ilDB->fetchAssoc($set))
{
$t_id = $rec["obj_id"];
}
else
{
$t_id = $ilDB->nextId("object_data");
$ilDB->manipulate("INSERT INTO object_data ".
"(obj_id, type, title, description, owner, create_date, last_update) VALUES (".
$ilDB->quote($t_id, "integer").",".
$ilDB->quote("typ", "text").",".
$ilDB->quote($type, "text").",".
$ilDB->quote("Plugin ".$this->getPluginName(), "text").",".
$ilDB->quote(-1, "integer").",".
$ilDB->quote(ilUtil::now(), "timestamp").",".
$ilDB->quote(ilUtil::now(), "timestamp").
")");
}
// add rbac operations
// 1: edit_permissions, 2: visible, 3: read, 4:write, 6:delete
$ops = array(1, 2, 3, 4, 6);
foreach ($ops as $op)
{
// check whether type exists in object data, if not, create the type
$set = $ilDB->query("SELECT * FROM rbac_ta ".
" WHERE typ_id = ".$ilDB->quote($t_id, "integer").
" AND ops_id = ".$ilDB->quote($op, "integer")
);
if (!$ilDB->fetchAssoc($set))
{
$ilDB->manipulate("INSERT INTO rbac_ta ".
"(typ_id, ops_id) VALUES (".
$ilDB->quote($t_id, "integer").",".
$ilDB->quote($op, "integer").
")");
}
}
// now add creation permission, if not existing
$set = $ilDB->query("SELECT * FROM rbac_operations ".
" WHERE class = ".$ilDB->quote("create", "text").
" AND operation = ".$ilDB->quote("create_".$type, "text")
);
if ($rec = $ilDB->fetchAssoc($set))
{
$create_ops_id = $rec["ops_id"];
}
else
{
$create_ops_id = $ilDB->nextId(rbac_operations);
$ilDB->manipulate("INSERT INTO rbac_operations ".
"(ops_id, operation, description, class) VALUES (".
$ilDB->quote($create_ops_id, "integer").",".
$ilDB->quote("create_".$type, "text").",".
$ilDB->quote("create ".$type, "text").",".
$ilDB->quote("create", "text").
")");
}
// assign creation operation to root, cat, crs, grp and fold
$par_types = array("root", "cat", "crs", "grp", "fold");
foreach ($par_types as $par_type)
{
$set = $ilDB->query("SELECT obj_id FROM object_data ".
" WHERE type = ".$ilDB->quote("typ", "text").
" AND title = ".$ilDB->quote($par_type, "text")
);
if ($rec = $ilDB->fetchAssoc($set))
{
if ($rec["obj_id"] > 0)
{
$set = $ilDB->query("SELECT * FROM rbac_ta ".
" WHERE typ_id = ".$ilDB->quote($rec["obj_id"], "integer").
" AND ops_id = ".$ilDB->quote($create_ops_id, "integer")
);
if (!$ilDB->fetchAssoc($set))
{
$ilDB->manipulate("INSERT INTO rbac_ta ".
"(typ_id, ops_id) VALUES (".
$ilDB->quote($rec["obj_id"], "integer").",".
$ilDB->quote($create_ops_id, "integer").
")");
}
}
}
}
return true;
}

+ Here is the call graph for this function:

ilRepositoryObjectPlugin::getComponentName ( )
final

Get Component Name.

Returns
string Component Name

Reimplemented from ilPlugin.

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

{
return "Repository";
}
ilRepositoryObjectPlugin::getComponentType ( )
final

Get Component Type.

Returns
string Component Type

Reimplemented from ilPlugin.

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

References IL_COMP_SERVICE.

{
}
ilRepositoryObjectPlugin::getSlot ( )
final

Get Slot Name.

Returns
string Slot Name

Reimplemented from ilPlugin.

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

{
return "RepositoryObject";
}
ilRepositoryObjectPlugin::getSlotId ( )
final

Get Slot ID.

Returns
string Slot Id

Reimplemented from ilPlugin.

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

{
return "robj";
}
ilRepositoryObjectPlugin::slotInit ( )
finalprotected

Object initialization done by slot.

Reimplemented from ilPlugin.

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

{
// nothing to do here
}

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