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

Abstract parent class for all advanced md claiming plugin classes. More...

+ Inheritance diagram for ilAdvancedMDClaimingPlugin:
+ Collaboration diagram for ilAdvancedMDClaimingPlugin:

Public Member Functions

 getComponentType ()
 Get Component Type. More...
 
 getComponentName ()
 Get Component Name. More...
 
 getSlot ()
 Get Slot Name. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 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 ()
 
 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 hasDBRecord ($a_record_id)
 Check if record has db entry. More...
 
static createDBRecord ($a_title, $a_description, $a_active, array $a_obj_types)
 Create record db entry. More...
 
static updateDBRecord ($a_record_id, $a_title, $a_description, $a_active, array $a_obj_types)
 Update record db entry. More...
 
static deleteDBRecord ($a_record_id)
 Delete record db entry. More...
 
static hasDBField ($a_field_id)
 Check if field has db entry. More...
 
static createDBField ($a_record_id, $a_type, $a_title, $a_description=null, $a_searchable=false, array $a_definition=null)
 Create field db entry. More...
 
static updateDBField ($a_field_id, $a_title, $a_description=null, $a_searchable=false, array $a_definition=null)
 Update field db entry. More...
 
static deleteDBField ($a_field_id)
 Delete field db entry. More...
 
static setDBSubstitution ($a_obj_type, $a_show_description, $a_show_field_names)
 Set substitution DB entry (for object type) More...
 
static hasDBFieldSubstitution ($a_obj_type, $a_field_id)
 Is substitution active for field in object type. More...
 
static setDBFieldSubstitution ($a_obj_type, $a_field_id, $a_bold=false, $a_newline=false)
 Update field substitution entry in DB. More...
 
static removeDBFieldSubstitution ($a_obj_type, $a_field_id)
 Remove field substitution entry in DB. 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...
 
- 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...
 

Static Protected Member Functions

static isValidObjType ($a_obj_type, $a_is_substitution=false)
 Validate object type. More...
 
static saveRecordObjTypes ($a_record_id, array $a_obj_types)
 Save object type assignments for record. More...
 
static getDBFieldLastPosition ($a_record_id)
 Get last position of record. More...
 
static getDBSubstitution ($a_obj_type, $a_include_field_data=false)
 Get substitution DB data for object type. More...
 

Additional Inherited Members

- 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 advanced md 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.ilAdvancedMDClaimingPlugin.php.

Member Function Documentation

◆ checkPermission()

ilAdvancedMDClaimingPlugin::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

◆ createDBField()

static ilAdvancedMDClaimingPlugin::createDBField (   $a_record_id,
  $a_type,
  $a_title,
  $a_description = null,
  $a_searchable = false,
array  $a_definition = null 
)
static

Create field db entry.

Parameters
int$a_record_id
int$a_type
string$a_title
string$a_description
bool$a_searchable
array$a_definition
Returns
int field id

Definition at line 282 of file class.ilAdvancedMDClaimingPlugin.php.

283 {
284 global $DIC;
285
286 $ilDB = $DIC['ilDB'];
287
288 if (!self::hasDBRecord($a_record_id)) {
289 return;
290 }
291
292 $field_id = $ilDB->nextId("adv_mdf_definition");
293
294 // validating type
295 $a_type = (int) $a_type;
296 if ($a_type < 1 || $a_type > 8) {
297 return;
298 }
299
300 $pos = self::getDBFieldLastPosition($a_record_id) + 1;
301
302 $fields = array(
303 "record_id" => array("integer", $a_record_id),
304 "field_id" => array("integer", $field_id),
305 "import_id" => array("text", "il_" . IL_INST_ID . "_adv_md_field_" . $field_id),
306 "field_type" => array("integer", $a_type),
307 "position" => array("integer", $pos),
308 "title" => array("text", trim($a_title)),
309 "description" => array("text", trim($a_description)),
310 "searchable" => array("integer", (int) $a_searchable)
311 );
312 if ($a_definition) {
313 $fields["field_values"] = array("text", serialize($a_definition));
314 }
315 $ilDB->insert("adv_mdf_definition", $fields);
316
317 return $field_id;
318 }
static getDBFieldLastPosition($a_record_id)
Get last position of record.
global $ilDB
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46

References $a_type, $DIC, $ilDB, and getDBFieldLastPosition().

+ Here is the call graph for this function:

◆ createDBRecord()

static ilAdvancedMDClaimingPlugin::createDBRecord (   $a_title,
  $a_description,
  $a_active,
array  $a_obj_types 
)
static

Create record db entry.

Parameters
string$a_title
string$a_description
bool$a_active
array$a_obj_types
Returns
int record id

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

95 {
96 global $DIC;
97
98 $ilDB = $DIC['ilDB'];
99
100 $record_id = $ilDB->nextId("adv_md_record");
101
102 $fields = array(
103 "record_id" => array("integer", $record_id),
104 "import_id" => array("text", 'il_' . IL_INST_ID . '_adv_md_record_' . $record_id),
105 "title" => array("text", trim($a_title)),
106 "description" => array("text", trim($a_description)),
107 "active" => array("integer", (int) $a_active)
108 );
109 $ilDB->insert("adv_md_record", $fields);
110
111 self::saveRecordObjTypes($record_id, $a_obj_types);
112
113 return $record_id;
114 }
static saveRecordObjTypes($a_record_id, array $a_obj_types)
Save object type assignments for record.

References $DIC, $ilDB, and saveRecordObjTypes().

+ Here is the call graph for this function:

◆ deleteDBField()

static ilAdvancedMDClaimingPlugin::deleteDBField (   $a_field_id)
static

Delete field db entry.

Parameters
int$a_field_id
Returns
bool

Definition at line 363 of file class.ilAdvancedMDClaimingPlugin.php.

364 {
365 global $DIC;
366
367 $ilDB = $DIC['ilDB'];
368
369 if (self::hasDBField($a_field_id)) {
370 $ilDB->manipulate("DELETE FROM adv_mdf_definition" .
371 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
372 return true;
373 }
374
375 return false;
376 }

References $DIC, and $ilDB.

◆ deleteDBRecord()

static ilAdvancedMDClaimingPlugin::deleteDBRecord (   $a_record_id)
static

Delete record db entry.

Parameters
int$a_record_id
Returns
bool

Definition at line 213 of file class.ilAdvancedMDClaimingPlugin.php.

214 {
215 global $DIC;
216
217 $ilDB = $DIC['ilDB'];
218
219 if (self::hasDBRecord($a_record_id)) {
220 $ilDB->manipulate("DELETE FROM adv_md_record" .
221 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
222 return true;
223 }
224
225 return false;
226 }

References $DIC, and $ilDB.

◆ getComponentName()

ilAdvancedMDClaimingPlugin::getComponentName ( )
final

Get Component Name.

Must be overwritten in plugin class of plugin slot.

Returns
string Component Name

Reimplemented from ilPlugin.

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

27 {
28 return "AdvancedMetaData";
29 }

◆ getComponentType()

ilAdvancedMDClaimingPlugin::getComponentType ( )
final

Get Component Type.

Must be overwritten in plugin class of plugin slot.

Returns
string Component Type

Reimplemented from ilPlugin.

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

22 {
23 return IL_COMP_SERVICE;
24 }
const IL_COMP_SERVICE

References IL_COMP_SERVICE.

◆ getDBFieldLastPosition()

static ilAdvancedMDClaimingPlugin::getDBFieldLastPosition (   $a_record_id)
staticprotected

Get last position of record.

See also
ilAdvancedMDFieldDefinition::getLastPosition()
Parameters
int$a_record_id
Returns
int

Definition at line 253 of file class.ilAdvancedMDClaimingPlugin.php.

254 {
255 global $DIC;
256
257 $ilDB = $DIC['ilDB'];
258
259 $sql = "SELECT max(position) pos" .
260 " FROM adv_mdf_definition" .
261 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer");
262 $set = $ilDB->query($sql);
263 if ($ilDB->numRows($set)) {
264 $pos = $ilDB->fetchAssoc($set);
265 return (int) $pos["pos"];
266 }
267
268 return 0;
269 }

References $DIC, and $ilDB.

Referenced by createDBField().

+ Here is the caller graph for this function:

◆ getDBSubstitution()

static ilAdvancedMDClaimingPlugin::getDBSubstitution (   $a_obj_type,
  $a_include_field_data = false 
)
staticprotected

Get substitution DB data for object type.

Parameters
string$a_obj_type
bool$a_include_field_data
Returns
array

Definition at line 385 of file class.ilAdvancedMDClaimingPlugin.php.

386 {
387 global $DIC;
388
389 $ilDB = $DIC['ilDB'];
390
391 $set = $ilDB->query("SELECT * FROM adv_md_substitutions" .
392 " WHERE obj_type = " . $ilDB->quote($a_obj_type, "text"));
393 if ($ilDB->numRows($set)) {
394 $res = $ilDB->fetchAssoc($set);
395 $res["hide_description"] = array("integer", (bool) $res["hide_description"]);
396 $res["hide_field_names"] = array("integer", (bool) $res["hide_field_names"]);
397
398 if ($a_include_field_data) {
399 $res["substitution"] = array("text", (array) unserialize($res["substitution"]));
400 } else {
401 unset($res["substitution"]);
402 }
403 unset($res["obj_type"]);
404
405 return $res;
406 }
407 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, and $res.

Referenced by hasDBFieldSubstitution(), removeDBFieldSubstitution(), setDBFieldSubstitution(), and setDBSubstitution().

+ Here is the caller graph for this function:

◆ getSlot()

ilAdvancedMDClaimingPlugin::getSlot ( )
final

Get Slot Name.

Must be overwritten in plugin class of plugin slot.

Returns
string Slot Name

Reimplemented from ilPlugin.

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

32 {
33 return "AdvancedMDClaiming";
34 }

◆ getSlotId()

ilAdvancedMDClaimingPlugin::getSlotId ( )
final

Get Slot ID.

Must be overwritten in plugin class of plugin slot.

Returns
string Slot Id

Reimplemented from ilPlugin.

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

37 {
38 return "amdc";
39 }

◆ hasDBField()

static ilAdvancedMDClaimingPlugin::hasDBField (   $a_field_id)
static

Check if field has db entry.

Parameters
int$a_field_id
Returns
bool

Definition at line 234 of file class.ilAdvancedMDClaimingPlugin.php.

235 {
236 global $DIC;
237
238 $ilDB = $DIC['ilDB'];
239
240 $set = $ilDB->query("SELECT field_id FROM adv_mdf_definition" .
241 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
242 return (bool) $ilDB->numRows($set);
243 }

References $DIC, and $ilDB.

◆ hasDBFieldSubstitution()

static ilAdvancedMDClaimingPlugin::hasDBFieldSubstitution (   $a_obj_type,
  $a_field_id 
)
static

Is substitution active for field in object type.

Parameters
string$a_obj_type
int$a_field_id
Returns
bool

Definition at line 457 of file class.ilAdvancedMDClaimingPlugin.php.

458 {
459 if (self::isValidObjType($a_obj_type, true)) {
460 $fields = self::getDBSubstitution($a_obj_type, true);
461 $fields = $fields["substitution"][1];
462 foreach ($fields as $field) {
463 if ($field["field_id"] == $a_field_id) {
464 return true;
465 }
466 }
467 return false;
468 }
469 }
static getDBSubstitution($a_obj_type, $a_include_field_data=false)
Get substitution DB data for object type.

References getDBSubstitution().

+ Here is the call graph for this function:

◆ hasDBRecord()

static ilAdvancedMDClaimingPlugin::hasDBRecord (   $a_record_id)
static

Check if record has db entry.

Parameters
int$a_record_id
Returns
bool

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

75 {
76 global $DIC;
77
78 $ilDB = $DIC['ilDB'];
79
80 $set = $ilDB->query("SELECT record_id FROM adv_md_record" .
81 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
82 return (bool) $ilDB->numRows($set);
83 }

References $DIC, and $ilDB.

◆ isValidObjType()

static ilAdvancedMDClaimingPlugin::isValidObjType (   $a_obj_type,
  $a_is_substitution = false 
)
staticprotected

Validate object type.

Parameters
string$a_obj_type
bool$a_is_substitution
Returns
bool

Definition at line 123 of file class.ilAdvancedMDClaimingPlugin.php.

124 {
125 // ecs not supported yet
126 $valid = array("crs", "cat", "book", "wiki", "glo", "orgu", "prg", 'grp', 'iass');
127
128 if (!$a_is_substitution) {
129 $valid[] = "orgu";
130 $valid[] = "prg";
131 }
132
133 return in_array($a_obj_type, $valid);
134 }
$valid

References $valid.

◆ removeDBFieldSubstitution()

static ilAdvancedMDClaimingPlugin::removeDBFieldSubstitution (   $a_obj_type,
  $a_field_id 
)
static

Remove field substitution entry in DB.

Parameters
string$a_obj_type
int$a_field_id
Returns
bool

Definition at line 529 of file class.ilAdvancedMDClaimingPlugin.php.

530 {
531 global $DIC;
532
533 $ilDB = $DIC['ilDB'];
534
535 if (self::isValidObjType($a_obj_type, true)) {
536 $fields = self::getDBSubstitution($a_obj_type, true);
537 if (!$fields) {
538 return true;
539 } else {
540 $fields = $fields["substitution"][1];
541 }
542
543 $found = false;
544 foreach ($fields as $idx => $field) {
545 if ($field["field_id"] == $a_field_id) {
546 unset($fields[$idx]);
547 $found = true;
548 break;
549 }
550 }
551 if ($found) {
552 $fields = array("substitution" => array("text", serialize($fields)));
553 $ilDB->update(
554 "adv_md_substitutions",
555 $fields,
556 array("obj_type" => array("text", $a_obj_type))
557 );
558 }
559 return true;
560 }
561 return false;
562 }

References $DIC, $ilDB, and getDBSubstitution().

+ Here is the call graph for this function:

◆ saveRecordObjTypes()

static ilAdvancedMDClaimingPlugin::saveRecordObjTypes (   $a_record_id,
array  $a_obj_types 
)
staticprotected

Save object type assignments for record.

Parameters
int$a_record_id
array$a_obj_types

Definition at line 142 of file class.ilAdvancedMDClaimingPlugin.php.

143 {
144 global $DIC;
145
146 $ilDB = $DIC['ilDB'];
147
148 foreach ($a_obj_types as $type) {
149 if (!is_array($type)) {
150 $type = strtolower(trim($type));
151 $subtype = "-";
152 } else {
153 $subtype = strtolower(trim($type[1]));
154 $type = strtolower(trim($type[0]));
155 }
156
157 if (self::isValidObjType($type)) {
158 $fields = array(
159 "record_id" => array("integer", $a_record_id),
160 "obj_type" => array("text", $type),
161 "sub_type" => array("text", $subtype)
162 );
163 $ilDB->insert("adv_md_record_objs", $fields);
164 }
165 }
166 }
$type

References $DIC, $ilDB, and $type.

Referenced by createDBRecord(), and updateDBRecord().

+ Here is the caller graph for this function:

◆ setDBFieldSubstitution()

static ilAdvancedMDClaimingPlugin::setDBFieldSubstitution (   $a_obj_type,
  $a_field_id,
  $a_bold = false,
  $a_newline = false 
)
static

Update field substitution entry in DB.

Parameters
string$a_obj_type
int$a_field_id
bool$a_bold
bool$a_newline
Returns
bool

Definition at line 480 of file class.ilAdvancedMDClaimingPlugin.php.

481 {
482 global $DIC;
483
484 $ilDB = $DIC['ilDB'];
485
486 if (self::isValidObjType($a_obj_type, true)) {
487 $fields = self::getDBSubstitution($a_obj_type, true);
488 if (!$fields) {
489 self::setDBSubstitution($a_obj_type, true, true);
490 $fields = array();
491 } else {
492 $fields = $fields["substitution"][1];
493 }
494
495 $found = false;
496 foreach ($fields as $idx => $field) {
497 if ($field["field_id"] == $a_field_id) {
498 $fields[$idx]["bold"] = (bool) $a_bold;
499 $fields[$idx]["newline"] = (bool) $a_newline;
500 $found = true;
501 break;
502 }
503 }
504 if (!$found) {
505 $fields[] = array(
506 "field_id" => $a_field_id
507 ,"bold" => (bool) $a_bold
508 ,"newline" => (bool) $a_newline
509 );
510 }
511
512 $fields = array("substitution" => array("text", serialize($fields)));
513 $ilDB->update(
514 "adv_md_substitutions",
515 $fields,
516 array("obj_type" => array("text", $a_obj_type))
517 );
518 }
519 return false;
520 }
static setDBSubstitution($a_obj_type, $a_show_description, $a_show_field_names)
Set substitution DB entry (for object type)

References $DIC, $ilDB, getDBSubstitution(), and setDBSubstitution().

+ Here is the call graph for this function:

◆ setDBSubstitution()

static ilAdvancedMDClaimingPlugin::setDBSubstitution (   $a_obj_type,
  $a_show_description,
  $a_show_field_names 
)
static

Set substitution DB entry (for object type)

Parameters
string$a_obj_type
bool$a_show_description
bool$a_show_field_names
Returns
bool

Definition at line 417 of file class.ilAdvancedMDClaimingPlugin.php.

418 {
419 global $DIC;
420
421 $ilDB = $DIC['ilDB'];
422
423 if (self::isValidObjType($a_obj_type, true)) {
424 $fields = self::getDBSubstitution($a_obj_type);
425
426 $create = false;
427 if (!$fields) {
428 $create = true;
429 $fields = array("obj_type" => array("text", $a_obj_type));
430 }
431
432 $fields["hide_description"] = array("integer", !(bool) $a_show_description);
433 $fields["hide_field_names"] = array("integer", !(bool) $a_show_field_names);
434
435 if ($create) {
436 $ilDB->insert("adv_md_substitutions", $fields);
437 } else {
438 $ilDB->update(
439 "adv_md_substitutions",
440 $fields,
441 array("obj_type" => array("text", $a_obj_type))
442 );
443 }
444
445 return true;
446 }
447 return false;
448 }

References $DIC, $ilDB, and getDBSubstitution().

Referenced by setDBFieldSubstitution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ slotInit()

ilAdvancedMDClaimingPlugin::slotInit ( )
finalprotected

Object initialization done by slot.

Must be overwritten in plugin class of plugin slot.

(and should be made protected)

Reimplemented from ilPlugin.

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

42 {
43 require_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDPermissionHelper.php";
44 }

◆ updateDBField()

static ilAdvancedMDClaimingPlugin::updateDBField (   $a_field_id,
  $a_title,
  $a_description = null,
  $a_searchable = false,
array  $a_definition = null 
)
static

Update field db entry.

Parameters
int$a_field_id
string$a_title
string$a_description
bool$a_searchable
array$a_definition
Returns
bool

Definition at line 330 of file class.ilAdvancedMDClaimingPlugin.php.

331 {
332 global $DIC;
333
334 $ilDB = $DIC['ilDB'];
335
336 if (self::hasDBField($a_field_id)) {
337 $fields = array(
338 "field_id" => array("integer", $a_field_id),
339 "title" => array("text", trim($a_title)),
340 "description" => array("text", trim($a_description)),
341 "searchable" => array("integer", (int) $a_searchable)
342 );
343 if ($a_definition) {
344 $fields["field_values"] = array("text", serialize($a_definition));
345 }
346 $ilDB->update(
347 "adv_mdf_definition",
348 $fields,
349 array("field_id" => array("integer", $a_field_id))
350 );
351 return true;
352 }
353
354 return false;
355 }

References $DIC, and $ilDB.

◆ updateDBRecord()

static ilAdvancedMDClaimingPlugin::updateDBRecord (   $a_record_id,
  $a_title,
  $a_description,
  $a_active,
array  $a_obj_types 
)
static

Update record db entry.

Parameters
int$a_record_id
string$a_title
string$a_description
bool$a_active
array$a_obj_types
Returns
bool

Definition at line 178 of file class.ilAdvancedMDClaimingPlugin.php.

179 {
180 global $DIC;
181
182 $ilDB = $DIC['ilDB'];
183
184 if (self::hasDBRecord($a_record_id)) {
185 $fields = array(
186 "title" => array("text", trim($a_title)),
187 "description" => array("text", trim($a_description)),
188 "active" => array("integer", (int) $a_active)
189 );
190 $ilDB->update(
191 "adv_md_record",
192 $fields,
193 array("record_id" => array("integer", $a_record_id))
194 );
195
196 $ilDB->manipulate("DELETE FROM adv_md_record_objs" .
197 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
198
199 self::saveRecordObjTypes($a_record_id, $a_obj_types);
200
201 return true;
202 }
203
204 return false;
205 }

References $DIC, $ilDB, and saveRecordObjTypes().

+ Here is the call graph for this function:

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