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 26 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 211 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, $res, IL_INST_ID, ilAdvancedMDFieldDefinition\isValidType(), null, ilDBConstants\T_INTEGER, ilDBConstants\T_TEXT, ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_SELECT_MULTI.
221 $ilDB = $DIC->database();
223 if (!self::hasDBRecord($a_record_id)) {
227 $field_id =
$ilDB->nextId(
"adv_mdf_definition");
234 $options_in_different_table = $a_definition &&
238 $pos = self::getDBFieldLastPosition($a_record_id) + 1;
241 "record_id" => array(
"integer", $a_record_id),
242 "field_id" => array(
"integer", $field_id),
243 "import_id" => array(
"text",
"il_" .
IL_INST_ID .
"_adv_md_field_" . $field_id),
244 "field_type" => array(
"integer", $a_type),
245 "position" => array(
"integer", $pos),
246 "title" => array(
"text", trim($a_title)),
247 "description" => array(
"text", trim((
string) $a_description)),
248 "searchable" => array(
"integer", (
int) $a_searchable)
250 if ($a_definition && !$options_in_different_table) {
251 $fields[
"field_values"] = array(
"text", serialize($a_definition));
253 $ilDB->insert(
"adv_mdf_definition", $fields);
255 if ($options_in_different_table) {
257 'DELETE FROM adv_mdf_enum WHERE field_id = ' .
261 $default_language =
'';
263 'SELECT lang_default FROM adv_md_record WHERE record_id = ' .
264 $ilDB->quote($a_record_id,
'integer')
266 if ($row =
$res->fetchAssoc()) {
267 $default_language = (string) $row[
'lang_default'];
271 foreach ($a_definition as $option) {
272 if (!is_string($option)) {
static isValidType(int $a_type)
const TYPE_SELECT
TODO: put this in when minimum php version is set to 8.2.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ 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 53 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and IL_INST_ID.
61 $ilDB = $DIC->database();
63 $record_id =
$ilDB->nextId(
"adv_md_record");
66 "record_id" => array(
"integer", $record_id),
67 "import_id" => array(
"text",
'il_' .
IL_INST_ID .
'_adv_md_record_' . $record_id),
68 "title" => array(
"text", trim($a_title)),
69 "description" => array(
"text", trim($a_description)),
70 "active" => array(
"integer", (
int) $a_active)
72 $ilDB->insert(
"adv_md_record", $fields);
73 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 |
- See also
- ilAdvancedMDFieldDefinition::getLastPosition()
Definition at line 194 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
198 $ilDB = $DIC->database();
200 $sql =
"SELECT max(position) pos" .
201 " FROM adv_mdf_definition" .
202 " WHERE record_id = " .
$ilDB->quote($a_record_id,
"integer");
203 $set =
$ilDB->query($sql);
204 if (
$ilDB->numRows($set)) {
205 $pos =
$ilDB->fetchAssoc($set);
206 return (
int) $pos[
"pos"];
◆ getDBSubstitution()
static ilAdvancedMDClaimingPlugin::getDBSubstitution |
( |
string |
$a_obj_type, |
|
|
bool |
$a_include_field_data = false |
|
) |
| |
|
staticprotected |
Definition at line 339 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and $res.
343 $ilDB = $DIC->database();
345 $set =
$ilDB->query(
"SELECT * FROM adv_md_substitutions" .
346 " WHERE obj_type = " .
$ilDB->quote($a_obj_type,
"text"));
347 if (
$ilDB->numRows($set)) {
349 $res[
"hide_description"] = array(
"integer", (
bool)
$res[
"hide_description"]);
350 $res[
"hide_field_names"] = array(
"integer", (
bool)
$res[
"hide_field_names"]);
352 if ($a_include_field_data) {
353 $res[
"substitution"] = array(
"text", (array) unserialize(
$res[
"substitution"]));
355 unset(
$res[
"substitution"]);
357 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 400 of file class.ilAdvancedMDClaimingPlugin.php.
402 if (self::isValidObjType($a_obj_type,
true)) {
403 $fields = self::getDBSubstitution($a_obj_type,
true);
404 $fields = $fields[
"substitution"][1];
405 foreach ($fields as $field) {
406 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 462 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
466 $ilDB = $DIC->database();
468 if (self::isValidObjType($a_obj_type,
true)) {
469 $fields = self::getDBSubstitution($a_obj_type,
true);
473 $fields = $fields[
"substitution"][1];
477 foreach ($fields as $idx => $field) {
478 if ($field[
"field_id"] == $a_field_id) {
479 unset($fields[$idx]);
485 $fields = array(
"substitution" => array(
"text", serialize($fields)));
487 "adv_md_substitutions",
489 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 99 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
102 $ilDB = $DIC->database();
104 foreach ($a_obj_types as $type) {
105 if (!is_array($type)) {
106 $type = strtolower(trim($type));
109 $subtype = strtolower(trim($type[1]));
110 $type = strtolower(trim($type[0]));
113 if (self::isValidObjType($type)) {
115 "record_id" => array(
"integer", $a_record_id),
116 "obj_type" => array(
"text", $type),
117 "sub_type" => array(
"text", $subtype)
119 $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 414 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
422 $ilDB = $DIC->database();
424 if (self::isValidObjType($a_obj_type,
true)) {
425 $fields = self::getDBSubstitution($a_obj_type,
true);
427 self::setDBSubstitution($a_obj_type,
true,
true);
430 $fields = $fields[
"substitution"][1];
434 foreach ($fields as $idx => $field) {
435 if ($field[
"field_id"] == $a_field_id) {
436 $fields[$idx][
"bold"] = $a_bold;
437 $fields[$idx][
"newline"] = $a_newline;
444 "field_id" => $a_field_id
448 "newline" => $a_newline
452 $fields = array(
"substitution" => array(
"text", serialize($fields)));
454 "adv_md_substitutions",
456 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 364 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
371 $ilDB = $DIC->database();
373 if (self::isValidObjType($a_obj_type,
true)) {
374 $fields = self::getDBSubstitution($a_obj_type);
379 $fields = array(
"obj_type" => array(
"text", $a_obj_type));
382 $fields[
"hide_description"] = array(
"integer", !$a_show_description);
383 $fields[
"hide_field_names"] = array(
"integer", !$a_show_field_names);
386 $ilDB->insert(
"adv_md_substitutions", $fields);
389 "adv_md_substitutions",
391 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 292 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
301 $ilDB = $DIC->database();
303 if (self::hasDBField($a_field_id)) {
305 "field_id" => array(
"integer", $a_field_id),
306 "title" => array(
"text", trim($a_title)),
307 "description" => array(
"text", trim($a_description)),
308 "searchable" => array(
"integer", (
int) $a_searchable)
311 $fields[
"field_values"] = array(
"text", serialize($a_definition));
314 "adv_mdf_definition",
316 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 133 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
142 $ilDB = $DIC->database();
144 if (self::hasDBRecord($a_record_id)) {
146 "title" => array(
"text", trim($a_title)),
147 "description" => array(
"text", trim($a_description)),
148 "active" => array(
"integer", (
int) $a_active)
153 array(
"record_id" => array(
"integer", $a_record_id))
156 $ilDB->manipulate(
"DELETE FROM adv_md_record_objs" .
157 " WHERE record_id = " .
$ilDB->quote($a_record_id,
"integer"));
159 self::saveRecordObjTypes($a_record_id, $a_obj_types);
The documentation for this class was generated from the following file: