ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUDFClaimingPlugin Class Reference

Abstract parent class for all udf claiming plugin classes. More...

+ Inheritance diagram for ilUDFClaimingPlugin:
+ Collaboration diagram for ilUDFClaimingPlugin:

Public Member Functions

 getComponentType ()
 Get Component Type.
 getComponentName ()
 Get Component Name.
 getSlot ()
 Get Slot Name.
 getSlotId ()
 Get Slot ID.
 checkPermission ($a_user_id, $a_context_type, $a_context_id, $a_action_id, $a_action_sub_id)
 Check permission.
- 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 hasDBField ($a_field_id)
 Check if field has db entry.
static createDBField ($a_type, $a_title, array $a_access=null, array $a_options=null)
 Create field db entry.
static updateDBField ($a_field_id, $a_title, array $a_access=null, array $a_options=null)
 Update field db entry.
static deleteDBField ($a_field_id)
 Delete field db entry.
- 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 createPluginRecord ($a_ctype, $a_cname, $a_slot_id, $a_pname)
 Create plugin record, if not existing.
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.
- 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.
 beforeActivation ()
 Before activation processing.
 afterActivation ()
 After activation processing.
 afterDeactivation ()
 After deactivation processing.
 beforeUpdate ()
 Before update processing.
 afterUpdate ()
 After update processing.

Static Protected Member Functions

static getDBField ($a_field_id)
 Get existing field values.
static isValidFieldType ($a_field_type)
 Validate field type.
static handleAccesss (array &$fields, array $a_access=null, array $a_existing=null)
 Convert access array to DB columns.

Additional Inherited Members

- Protected Attributes inherited from ilPlugin
 $lang_initialised = false

Detailed Description

Abstract parent class for all udf claiming plugin classes.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 15 of file class.ilUDFClaimingPlugin.php.

Member Function Documentation

ilUDFClaimingPlugin::checkPermission (   $a_user_id,
  $a_context_type,
  $a_context_id,
  $a_action_id,
  $a_action_sub_id 
)
abstract

Check permission.

Parameters
int$a_user_id
int$a_context_type
int$a_context_id
int$a_action_id
int$a_action_sub_id
Returns
bool
static ilUDFClaimingPlugin::createDBField (   $a_type,
  $a_title,
array  $a_access = null,
array  $a_options = null 
)
static

Create field db entry.

Parameters
int$a_type
string$a_title
array$a_access
array$a_options
Returns
int field id

Definition at line 151 of file class.ilUDFClaimingPlugin.php.

References $ilDB, handleAccesss(), and UDF_TYPE_SELECT.

{
global $ilDB;
$field_id = $ilDB->nextId("udf_definition");
// validating type
$a_type = (int)$a_type;
if(!self::isValidFieldType($a_type))
{
return;
}
if($a_type != UDF_TYPE_SELECT)
{
$a_options = null;
}
// :TODO: check unique title?
$fields = array(
"field_id" => array("integer", $field_id),
"field_type" => array("integer", $a_type),
"field_name" => array("text", trim($a_title)),
"field_values" => array("text", serialize((array)$a_options))
);
self::handleAccesss($fields, $a_access);
$ilDB->insert("udf_definition", $fields);
return $field_id;
}

+ Here is the call graph for this function:

static ilUDFClaimingPlugin::deleteDBField (   $a_field_id)
static

Delete field db entry.

Parameters
int$a_field_id
Returns
bool

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

References $ilDB.

{
global $ilDB;
if(self::hasDBField($a_field_id))
{
// :TODO: we are not deleting any values here
$ilDB->manipulate("DELETE FROM udf_definition".
" WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
return true;
}
return false;
}
ilUDFClaimingPlugin::getComponentName ( )
final

Get Component Name.

Must be overwritten in plugin class of plugin slot. (and should be made final)

Returns
string Component Name

Reimplemented from ilPlugin.

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

{
return "User";
}
ilUDFClaimingPlugin::getComponentType ( )
final

Get Component Type.

Must be overwritten in plugin class of plugin slot. (and should be made final)

Returns
string Component Type

Reimplemented from ilPlugin.

Definition at line 21 of file class.ilUDFClaimingPlugin.php.

References IL_COMP_SERVICE.

{
}
static ilUDFClaimingPlugin::getDBField (   $a_field_id)
staticprotected

Get existing field values.

Parameters
int$a_field_id
Returns
array

Definition at line 89 of file class.ilUDFClaimingPlugin.php.

References $ilDB.

Referenced by updateDBField().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM udf_definition".
" WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
return $ilDB->fetchAssoc($set);
}

+ Here is the caller graph for this function:

ilUDFClaimingPlugin::getSlot ( )
final

Get Slot Name.

Must be overwritten in plugin class of plugin slot. (and should be made final)

Returns
string Slot Name

Reimplemented from ilPlugin.

Definition at line 31 of file class.ilUDFClaimingPlugin.php.

{
return "UDFClaiming";
}
ilUDFClaimingPlugin::getSlotId ( )
final

Get Slot ID.

Must be overwritten in plugin class of plugin slot. (and should be made final)

Returns
string Slot Id

Reimplemented from ilPlugin.

Definition at line 36 of file class.ilUDFClaimingPlugin.php.

{
return "udfc";
}
static ilUDFClaimingPlugin::handleAccesss ( array &  $fields,
array  $a_access = null,
array  $a_existing = null 
)
staticprotected

Convert access array to DB columns.

Parameters
array$fields
array$a_access

Definition at line 120 of file class.ilUDFClaimingPlugin.php.

Referenced by createDBField(), and updateDBField().

{
$map = array("visible", "changeable", "searchable", "required", "export",
"course_export", "group_export", "registration_visible", "visible_lua",
"changeable_lua", "certificate");
foreach($map as $prop)
{
if(isset($a_access[$prop]))
{
$fields[$prop] = array("integer", (int)$a_access[$prop]);
}
else if(isset($a_existing[$prop]))
{
$fields[$prop] = array("integer", (int)$a_existing[$prop]);
}
else
{
$fields[$prop] = array("integer", 0);
}
}
}

+ Here is the caller graph for this function:

static ilUDFClaimingPlugin::hasDBField (   $a_field_id)
static

Check if field has db entry.

Parameters
int$a_field_id
Returns
bool

Definition at line 74 of file class.ilUDFClaimingPlugin.php.

References $ilDB.

{
global $ilDB;
$set = $ilDB->query("SELECT field_id FROM udf_definition".
" WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
return (bool)$ilDB->numRows($set);
}
static ilUDFClaimingPlugin::isValidFieldType (   $a_field_type)
staticprotected

Validate field type.

Parameters
string$a_field_type
Returns
bool

Definition at line 104 of file class.ilUDFClaimingPlugin.php.

References $valid, UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

{
// needed for the type constants
require_once "Services/User/classes/class.ilUserDefinedFields.php";
return in_array($a_field_type, $valid);
}
ilUDFClaimingPlugin::slotInit ( )
finalprotected

Object initialization done by slot.

Must be overwritten in plugin class of plugin slot.

(and should be made protected final)

Reimplemented from ilPlugin.

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

{
require_once "Services/User/classes/class.ilUDFPermissionHelper.php";
}
static ilUDFClaimingPlugin::updateDBField (   $a_field_id,
  $a_title,
array  $a_access = null,
array  $a_options = null 
)
static

Update field db entry.

Parameters
int$a_field_id
string$a_title
array$a_access
array$a_options
Returns
bool

Definition at line 194 of file class.ilUDFClaimingPlugin.php.

References $ilDB, getDBField(), handleAccesss(), and UDF_TYPE_SELECT.

{
global $ilDB;
if(self::hasDBField($a_field_id))
{
$old = self::getDBField($a_field_id);
if($old["field_type"] != UDF_TYPE_SELECT)
{
$a_options = null;
}
$fields = array(
"field_name" => array("text", trim($a_title)),
"field_values" => array("text", serialize((array)$a_options))
);
self::handleAccesss($fields, $a_access, $old);
$ilDB->update("udf_definition", $fields,
array("field_id" => array("integer", $a_field_id)));
return true;
}
return false;
}

+ Here is the call graph for this function:


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