Abstract parent class for all advanced md claiming plugin classes.
More...
|
| checkPermission (int $a_user_id, int $a_context_type, int $a_context_id, int $a_action_id, int $a_action_sub_id) |
|
| getMessage () |
|
| __construct (\ilDBInterface $db, \ilComponentRepositoryWrite $component_repository, string $id) |
|
| getPluginName () |
|
| getId () |
|
| getVersion () |
| Only very little classes seem to care about this: More...
|
|
| getDirectory () |
| Only very little classes seem to care about this: More...
|
|
| isActive () |
| Only very little classes seem to care about this: More...
|
|
| needsUpdate () |
|
| install () |
|
| uninstall () |
|
| activate () |
| This will update (if required) and activate the plugin. More...
|
|
| deactivate () |
|
| update () |
|
| 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) |
| ILIAS is moving towards UI components and plugins are expected to use these components. More...
|
|
| getStyleSheetLocation (string $a_css_file) |
| ILIAS is moving towards UI components and plugins are expected to use these components. More...
|
|
| addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname) |
| ILIAS is moving towards UI components and plugins are expected to use these components. More...
|
|
| 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 | hasDBRecord (int $a_record_id) |
|
static | createDBRecord (string $a_title, string $a_description, bool $a_active, array $a_obj_types) |
|
static | updateDBRecord (int $a_record_id, string $a_title, string $a_description, bool $a_active, array $a_obj_types) |
| Update record db entry. More...
|
|
static | deleteDBRecord (int $a_record_id) |
|
static | hasDBField (int $a_field_id) |
|
static | createDBField (int $a_record_id, int $a_type, string $a_title, ?string $a_description=null, bool $a_searchable=false, array $a_definition=null) |
|
static | updateDBField (int $a_field_id, string $a_title, ?string $a_description=null, bool $a_searchable=false, ?array $a_definition=null) |
|
static | deleteDBField (int $a_field_id) |
|
static | setDBSubstitution (string $a_obj_type, bool $a_show_description, bool $a_show_field_names) |
|
static | hasDBFieldSubstitution (string $a_obj_type, int $a_field_id) |
|
static | setDBFieldSubstitution (string $a_obj_type, int $a_field_id, bool $a_bold=false, bool $a_newline=false) |
|
static | removeDBFieldSubstitution (string $a_obj_type, int $a_field_id) |
|
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
Definition at line 12 of file class.ilAdvancedMDClaimingPlugin.php.
◆ checkPermission()
ilAdvancedMDClaimingPlugin::checkPermission |
( |
int |
$a_user_id, |
|
|
int |
$a_context_type, |
|
|
int |
$a_context_id, |
|
|
int |
$a_action_id, |
|
|
int |
$a_action_sub_id |
|
) |
| |
|
abstract |
◆ createDBField()
static ilAdvancedMDClaimingPlugin::createDBField |
( |
int |
$a_record_id, |
|
|
int |
$a_type, |
|
|
string |
$a_title, |
|
|
?string |
$a_description = null , |
|
|
bool |
$a_searchable = false , |
|
|
array |
$a_definition = null |
|
) |
| |
|
static |
Definition at line 197 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, $res, IL_INST_ID, ilAdvancedMDFieldDefinition\isValidType(), ilDBConstants\T_INTEGER, ilDBConstants\T_TEXT, ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_SELECT_MULTI.
207 $ilDB = $DIC->database();
209 if (!self::hasDBRecord($a_record_id)) {
213 $field_id =
$ilDB->nextId(
"adv_mdf_definition");
220 $options_in_different_table = $a_definition &&
224 $pos = self::getDBFieldLastPosition($a_record_id) + 1;
227 "record_id" => array(
"integer", $a_record_id),
228 "field_id" => array(
"integer", $field_id),
229 "import_id" => array(
"text",
"il_" .
IL_INST_ID .
"_adv_md_field_" . $field_id),
230 "field_type" => array(
"integer", $a_type),
231 "position" => array(
"integer", $pos),
232 "title" => array(
"text", trim($a_title)),
233 "description" => array(
"text", trim((
string) $a_description)),
234 "searchable" => array(
"integer", (
int) $a_searchable)
236 if ($a_definition && !$options_in_different_table) {
237 $fields[
"field_values"] = array(
"text", serialize($a_definition));
239 $ilDB->insert(
"adv_mdf_definition", $fields);
241 if ($options_in_different_table) {
243 'DELETE FROM adv_mdf_enum WHERE field_id = ' .
247 $default_language =
'';
249 'SELECT lang_default FROM adv_md_record WHERE record_id = ' .
250 $ilDB->quote($a_record_id,
'integer')
252 if ($row =
$res->fetchAssoc()) {
253 $default_language = (string) $row[
'lang_default'];
257 foreach ($a_definition as $option) {
258 if (!is_string($option)) {
static isValidType(int $a_type)
◆ createDBRecord()
static ilAdvancedMDClaimingPlugin::createDBRecord |
( |
string |
$a_title, |
|
|
string |
$a_description, |
|
|
bool |
$a_active, |
|
|
array |
$a_obj_types |
|
) |
| |
|
static |
- Parameters
-
string | $a_title | |
string | $a_description | |
bool | $a_active | |
| string[] | $a_obj_types |
- Returns
- int
Definition at line 39 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and IL_INST_ID.
47 $ilDB = $DIC->database();
49 $record_id =
$ilDB->nextId(
"adv_md_record");
52 "record_id" => array(
"integer", $record_id),
53 "import_id" => array(
"text",
'il_' .
IL_INST_ID .
'_adv_md_record_' . $record_id),
54 "title" => array(
"text", trim($a_title)),
55 "description" => array(
"text", trim($a_description)),
56 "active" => array(
"integer", (
int) $a_active)
58 $ilDB->insert(
"adv_md_record", $fields);
59 self::saveRecordObjTypes($record_id, $a_obj_types);
◆ deleteDBField()
static ilAdvancedMDClaimingPlugin::deleteDBField |
( |
int |
$a_field_id | ) |
|
|
static |
◆ deleteDBRecord()
static ilAdvancedMDClaimingPlugin::deleteDBRecord |
( |
int |
$a_record_id | ) |
|
|
static |
◆ getDBFieldLastPosition()
static ilAdvancedMDClaimingPlugin::getDBFieldLastPosition |
( |
int |
$a_record_id | ) |
|
|
staticprotected |
◆ getDBSubstitution()
static ilAdvancedMDClaimingPlugin::getDBSubstitution |
( |
string |
$a_obj_type, |
|
|
bool |
$a_include_field_data = false |
|
) |
| |
|
staticprotected |
Definition at line 324 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and $res.
328 $ilDB = $DIC->database();
330 $set =
$ilDB->query(
"SELECT * FROM adv_md_substitutions" .
331 " WHERE obj_type = " .
$ilDB->quote($a_obj_type,
"text"));
332 if (
$ilDB->numRows($set)) {
334 $res[
"hide_description"] = array(
"integer", (
bool)
$res[
"hide_description"]);
335 $res[
"hide_field_names"] = array(
"integer", (
bool)
$res[
"hide_field_names"]);
337 if ($a_include_field_data) {
338 $res[
"substitution"] = array(
"text", (array) unserialize(
$res[
"substitution"]));
340 unset(
$res[
"substitution"]);
342 unset(
$res[
"obj_type"]);
◆ hasDBField()
static ilAdvancedMDClaimingPlugin::hasDBField |
( |
int |
$a_field_id | ) |
|
|
static |
◆ hasDBFieldSubstitution()
static ilAdvancedMDClaimingPlugin::hasDBFieldSubstitution |
( |
string |
$a_obj_type, |
|
|
int |
$a_field_id |
|
) |
| |
|
static |
Definition at line 385 of file class.ilAdvancedMDClaimingPlugin.php.
387 if (self::isValidObjType($a_obj_type,
true)) {
388 $fields = self::getDBSubstitution($a_obj_type,
true);
389 $fields = $fields[
"substitution"][1];
390 foreach ($fields as $field) {
391 if ($field[
"field_id"] == $a_field_id) {
◆ hasDBRecord()
static ilAdvancedMDClaimingPlugin::hasDBRecord |
( |
int |
$a_record_id | ) |
|
|
static |
◆ isValidObjType()
static ilAdvancedMDClaimingPlugin::isValidObjType |
( |
string |
$a_obj_type, |
|
|
bool |
$a_is_substitution = false |
|
) |
| |
|
staticprotected |
◆ removeDBFieldSubstitution()
static ilAdvancedMDClaimingPlugin::removeDBFieldSubstitution |
( |
string |
$a_obj_type, |
|
|
int |
$a_field_id |
|
) |
| |
|
static |
Definition at line 447 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
451 $ilDB = $DIC->database();
453 if (self::isValidObjType($a_obj_type,
true)) {
454 $fields = self::getDBSubstitution($a_obj_type,
true);
458 $fields = $fields[
"substitution"][1];
462 foreach ($fields as $idx => $field) {
463 if ($field[
"field_id"] == $a_field_id) {
464 unset($fields[$idx]);
470 $fields = array(
"substitution" => array(
"text", serialize($fields)));
472 "adv_md_substitutions",
474 array(
"obj_type" => array(
"text", $a_obj_type))
◆ saveRecordObjTypes()
static ilAdvancedMDClaimingPlugin::saveRecordObjTypes |
( |
int |
$a_record_id, |
|
|
array |
$a_obj_types |
|
) |
| |
|
staticprotected |
Save object type assignments for record.
- Parameters
-
int | $a_record_id | |
| string[] | $a_obj_types |
Definition at line 85 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and $type.
88 $ilDB = $DIC->database();
90 foreach ($a_obj_types as
$type) {
91 if (!is_array($type)) {
92 $type = strtolower(trim($type));
95 $subtype = strtolower(trim($type[1]));
96 $type = strtolower(trim($type[0]));
99 if (self::isValidObjType($type)) {
101 "record_id" => array(
"integer", $a_record_id),
102 "obj_type" => array(
"text", $type),
103 "sub_type" => array(
"text", $subtype)
105 $ilDB->insert(
"adv_md_record_objs", $fields);
◆ setDBFieldSubstitution()
static ilAdvancedMDClaimingPlugin::setDBFieldSubstitution |
( |
string |
$a_obj_type, |
|
|
int |
$a_field_id, |
|
|
bool |
$a_bold = false , |
|
|
bool |
$a_newline = false |
|
) |
| |
|
static |
Definition at line 399 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
407 $ilDB = $DIC->database();
409 if (self::isValidObjType($a_obj_type,
true)) {
410 $fields = self::getDBSubstitution($a_obj_type,
true);
412 self::setDBSubstitution($a_obj_type,
true,
true);
415 $fields = $fields[
"substitution"][1];
419 foreach ($fields as $idx => $field) {
420 if ($field[
"field_id"] == $a_field_id) {
421 $fields[$idx][
"bold"] = $a_bold;
422 $fields[$idx][
"newline"] = $a_newline;
429 "field_id" => $a_field_id
433 "newline" => $a_newline
437 $fields = array(
"substitution" => array(
"text", serialize($fields)));
439 "adv_md_substitutions",
441 array(
"obj_type" => array(
"text", $a_obj_type))
◆ setDBSubstitution()
static ilAdvancedMDClaimingPlugin::setDBSubstitution |
( |
string |
$a_obj_type, |
|
|
bool |
$a_show_description, |
|
|
bool |
$a_show_field_names |
|
) |
| |
|
static |
Definition at line 349 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
356 $ilDB = $DIC->database();
358 if (self::isValidObjType($a_obj_type,
true)) {
359 $fields = self::getDBSubstitution($a_obj_type);
364 $fields = array(
"obj_type" => array(
"text", $a_obj_type));
367 $fields[
"hide_description"] = array(
"integer", !$a_show_description);
368 $fields[
"hide_field_names"] = array(
"integer", !$a_show_field_names);
371 $ilDB->insert(
"adv_md_substitutions", $fields);
374 "adv_md_substitutions",
376 array(
"obj_type" => array(
"text", $a_obj_type))
◆ updateDBField()
static ilAdvancedMDClaimingPlugin::updateDBField |
( |
int |
$a_field_id, |
|
|
string |
$a_title, |
|
|
?string |
$a_description = null , |
|
|
bool |
$a_searchable = false , |
|
|
?array |
$a_definition = null |
|
) |
| |
|
static |
Definition at line 277 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
286 $ilDB = $DIC->database();
288 if (self::hasDBField($a_field_id)) {
290 "field_id" => array(
"integer", $a_field_id),
291 "title" => array(
"text", trim($a_title)),
292 "description" => array(
"text", trim($a_description)),
293 "searchable" => array(
"integer", (
int) $a_searchable)
296 $fields[
"field_values"] = array(
"text", serialize($a_definition));
299 "adv_mdf_definition",
301 array(
"field_id" => array(
"integer", $a_field_id))
◆ updateDBRecord()
static ilAdvancedMDClaimingPlugin::updateDBRecord |
( |
int |
$a_record_id, |
|
|
string |
$a_title, |
|
|
string |
$a_description, |
|
|
bool |
$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 | |
| string[] | $a_obj_types |
- Returns
- bool
Definition at line 119 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
128 $ilDB = $DIC->database();
130 if (self::hasDBRecord($a_record_id)) {
132 "title" => array(
"text", trim($a_title)),
133 "description" => array(
"text", trim($a_description)),
134 "active" => array(
"integer", (
int) $a_active)
139 array(
"record_id" => array(
"integer", $a_record_id))
142 $ilDB->manipulate(
"DELETE FROM adv_md_record_objs" .
143 " WHERE record_id = " .
$ilDB->quote($a_record_id,
"integer"));
145 self::saveRecordObjTypes($a_record_id, $a_obj_types);
The documentation for this class was generated from the following file: