ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 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 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 ($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 ()
 Object initialization done by slot. 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...
 
 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 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
 $lang_initialised = false
 
 $id = ''
 

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 268 of file class.ilAdvancedMDClaimingPlugin.php.

269 {
270 global $ilDB;
271
272 if (!self::hasDBRecord($a_record_id)) {
273 return;
274 }
275
276 $field_id = $ilDB->nextId("adv_mdf_definition");
277
278 // validating type
279 $a_type = (int) $a_type;
280 if ($a_type < 1 || $a_type > 8) {
281 return;
282 }
283
284 $pos = self::getDBFieldLastPosition($a_record_id)+1;
285
286 $fields = array(
287 "record_id" => array("integer", $a_record_id),
288 "field_id" => array("integer", $field_id),
289 "import_id" => array("text", "il_" . IL_INST_ID . "_adv_md_field_" . $field_id),
290 "field_type" => array("integer", $a_type),
291 "position" => array("integer", $pos),
292 "title" => array("text", trim($a_title)),
293 "description" => array("text", trim($a_description)),
294 "searchable" => array("integer", (int) $a_searchable)
295 );
296 if ($a_definition) {
297 $fields["field_values"] = array("text", serialize($a_definition));
298 }
299 $ilDB->insert("adv_mdf_definition", $fields);
300
301 return $field_id;
302 }
static getDBFieldLastPosition($a_record_id)
Get last position of record.
global $ilDB
$a_type
Definition: workflow.php:92

References $a_type, $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 92 of file class.ilAdvancedMDClaimingPlugin.php.

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

References $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 345 of file class.ilAdvancedMDClaimingPlugin.php.

346 {
347 global $ilDB;
348
349 if (self::hasDBField($a_field_id)) {
350 $ilDB->manipulate("DELETE FROM adv_mdf_definition" .
351 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
352 return true;
353 }
354
355 return false;
356 }

References $ilDB.

◆ deleteDBRecord()

static ilAdvancedMDClaimingPlugin::deleteDBRecord (   $a_record_id)
static

Delete record db entry.

Parameters
int$a_record_id
Returns
bool

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

206 {
207 global $ilDB;
208
209 if (self::hasDBRecord($a_record_id)) {
210 $ilDB->manipulate("DELETE FROM adv_md_record" .
211 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
212 return true;
213 }
214
215 return false;
216 }

References $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 241 of file class.ilAdvancedMDClaimingPlugin.php.

242 {
243 global $ilDB;
244
245 $sql = "SELECT max(position) pos" .
246 " FROM adv_mdf_definition" .
247 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer");
248 $set = $ilDB->query($sql);
249 if ($ilDB->numRows($set)) {
250 $pos = $ilDB->fetchAssoc($set);
251 return (int) $pos["pos"];
252 }
253
254 return 0;
255 }

References $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 365 of file class.ilAdvancedMDClaimingPlugin.php.

366 {
367 global $ilDB;
368
369 $set = $ilDB->query("SELECT * FROM adv_md_substitutions" .
370 " WHERE obj_type = " . $ilDB->quote($a_obj_type, "text"));
371 if ($ilDB->numRows($set)) {
372 $res = $ilDB->fetchAssoc($set);
373 $res["hide_description"] = array("integer", (bool) $res["hide_description"]);
374 $res["hide_field_names"] = array("integer", (bool) $res["hide_field_names"]);
375
376 if ($a_include_field_data) {
377 $res["substitution"] = array("text", (array) unserialize($res["substitution"]));
378 } else {
379 unset($res["substitution"]);
380 }
381 unset($res["obj_type"]);
382
383 return $res;
384 }
385 }
foreach($_POST as $key=> $value) $res

References $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 224 of file class.ilAdvancedMDClaimingPlugin.php.

225 {
226 global $ilDB;
227
228 $set = $ilDB->query("SELECT field_id FROM adv_mdf_definition" .
229 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
230 return (bool) $ilDB->numRows($set);
231 }

References $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 433 of file class.ilAdvancedMDClaimingPlugin.php.

434 {
435 if (self::isValidObjType($a_obj_type, true)) {
436 $fields = self::getDBSubstitution($a_obj_type, true);
437 $fields = $fields["substitution"][1];
438 foreach ($fields as $field) {
439 if ($field["field_id"] == $a_field_id) {
440 return true;
441 }
442 }
443 return false;
444 }
445 }
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 $ilDB;
77
78 $set = $ilDB->query("SELECT record_id FROM adv_md_record" .
79 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
80 return (bool) $ilDB->numRows($set);
81 }

References $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 119 of file class.ilAdvancedMDClaimingPlugin.php.

120 {
121 // ecs not supported yet
122 $valid = array("crs", "cat", "book", "wiki", "glo", "orgu", "prg");
123
124 if (!$a_is_substitution) {
125 $valid[] = "orgu";
126 $valid[] = "prg";
127 }
128
129 return in_array($a_obj_type, $valid);
130 }
$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 503 of file class.ilAdvancedMDClaimingPlugin.php.

504 {
505 global $ilDB;
506
507 if (self::isValidObjType($a_obj_type, true)) {
508 $fields = self::getDBSubstitution($a_obj_type, true);
509 if (!$fields) {
510 return true;
511 } else {
512 $fields = $fields["substitution"][1];
513 }
514
515 $found = false;
516 foreach ($fields as $idx => $field) {
517 if ($field["field_id"] == $a_field_id) {
518 unset($fields[$idx]);
519 $found = true;
520 break;
521 }
522 }
523 if ($found) {
524 $fields = array("substitution"=>array("text", serialize($fields)));
525 $ilDB->update(
526 "adv_md_substitutions",
527 $fields,
528 array("obj_type" => array("text", $a_obj_type))
529 );
530 }
531 return true;
532 }
533 return false;
534 }

References $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 138 of file class.ilAdvancedMDClaimingPlugin.php.

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

References $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 456 of file class.ilAdvancedMDClaimingPlugin.php.

457 {
458 global $ilDB;
459
460 if (self::isValidObjType($a_obj_type, true)) {
461 $fields = self::getDBSubstitution($a_obj_type, true);
462 if (!$fields) {
463 self::setDBSubstitution($a_obj_type, true, true);
464 $fields = array();
465 } else {
466 $fields = $fields["substitution"][1];
467 }
468
469 $found = false;
470 foreach ($fields as $idx => $field) {
471 if ($field["field_id"] == $a_field_id) {
472 $fields[$idx]["bold"] = (bool) $a_bold;
473 $fields[$idx]["newline"] = (bool) $a_newline;
474 $found = true;
475 break;
476 }
477 }
478 if (!$found) {
479 $fields[] = array(
480 "field_id" => $a_field_id
481 ,"bold" => (bool) $a_bold
482 ,"newline" => (bool) $a_newline
483 );
484 }
485
486 $fields = array("substitution"=>array("text", serialize($fields)));
487 $ilDB->update(
488 "adv_md_substitutions",
489 $fields,
490 array("obj_type" => array("text", $a_obj_type))
491 );
492 }
493 return false;
494 }
static setDBSubstitution($a_obj_type, $a_show_description, $a_show_field_names)
Set substitution DB entry (for object type)

References $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 395 of file class.ilAdvancedMDClaimingPlugin.php.

396 {
397 global $ilDB;
398
399 if (self::isValidObjType($a_obj_type, true)) {
400 $fields = self::getDBSubstitution($a_obj_type);
401
402 $create = false;
403 if (!$fields) {
404 $create = true;
405 $fields = array("obj_type" => array("text", $a_obj_type));
406 }
407
408 $fields["hide_description"] = array("integer", !(bool) $a_show_description);
409 $fields["hide_field_names"] = array("integer", !(bool) $a_show_field_names);
410
411 if ($create) {
412 $ilDB->insert("adv_md_substitutions", $fields);
413 } else {
414 $ilDB->update(
415 "adv_md_substitutions",
416 $fields,
417 array("obj_type" => array("text", $a_obj_type))
418 );
419 }
420
421 return true;
422 }
423 return false;
424 }

References $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 314 of file class.ilAdvancedMDClaimingPlugin.php.

315 {
316 global $ilDB;
317
318 if (self::hasDBField($a_field_id)) {
319 $fields = array(
320 "field_id" => array("integer", $a_field_id),
321 "title" => array("text", trim($a_title)),
322 "description" => array("text", trim($a_description)),
323 "searchable" => array("integer", (int) $a_searchable)
324 );
325 if ($a_definition) {
326 $fields["field_values"] = array("text", serialize($a_definition));
327 }
328 $ilDB->update(
329 "adv_mdf_definition",
330 $fields,
331 array("field_id" => array("integer", $a_field_id))
332 );
333 return true;
334 }
335
336 return false;
337 }

References $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 172 of file class.ilAdvancedMDClaimingPlugin.php.

173 {
174 global $ilDB;
175
176 if (self::hasDBRecord($a_record_id)) {
177 $fields = array(
178 "title" => array("text", trim($a_title)),
179 "description" => array("text", trim($a_description)),
180 "active" => array("integer", (int) $a_active)
181 );
182 $ilDB->update(
183 "adv_md_record",
184 $fields,
185 array("record_id" => array("integer", $a_record_id))
186 );
187
188 $ilDB->manipulate("DELETE FROM adv_md_record_objs" .
189 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer"));
190
191 self::saveRecordObjTypes($a_record_id, $a_obj_types);
192
193 return true;
194 }
195
196 return false;
197 }

References $ilDB, and saveRecordObjTypes().

+ Here is the call graph for this function:

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