ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 getComponentName ()
 
 getSlot ()
 
 getSlotId ()
 
 checkPermission ($a_user_id, $a_context_type, $a_context_id, $a_action_id, $a_action_sub_id)
 Check permission. 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 ()
 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 ($a_lang_keys=null)
 
 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...
 
 install ()
 Install. More...
 
 activate ()
 Activate. More...
 
 deactivate ()
 Deactivate. More...
 
 uninstall ()
 
 update ()
 Update plugin. More...
 

Static Public Member Functions

static hasDBField ($a_field_id)
 Check if field has db entry. More...
 
static createDBField ($a_type, $a_title, array $a_access=null, array $a_options=null)
 Create field db entry. More...
 
static updateDBField ($a_field_id, $a_title, array $a_access=null, array $a_options=null)
 Update field db entry. More...
 
static deleteDBField ($a_field_id)
 Delete field db entry. 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 langExitsById ($pluginId, $langVar)
 Is searched lang var available in plugin lang files. 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)
 
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 plugin names for a slot. More...
 
static getActivePluginIdsForSlot ($a_ctype, $a_cname, $a_slot_id)
 Get All active plugin ids for a slot. More...
 
static lookupNameForId ($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
 Lookup name for id. More...
 
static lookupIdForName ($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
 Lookup id for name. More...
 

Protected Member Functions

 slotInit ()
 
- 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...
 
 afterInstall ()
 After install processing. More...
 
 beforeActivation ()
 Before activation processing. More...
 
 afterActivation ()
 After activation processing. More...
 
 afterDeactivation ()
 After deactivation processing. More...
 
 beforeUninstall ()
 
 afterUninstall ()
 
 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...
 

Static Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilPlugin
 $lang_initialised = false
 
 $id = ''
 

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

◆ checkPermission()

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

Referenced by slotInit().

+ Here is the caller graph for this function:

◆ createDBField()

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 145 of file class.ilUDFClaimingPlugin.php.

References $a_type, $ilDB, array, and UDF_TYPE_SELECT.

146  {
147  global $ilDB;
148 
149  $field_id = $ilDB->nextId("udf_definition");
150 
151  // validating type
152  $a_type = (int) $a_type;
153  if (!self::isValidFieldType($a_type)) {
154  return;
155  }
156 
157  if ($a_type != UDF_TYPE_SELECT) {
158  $a_options = null;
159  }
160 
161  // :TODO: check unique title?
162 
163  $fields = array(
164  "field_id" => array("integer", $field_id),
165  "field_type" => array("integer", $a_type),
166  "field_name" => array("text", trim($a_title)),
167  "field_values" => array("text", serialize((array) $a_options))
168  );
169 
170  self::handleAccesss($fields, $a_access);
171 
172  $ilDB->insert("udf_definition", $fields);
173 
174  return $field_id;
175  }
const UDF_TYPE_SELECT
$a_type
Definition: workflow.php:92
Create styles array
The data for the language used.
global $ilDB

◆ deleteDBField()

static ilUDFClaimingPlugin::deleteDBField (   $a_field_id)
static

Delete field db entry.

Parameters
int$a_field_id
Returns
bool

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

References $ilDB.

222  {
223  global $ilDB;
224 
225  if (self::hasDBField($a_field_id)) {
226  // :TODO: we are not deleting any values here
227 
228  $ilDB->manipulate("DELETE FROM udf_definition" .
229  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
230  return true;
231  }
232 
233  return false;
234  }
global $ilDB

◆ getComponentName()

ilUDFClaimingPlugin::getComponentName ( )
final

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

27  {
28  return "User";
29  }

◆ getComponentType()

ilUDFClaimingPlugin::getComponentType ( )
final

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

References IL_COMP_SERVICE.

22  {
23  return IL_COMP_SERVICE;
24  }
const IL_COMP_SERVICE

◆ getDBField()

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.

90  {
91  global $ilDB;
92 
93  $set = $ilDB->query("SELECT * FROM udf_definition" .
94  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
95  return $ilDB->fetchAssoc($set);
96  }
global $ilDB

◆ getSlot()

ilUDFClaimingPlugin::getSlot ( )
final

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

32  {
33  return "UDFClaiming";
34  }

◆ getSlotId()

ilUDFClaimingPlugin::getSlotId ( )
final

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

37  {
38  return "udfc";
39  }

◆ handleAccesss()

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.

References array.

121  {
122  $map = array("visible", "changeable", "searchable", "required", "export",
123  "course_export", "group_export", "registration_visible", "visible_lua",
124  "changeable_lua", "certificate");
125  foreach ($map as $prop) {
126  if (isset($a_access[$prop])) {
127  $fields[$prop] = array("integer", (int) $a_access[$prop]);
128  } elseif (isset($a_existing[$prop])) {
129  $fields[$prop] = array("integer", (int) $a_existing[$prop]);
130  } else {
131  $fields[$prop] = array("integer", 0);
132  }
133  }
134  }
Create styles array
The data for the language used.

◆ hasDBField()

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.

75  {
76  global $ilDB;
77 
78  $set = $ilDB->query("SELECT field_id FROM udf_definition" .
79  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
80  return (bool) $ilDB->numRows($set);
81  }
global $ilDB

◆ isValidFieldType()

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, array, UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

105  {
106  // needed for the type constants
107  require_once "Services/User/classes/class.ilUserDefinedFields.php";
108 
110 
111  return in_array($a_field_type, $valid);
112  }
const UDF_TYPE_SELECT
$valid
const UDF_TYPE_TEXT
const UDF_TYPE_WYSIWYG
Create styles array
The data for the language used.

◆ slotInit()

ilUDFClaimingPlugin::slotInit ( )
finalprotected

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

References $a_context_id, $a_context_type, and checkPermission().

42  {
43  require_once "Services/User/classes/class.ilUDFPermissionHelper.php";
44  }
+ Here is the call graph for this function:

◆ updateDBField()

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 186 of file class.ilUDFClaimingPlugin.php.

References $ilDB, $old, array, and UDF_TYPE_SELECT.

187  {
188  global $ilDB;
189 
190  if (self::hasDBField($a_field_id)) {
191  $old = self::getDBField($a_field_id);
192 
193  if ($old["field_type"] != UDF_TYPE_SELECT) {
194  $a_options = null;
195  }
196 
197  $fields = array(
198  "field_name" => array("text", trim($a_title)),
199  "field_values" => array("text", serialize((array) $a_options))
200  );
201 
202  self::handleAccesss($fields, $a_access, $old);
203 
204  $ilDB->update(
205  "udf_definition",
206  $fields,
207  array("field_id" => array("integer", $a_field_id))
208  );
209  return true;
210  }
211 
212  return false;
213  }
const UDF_TYPE_SELECT
$old
Create styles array
The data for the language used.
global $ilDB

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