ILIAS  release_8 Revision v8.24
ilUDFClaimingPlugin Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilUDFClaimingPlugin:
+ Collaboration diagram for ilUDFClaimingPlugin:

Public Member Functions

 checkPermission (int $a_user_id, int $a_context_type, int $a_context_id, int $a_action_id, int $a_action_sub_id)
 Check permission. More...
 
- Public Member Functions inherited from ilPlugin
 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)
 @deprecate ILIAS is moving towards UI components and plugins are expected to use these components. More...
 
 getStyleSheetLocation (string $a_css_file)
 @deprecate ILIAS is moving towards UI components and plugins are expected to use these components. More...
 
 addBlockFile ($a_tpl, $a_var, $a_block, $a_tplname)
 @deprecate 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 Public Member Functions

static hasDBField (string $a_field_id)
 Check if field has db entry. More...
 
static createDBField (int $a_type, string $a_title, array $a_access=null, array $a_options=null)
 Create field db entry. More...
 
static updateDBField (int $a_field_id, string $a_title, array $a_access=null, array $a_options=null)
 Update field db entry. More...
 
static deleteDBField (int $a_field_id)
 Delete field db entry. More...
 

Static Protected Member Functions

static getDBField (string $a_field_id)
 Get existing field values. More...
 
static isValidFieldType (int $a_field_type)
 Validate field type. More...
 
static handleAccesss (array &$fields, ?array $a_access=null, ?array $a_existing=null)
 Convert access array to DB columns. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilPlugin
 init ()
 Object initialization. More...
 
 getPluginInfo ()
 
 getComponentInfo ()
 
 getPluginSlotInfo ()
 
 afterInstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the install method in your subclass instead. More...
 
 beforeUninstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead. More...
 
 afterUninstall ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the uninstall method in your subclass instead. More...
 
 beforeActivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 afterActivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 afterDeactivation ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the activate method in your subclass instead. More...
 
 updateDatabase ()
 
 beforeUpdate ()
 @deprecate If you cannot get rid of the requirement to use this, adjust the update method in your subclass instead. More...
 
 afterUpdate ()
 
 getLanguageHandler ()
 
 buildLanguageHandler ()
 
 readEventListening ()
 
 clearEventListening ()
 
- Protected Attributes inherited from ilPlugin
ilDBInterface $db
 
ilComponentRepositoryWrite $component_repository
 
string $id
 
ilPluginLanguage $language_handler = null
 
bool $lang_initialised = false
 
ProviderCollection $provider_collection
 
string $message = ''
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Abstract parent class for all udf 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 23 of file class.ilUDFClaimingPlugin.php.

Member Function Documentation

◆ checkPermission()

ilUDFClaimingPlugin::checkPermission ( int  $a_user_id,
int  $a_context_type,
int  $a_context_id,
int  $a_action_id,
int  $a_action_sub_id 
)
abstract

Check permission.

◆ createDBField()

static ilUDFClaimingPlugin::createDBField ( int  $a_type,
string  $a_title,
array  $a_access = null,
array  $a_options = null 
)
static

Create field db entry.

Definition at line 107 of file class.ilUDFClaimingPlugin.php.

112 : ?int {
113 global $DIC;
114
115 $ilDB = $DIC['ilDB'];
116
117 $field_id = $ilDB->nextId("udf_definition");
118
119 // validating type
120 if (!self::isValidFieldType($a_type)) {
121 return null;
122 }
123
124 if ($a_type != UDF_TYPE_SELECT) {
125 $a_options = null;
126 }
127
128 // :TODO: check unique title?
129
130 $fields = array(
131 "field_id" => array("integer", $field_id),
132 "field_type" => array("integer", $a_type),
133 "field_name" => array("text", trim($a_title)),
134 "field_values" => array("text", serialize((array) $a_options))
135 );
136
137 self::handleAccesss($fields, $a_access);
138
139 $ilDB->insert("udf_definition", $fields);
140
141 return $field_id;
142 }
const UDF_TYPE_SELECT
static handleAccesss(array &$fields, ?array $a_access=null, ?array $a_existing=null)
Convert access array to DB columns.
global $DIC
Definition: feed.php:28

◆ deleteDBField()

static ilUDFClaimingPlugin::deleteDBField ( int  $a_field_id)
static

Delete field db entry.

Definition at line 185 of file class.ilUDFClaimingPlugin.php.

185 : bool
186 {
187 global $DIC;
188
189 $ilDB = $DIC['ilDB'];
190
191 if (self::hasDBField($a_field_id)) {
192 // :TODO: we are not deleting any values here
193
194 $ilDB->manipulate("DELETE FROM udf_definition" .
195 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
196 return true;
197 }
198
199 return false;
200 }

References $DIC, and $ilDB.

◆ getDBField()

static ilUDFClaimingPlugin::getDBField ( string  $a_field_id)
staticprotected

Get existing field values.

Definition at line 62 of file class.ilUDFClaimingPlugin.php.

62 : array // Missing array type.
63 {
64 global $DIC;
65
66 $ilDB = $DIC['ilDB'];
67
68 $set = $ilDB->query("SELECT * FROM udf_definition" .
69 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
70 return $ilDB->fetchAssoc($set);
71 }

References $DIC, and $ilDB.

◆ handleAccesss()

static ilUDFClaimingPlugin::handleAccesss ( array &  $fields,
?array  $a_access = null,
?array  $a_existing = null 
)
staticprotected

Convert access array to DB columns.

Definition at line 85 of file class.ilUDFClaimingPlugin.php.

89 : void {
90 $map = array("visible", "changeable", "searchable", "required", "export",
91 "course_export", "group_export", "registration_visible", "visible_lua",
92 "changeable_lua", "certificate");
93 foreach ($map as $prop) {
94 if (isset($a_access[$prop])) {
95 $fields[$prop] = array("integer", (int) $a_access[$prop]);
96 } elseif (isset($a_existing[$prop])) {
97 $fields[$prop] = array("integer", (int) $a_existing[$prop]);
98 } else {
99 $fields[$prop] = array("integer", 0);
100 }
101 }
102 }

◆ hasDBField()

static ilUDFClaimingPlugin::hasDBField ( string  $a_field_id)
static

Check if field has db entry.

Definition at line 48 of file class.ilUDFClaimingPlugin.php.

48 : bool
49 {
50 global $DIC;
51
52 $ilDB = $DIC['ilDB'];
53
54 $set = $ilDB->query("SELECT field_id FROM udf_definition" .
55 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
56 return (bool) $ilDB->numRows($set);
57 }

References $DIC, and $ilDB.

◆ isValidFieldType()

static ilUDFClaimingPlugin::isValidFieldType ( int  $a_field_type)
staticprotected

Validate field type.

Definition at line 76 of file class.ilUDFClaimingPlugin.php.

76 : bool
77 {
79 return in_array($a_field_type, $valid);
80 }
const UDF_TYPE_WYSIWYG
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$valid

References $valid, UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

◆ updateDBField()

static ilUDFClaimingPlugin::updateDBField ( int  $a_field_id,
string  $a_title,
array  $a_access = null,
array  $a_options = null 
)
static

Update field db entry.

Definition at line 147 of file class.ilUDFClaimingPlugin.php.

152 : bool {
153 global $DIC;
154
155 $ilDB = $DIC['ilDB'];
156
157 if (self::hasDBField($a_field_id)) {
158 $old = self::getDBField($a_field_id);
159
160 if ($old["field_type"] != UDF_TYPE_SELECT) {
161 $a_options = null;
162 }
163
164 $fields = array(
165 "field_name" => array("text", trim($a_title)),
166 "field_values" => array("text", serialize((array) $a_options))
167 );
168
169 self::handleAccesss($fields, $a_access, $old);
170
171 $ilDB->update(
172 "udf_definition",
173 $fields,
174 array("field_id" => array("integer", $a_field_id))
175 );
176 return true;
177 }
178
179 return false;
180 }
static getDBField(string $a_field_id)
Get existing field values.

References $ilDB, and UDF_TYPE_SELECT.


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