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)
const TYPE_SELECT
TODO: put this in when minimum php version is set to 8.2.
◆ 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 |
- See also
- ilAdvancedMDFieldDefinition::getLastPosition()
Definition at line 180 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
184 $ilDB = $DIC->database();
186 $sql =
"SELECT max(position) pos" .
187 " FROM adv_mdf_definition" .
188 " WHERE record_id = " .
$ilDB->quote($a_record_id,
"integer");
189 $set =
$ilDB->query($sql);
190 if (
$ilDB->numRows($set)) {
191 $pos =
$ilDB->fetchAssoc($set);
192 return (
int) $pos[
"pos"];
◆ getDBSubstitution()
| static ilAdvancedMDClaimingPlugin::getDBSubstitution |
( |
string |
$a_obj_type, |
|
|
bool |
$a_include_field_data = false |
|
) |
| |
|
staticprotected |
Definition at line 325 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, $ilDB, and $res.
329 $ilDB = $DIC->database();
331 $set =
$ilDB->query(
"SELECT * FROM adv_md_substitutions" .
332 " WHERE obj_type = " .
$ilDB->quote($a_obj_type,
"text"));
333 if (
$ilDB->numRows($set)) {
335 $res[
"hide_description"] = array(
"integer", (
bool)
$res[
"hide_description"]);
336 $res[
"hide_field_names"] = array(
"integer", (
bool)
$res[
"hide_field_names"]);
338 if ($a_include_field_data) {
339 $res[
"substitution"] = array(
"text", (array) unserialize(
$res[
"substitution"]));
341 unset(
$res[
"substitution"]);
343 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 386 of file class.ilAdvancedMDClaimingPlugin.php.
388 if (self::isValidObjType($a_obj_type,
true)) {
389 $fields = self::getDBSubstitution($a_obj_type,
true);
390 $fields = $fields[
"substitution"][1];
391 foreach ($fields as $field) {
392 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 448 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
452 $ilDB = $DIC->database();
454 if (self::isValidObjType($a_obj_type,
true)) {
455 $fields = self::getDBSubstitution($a_obj_type,
true);
459 $fields = $fields[
"substitution"][1];
463 foreach ($fields as $idx => $field) {
464 if ($field[
"field_id"] == $a_field_id) {
465 unset($fields[$idx]);
471 $fields = array(
"substitution" => array(
"text", serialize($fields)));
473 "adv_md_substitutions",
475 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, and $ilDB.
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 400 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
408 $ilDB = $DIC->database();
410 if (self::isValidObjType($a_obj_type,
true)) {
411 $fields = self::getDBSubstitution($a_obj_type,
true);
413 self::setDBSubstitution($a_obj_type,
true,
true);
416 $fields = $fields[
"substitution"][1];
420 foreach ($fields as $idx => $field) {
421 if ($field[
"field_id"] == $a_field_id) {
422 $fields[$idx][
"bold"] = $a_bold;
423 $fields[$idx][
"newline"] = $a_newline;
430 "field_id" => $a_field_id
434 "newline" => $a_newline
438 $fields = array(
"substitution" => array(
"text", serialize($fields)));
440 "adv_md_substitutions",
442 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 350 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
357 $ilDB = $DIC->database();
359 if (self::isValidObjType($a_obj_type,
true)) {
360 $fields = self::getDBSubstitution($a_obj_type);
365 $fields = array(
"obj_type" => array(
"text", $a_obj_type));
368 $fields[
"hide_description"] = array(
"integer", !$a_show_description);
369 $fields[
"hide_field_names"] = array(
"integer", !$a_show_field_names);
372 $ilDB->insert(
"adv_md_substitutions", $fields);
375 "adv_md_substitutions",
377 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 278 of file class.ilAdvancedMDClaimingPlugin.php.
References $DIC, and $ilDB.
287 $ilDB = $DIC->database();
289 if (self::hasDBField($a_field_id)) {
291 "field_id" => array(
"integer", $a_field_id),
292 "title" => array(
"text", trim($a_title)),
293 "description" => array(
"text", trim($a_description)),
294 "searchable" => array(
"integer", (
int) $a_searchable)
297 $fields[
"field_values"] = array(
"text", serialize($a_definition));
300 "adv_mdf_definition",
302 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: