ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserDefinedFields Class Reference

Additional user data fields definition. More...

+ Collaboration diagram for ilUserDefinedFields:

Public Member Functions

 fetchFieldIdFromImportId (string $a_import_id)
 
 fetchFieldIdFromName (string $a_name)
 
 getDefinitions ()
 
 getDefinition (int $a_id)
 
 getVisibleDefinitions ()
 
 getLocalUserAdministrationDefinitions ()
 
 getChangeableLocalUserAdministrationDefinitions ()
 
 getRegistrationDefinitions ()
 
 getSearchableDefinitions ()
 
 getRequiredDefinitions ()
 
 getCourseExportableFields ()
 
 getGroupExportableFields ()
 
 getExportableFields (int $a_obj_id)
 Get exportable field. More...
 
 setFieldName (string $a_name)
 
 getFieldName ()
 
 setFieldType (int $a_type)
 
 isPluginType ()
 
 getFieldType ()
 
 setFieldValues (array $a_values)
 
 getFieldValues ()
 
 enableVisible (bool $a_visible)
 
 enabledVisible ()
 
 enableVisibleLocalUserAdministration (bool $a_visible)
 
 enabledVisibleLocalUserAdministration ()
 
 enableChangeable (bool $a_changeable)
 
 enabledChangeable ()
 
 enableChangeableLocalUserAdministration (bool $a_changeable)
 
 enabledChangeableLocalUserAdministration ()
 
 enableRequired (bool $a_required)
 
 enabledRequired ()
 
 enableSearchable (bool $a_searchable)
 
 enabledSearchable ()
 
 enableExport (bool $a_export)
 
 enabledExport ()
 
 enableCourseExport (bool $a_course_export)
 
 enabledCourseExport ()
 
 enableGroupExport (bool $a_group_export)
 
 enabledGroupExport ()
 
 enableCertificate (bool $a_c)
 
 enabledCertificate ()
 
 enableVisibleRegistration (bool $a_visible_registration)
 
 enabledVisibleRegistration ()
 
 fieldValuesToSelectArray (array $a_values, bool $a_with_selection_info=true)
 
 validateValues ()
 
 nameExists (string $a_field_name)
 
 add ()
 
 delete (int $a_id)
 
 update (int $a_id)
 
 deleteValue (int $a_field_id, int $a_value_id)
 
 toXML ()
 
 addToXML (ilXmlWriter $xml_writer)
 add user defined field data to xml (using usr dtd) More...
 

Static Public Member Functions

static _getInstance ()
 
static _newInstance ()
 

Data Fields

ilDBInterface $db = null
 
array $definitions = array()
 

Protected Member Functions

 __read ()
 

Protected Attributes

bool $field_certificate = false
 
bool $field_group_export = false
 
bool $field_course_export = false
 
bool $field_export = false
 
bool $field_searchable = false
 
bool $field_required = false
 
bool $field_changeable_lua = false
 
bool $field_changeable = false
 
bool $field_visib_lua = false
 
array $field_values = []
 
int $field_type = 0
 
string $field_name = ""
 
bool $field_visible = false
 

Private Member Functions

 __construct ()
 

Private Attributes

int $field_visible_registration = 0
 

Detailed Description

Additional user data fields definition.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 29 of file class.ilUserDefinedFields.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserDefinedFields::__construct ( )
private

Definition at line 51 of file class.ilUserDefinedFields.php.

References $DIC, and __read().

52  {
53  global $DIC;
54 
55  $this->db = $DIC->database();
56  $this->__read();
57  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilUserDefinedFields::__read ( )
protected

Definition at line 520 of file class.ilUserDefinedFields.php.

References $DIC, $ilSetting, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ilArrayUtil\sortArray().

Referenced by __construct(), add(), delete(), deleteValue(), and update().

520  : void
521  {
522  global $DIC;
523 
524  $ilSetting = $DIC['ilSetting'];
525 
526  $query = "SELECT * FROM udf_definition ";
527  $res = $this->db->query($query);
528 
529  $this->definitions = array();
530  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
531  $this->definitions[$row->field_id]['field_id'] = $row->field_id;
532  $this->definitions[$row->field_id]['field_name'] = $row->field_name;
533  $this->definitions[$row->field_id]['field_type'] = $row->field_type;
534  $this->definitions[$row->field_id]['il_id'] = 'il_' . $ilSetting->get('inst_id', '0') . '_udf_' . $row->field_id;
535 
536  // #16953
537  $tmp = $sort = array();
538  $is_numeric = true;
539  foreach ((array) unserialize($row->field_values, ['allowed_classes' => false]) as $item) {
540  if (!is_numeric($item)) {
541  $is_numeric = false;
542  }
543  $sort[] = array("value" => $item);
544  }
545  foreach (ilArrayUtil::sortArray($sort, "value", "asc", $is_numeric) as $item) {
546  $tmp[] = $item["value"];
547  }
548 
549  $this->definitions[$row->field_id]['field_values'] = $tmp;
550  $this->definitions[$row->field_id]['visible'] = $row->visible;
551  $this->definitions[$row->field_id]['changeable'] = $row->changeable;
552  $this->definitions[$row->field_id]['required'] = $row->required;
553  $this->definitions[$row->field_id]['searchable'] = $row->searchable;
554  $this->definitions[$row->field_id]['export'] = $row->export;
555  $this->definitions[$row->field_id]['course_export'] = $row->course_export;
556  $this->definitions[$row->field_id]['visib_reg'] = $row->registration_visible;
557  $this->definitions[$row->field_id]['visib_lua'] = $row->visible_lua;
558  $this->definitions[$row->field_id]['changeable_lua'] = $row->changeable_lua;
559  $this->definitions[$row->field_id]['group_export'] = $row->group_export;
560  $this->definitions[$row->field_id]['certificate'] = $row->certificate;
561  }
562  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
global $ilSetting
Definition: privfeed.php:17
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getInstance()

static ilUserDefinedFields::_getInstance ( )
static

Definition at line 59 of file class.ilUserDefinedFields.php.

Referenced by ilUserSearchOptions\__appendUserDefinedFields(), ilObjUserGUI\__checkUserDefinedRequiredFields(), ilUserDefinedFieldsPlaceholderDescription\__construct(), ilUserDefinedFieldsPlaceholderValues\__construct(), ilCustomUserFieldSettingsTableGUI\__construct(), ilCustomUserFieldsGUI\__construct(), ilPersonalSettingsGUI\__construct(), ilObjUserGUI\__showUserDefinedFields(), ilMemberAgreementGUI\addExportFieldInfo(), ilUserDefinedData\addToXML(), ilCustomUserFieldsGUI\askDeleteField(), ilAuthProviderSaml\buildUserAttributeXml(), ilCustomUserFieldsGUI\create(), ilCertificateUserDefinedFieldsHelper\createInstance(), ilCustomUserFieldsGUI\deleteField(), ilObjUser\deleteUserDefinedFieldEntries(), ilLDAPSettingsGUI\getAttributeMappingKeys(), ilPublicUserProfileGUI\getEmbeddable(), ilCustomUserFieldsHelper\getFormPropertyForDefinition(), ilAttendanceList\getNonMemberUserData(), ilMemberExport\getOrderedExportableFields(), ilExportFieldsInfo\getSelectableFieldsInfo(), ilLPTableBaseGUI\getSelectableUserColumns(), ilSamlSettingsGUI\getUserAttributeMappingForm(), ilObjUserFolder\getUserDefinedExportFields(), ilObjUserGUI\getValues(), ilObjUserGUI\handleIgnoredRequiredFields(), ilUserImportParser\importEndTag(), ilMemberExportSettingsGUI\initForm(), ilAccountRegistrationGUI\initForm(), ilObjUserGUI\initForm(), ILIAS\MyStaff\ListUsers\ilMStListUsersTableGUI\initSelectableColumns(), ilMemberExportGUI\initSettingsForm(), ilLDAPAttributeToUser\initUserDefinedFields(), ilLDAPSettingsGUI\initUserDefinedFields(), ilUserProfile\isProfileIncomplete(), ilObjUserGUI\loadUserDefinedDataFromForm(), ilUserQuery\query(), ilAttendanceList\readOrderedExportableFields(), ilUserTableGUI\readUserDefinedFieldsDefinitions(), ilAccountRegistrationGUI\saveForm(), ilSamlSettingsGUI\saveUserAttributeMapping(), ilUserQuery\setUdfFilter(), ilUserXMLWriter\start(), ilUserDefinedData\update(), ilCustomUserFieldsGUI\update(), ilCustomUserFieldsGUI\updateFields(), and ilMemberExport\write().

59  : self
60  {
61  static $udf = null;
62 
63  if (!is_object($udf)) {
64  return $udf = new ilUserDefinedFields();
65  }
66  return $udf;
67  }
Additional user data fields definition.
+ Here is the caller graph for this function:

◆ _newInstance()

static ilUserDefinedFields::_newInstance ( )
static

Definition at line 640 of file class.ilUserDefinedFields.php.

640  : self
641  {
642  static $udf = null;
643  return $udf = new ilUserDefinedFields();
644  }
Additional user data fields definition.

◆ add()

ilUserDefinedFields::add ( )

Definition at line 439 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, __read(), enabledCertificate(), enabledChangeable(), enabledChangeableLocalUserAdministration(), enabledCourseExport(), enabledExport(), enabledGroupExport(), enabledRequired(), enabledSearchable(), enabledVisible(), enabledVisibleLocalUserAdministration(), enabledVisibleRegistration(), getFieldName(), getFieldType(), and getFieldValues().

439  : int
440  {
441  global $DIC;
442 
443  $ilDB = $DIC['ilDB'];
444 
445  // Add definition entry
446  $next_id = $ilDB->nextId('udf_definition');
447 
448  $values = array(
449  'field_id' => array('integer',$next_id),
450  'field_name' => array('text',$this->getFieldName()),
451  'field_type' => array('integer', $this->getFieldType()),
452  'field_values' => array('clob',serialize($this->getFieldValues())),
453  'visible' => array('integer', (int) $this->enabledVisible()),
454  'changeable' => array('integer', (int) $this->enabledChangeable()),
455  'required' => array('integer', (int) $this->enabledRequired()),
456  'searchable' => array('integer', (int) $this->enabledSearchable()),
457  'export' => array('integer', (int) $this->enabledExport()),
458  'course_export' => array('integer', (int) $this->enabledCourseExport()),
459  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
460  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
461  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
462  'group_export' => array('integer', (int) $this->enabledGroupExport()),
463  'certificate' => array('integer', (int) $this->enabledCertificate()),
464  );
465 
466  $ilDB->insert('udf_definition', $values);
467 
468  // add table field in usr_defined_data
469  $field_id = $next_id;
470 
471 
472  $this->__read();
473 
474  return $field_id;
475  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ addToXML()

ilUserDefinedFields::addToXML ( ilXmlWriter  $xml_writer)

add user defined field data to xml (using usr dtd)

Definition at line 607 of file class.ilUserDefinedFields.php.

References $attributes, getDefinitions(), UDF_TYPE_SELECT, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by toXML().

607  : void
608  {
609  $xml_writer->xmlStartTag("UDFDefinitions");
610  foreach ($this->getDefinitions() as $definition) {
611  $attributes = array(
612  "Id" => $definition ["il_id"],
613  "Type" => $definition["field_type"] == UDF_TYPE_SELECT ? "SELECT" : "TEXT",
614  "Visible" => $definition["visible"] ? "TRUE" : "FALSE",
615  "Changeable" => $definition["changeable"] ? "TRUE" : "FALSE",
616  "Required" => $definition["required"] ? "TRUE" : "FALSE",
617  "Searchable" => $definition["searchable"] ? "TRUE" : "FALSE",
618  "CourseExport" => $definition["course_export"] ? "TRUE" : "FALSE",
619  "GroupExport" => $definition["group_export"] ? "TRUE" : "FALSE",
620  "Certificate" => $definition["certificate"] ? "TRUE" : "FALSE",
621  "Export" => $definition["export"] ? "TRUE" : "FALSE",
622  "RegistrationVisible" => $definition["visib_reg"] ? "TRUE" : "FALSE",
623  "LocalUserAdministrationVisible" => $definition["visib_lua"] ? "TRUE" : "FALSE",
624  "LocalUserAdministrationChangeable" => $definition["changeable_lua"] ? "TRUE" : "FALSE",
625 
626  );
627  $xml_writer->xmlStartTag("UDFDefinition", $attributes);
628  $xml_writer->xmlElement('UDFName', null, $definition['field_name']);
629  if ($definition["field_type"] == UDF_TYPE_SELECT) {
630  $field_values = $definition["field_values"];
631  foreach ($field_values as $field_value) {
632  $xml_writer->xmlElement('UDFValue', null, $field_value);
633  }
634  }
635  $xml_writer->xmlEndTag("UDFDefinition");
636  }
637  $xml_writer->xmlEndTag("UDFDefinitions");
638  }
const UDF_TYPE_SELECT
$attributes
Definition: metadata.php:248
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilUserDefinedFields::delete ( int  $a_id)

Definition at line 477 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, $query, __read(), and ilUserDefinedData\deleteEntriesOfField().

477  : void
478  {
479  global $DIC;
480 
481  $ilDB = $DIC['ilDB'];
482 
483  // Delete definitions
484  $query = "DELETE FROM udf_definition " .
485  "WHERE field_id = " . $this->db->quote($a_id, 'integer') . " ";
486  $ilDB->manipulate($query);
487 
488  // Delete usr_data entries
490 
491  $this->__read();
492  }
static deleteEntriesOfField(int $a_field_id)
Delete data of particular field.
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:

◆ deleteValue()

ilUserDefinedFields::deleteValue ( int  $a_field_id,
int  $a_value_id 
)

Definition at line 564 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, __read(), ilUserDefinedData\deleteFieldValue(), and getDefinition().

567  : void {
568  global $DIC;
569 
570  $ilDB = $DIC['ilDB'];
571  $old_value = "";
572 
573  $definition = $this->getDefinition($a_field_id);
574 
575  $counter = 0;
576  $new_values = array();
577  foreach ($definition['field_values'] as $value) {
578  if ($counter++ != $a_value_id) {
579  $new_values[] = $value;
580  } else {
581  $old_value = $value;
582  }
583  }
584 
585  $values = array(
586  'field_values' => array('clob',serialize($new_values)));
587  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_field_id)));
588 
589 
590  // sets value to '' where old value is $old_value
591  ilUserDefinedData::deleteFieldValue($a_field_id, $old_value);
592 
593  // finally read data
594  $this->__read();
595  }
global $DIC
Definition: feed.php:28
static deleteFieldValue(int $a_field_id, string $a_value)
Delete data of particular value of a (selection) field.
+ Here is the call graph for this function:

◆ enableCertificate()

ilUserDefinedFields::enableCertificate ( bool  $a_c)

Definition at line 365 of file class.ilUserDefinedFields.php.

365  : void
366  {
367  $this->field_certificate = $a_c;
368  }

◆ enableChangeable()

ilUserDefinedFields::enableChangeable ( bool  $a_changeable)

Definition at line 295 of file class.ilUserDefinedFields.php.

295  : void
296  {
297  $this->field_changeable = $a_changeable;
298  }

◆ enableChangeableLocalUserAdministration()

ilUserDefinedFields::enableChangeableLocalUserAdministration ( bool  $a_changeable)

Definition at line 305 of file class.ilUserDefinedFields.php.

305  : void
306  {
307  $this->field_changeable_lua = $a_changeable;
308  }

◆ enableCourseExport()

ilUserDefinedFields::enableCourseExport ( bool  $a_course_export)

Definition at line 345 of file class.ilUserDefinedFields.php.

345  : void
346  {
347  $this->field_course_export = $a_course_export;
348  }

◆ enabledCertificate()

ilUserDefinedFields::enabledCertificate ( )

Definition at line 370 of file class.ilUserDefinedFields.php.

References $field_certificate.

Referenced by add(), and update().

370  : bool
371  {
373  }
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilUserDefinedFields::enabledChangeable ( )

Definition at line 300 of file class.ilUserDefinedFields.php.

References $field_changeable.

Referenced by add(), and update().

300  : bool
301  {
303  }
+ Here is the caller graph for this function:

◆ enabledChangeableLocalUserAdministration()

ilUserDefinedFields::enabledChangeableLocalUserAdministration ( )

Definition at line 310 of file class.ilUserDefinedFields.php.

References $field_changeable_lua.

Referenced by add(), and update().

310  : bool
311  {
313  }
+ Here is the caller graph for this function:

◆ enabledCourseExport()

ilUserDefinedFields::enabledCourseExport ( )

Definition at line 350 of file class.ilUserDefinedFields.php.

References $field_course_export.

Referenced by add(), and update().

350  : bool
351  {
353  }
+ Here is the caller graph for this function:

◆ enabledExport()

ilUserDefinedFields::enabledExport ( )

Definition at line 340 of file class.ilUserDefinedFields.php.

References $field_export.

Referenced by add(), and update().

340  : bool
341  {
342  return $this->field_export;
343  }
+ Here is the caller graph for this function:

◆ enabledGroupExport()

ilUserDefinedFields::enabledGroupExport ( )

Definition at line 360 of file class.ilUserDefinedFields.php.

References $field_group_export.

Referenced by add(), and update().

360  : bool
361  {
363  }
+ Here is the caller graph for this function:

◆ enabledRequired()

ilUserDefinedFields::enabledRequired ( )

Definition at line 320 of file class.ilUserDefinedFields.php.

References $field_required.

Referenced by add(), and update().

320  : bool
321  {
322  return $this->field_required;
323  }
+ Here is the caller graph for this function:

◆ enabledSearchable()

ilUserDefinedFields::enabledSearchable ( )

Definition at line 330 of file class.ilUserDefinedFields.php.

References $field_searchable.

Referenced by add(), and update().

330  : bool
331  {
333  }
+ Here is the caller graph for this function:

◆ enabledVisible()

ilUserDefinedFields::enabledVisible ( )

Definition at line 280 of file class.ilUserDefinedFields.php.

References $field_visible.

Referenced by add(), and update().

280  : bool
281  {
282  return $this->field_visible;
283  }
+ Here is the caller graph for this function:

◆ enabledVisibleLocalUserAdministration()

ilUserDefinedFields::enabledVisibleLocalUserAdministration ( )

Definition at line 290 of file class.ilUserDefinedFields.php.

References $field_visib_lua.

Referenced by add(), and update().

290  : bool
291  {
292  return $this->field_visib_lua;
293  }
+ Here is the caller graph for this function:

◆ enabledVisibleRegistration()

ilUserDefinedFields::enabledVisibleRegistration ( )

Definition at line 380 of file class.ilUserDefinedFields.php.

References $field_visible_registration.

Referenced by add(), and update().

380  : bool
381  {
383  }
+ Here is the caller graph for this function:

◆ enableExport()

ilUserDefinedFields::enableExport ( bool  $a_export)

Definition at line 335 of file class.ilUserDefinedFields.php.

335  : void
336  {
337  $this->field_export = $a_export;
338  }

◆ enableGroupExport()

ilUserDefinedFields::enableGroupExport ( bool  $a_group_export)

Definition at line 355 of file class.ilUserDefinedFields.php.

355  : void
356  {
357  $this->field_group_export = $a_group_export;
358  }

◆ enableRequired()

ilUserDefinedFields::enableRequired ( bool  $a_required)

Definition at line 315 of file class.ilUserDefinedFields.php.

315  : void
316  {
317  $this->field_required = $a_required;
318  }

◆ enableSearchable()

ilUserDefinedFields::enableSearchable ( bool  $a_searchable)

Definition at line 325 of file class.ilUserDefinedFields.php.

325  : void
326  {
327  $this->field_searchable = $a_searchable;
328  }

◆ enableVisible()

ilUserDefinedFields::enableVisible ( bool  $a_visible)

Definition at line 275 of file class.ilUserDefinedFields.php.

275  : void
276  {
277  $this->field_visible = $a_visible;
278  }

◆ enableVisibleLocalUserAdministration()

ilUserDefinedFields::enableVisibleLocalUserAdministration ( bool  $a_visible)

Definition at line 285 of file class.ilUserDefinedFields.php.

285  : void
286  {
287  $this->field_visib_lua = $a_visible;
288  }

◆ enableVisibleRegistration()

ilUserDefinedFields::enableVisibleRegistration ( bool  $a_visible_registration)

Definition at line 375 of file class.ilUserDefinedFields.php.

375  : void
376  {
377  $this->field_visible_registration = $a_visible_registration;
378  }

◆ fetchFieldIdFromImportId()

ilUserDefinedFields::fetchFieldIdFromImportId ( string  $a_import_id)

Definition at line 69 of file class.ilUserDefinedFields.php.

References $DIC, $ilSetting, and $parts.

69  : int
70  {
71  global $DIC;
72 
73  $ilSetting = $DIC['ilSetting'];
74 
75  if (!strlen($a_import_id)) {
76  return 0;
77  }
78  $parts = explode('_', $a_import_id);
79 
80  if (($parts[0] ?? '') != 'il') {
81  return 0;
82  }
83  if (($parts[1] ?? '') != $ilSetting->get('inst_id', '0')) {
84  return 0;
85  }
86  if (($parts[2] ?? '') != 'udf') {
87  return 0;
88  }
89  if ($parts[3] ?? false) {
90  // Check if field exists
91  if (is_array(($this->definitions[$parts[3]] ?? false))) {
92  return $parts[3];
93  }
94  }
95  return 0;
96  }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17

◆ fetchFieldIdFromName()

ilUserDefinedFields::fetchFieldIdFromName ( string  $a_name)

Definition at line 98 of file class.ilUserDefinedFields.php.

98  : int
99  {
100  foreach ($this->definitions as $definition) {
101  if ($definition['field_name'] == $a_name) {
102  return $definition['field_id'];
103  }
104  }
105  return 0;
106  }

◆ fieldValuesToSelectArray()

ilUserDefinedFields::fieldValuesToSelectArray ( array  $a_values,
bool  $a_with_selection_info = true 
)

Definition at line 385 of file class.ilUserDefinedFields.php.

References $DIC, and $lng.

388  : array {
389  global $DIC;
390 
391  $lng = $DIC->language();
392  $values = [];
393  if ($a_with_selection_info) {
394  $values[''] = $lng->txt('please_select');
395  }
396  foreach ($a_values as $value) {
397  $values[$value] = $value;
398  }
399  if (count($values) > (int) $a_with_selection_info) {
400  return $values;
401  }
402  return [];
403  }
$lng
global $DIC
Definition: feed.php:28

◆ getChangeableLocalUserAdministrationDefinitions()

ilUserDefinedFields::getChangeableLocalUserAdministrationDefinitions ( )

Definition at line 140 of file class.ilUserDefinedFields.php.

References $id.

Referenced by ilObjUserGUI\initForm(), and ilObjUserGUI\loadUserDefinedDataFromForm().

140  : array // Missing array type.
141  {
142  $visible_definition = [];
143  foreach ($this->definitions as $id => $definition) {
144  if ($definition['changeable_lua']) {
145  $visible_definition[$id] = $definition;
146  }
147  }
148  return $visible_definition;
149  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ getCourseExportableFields()

ilUserDefinedFields::getCourseExportableFields ( )

Definition at line 184 of file class.ilUserDefinedFields.php.

References $id.

Referenced by getExportableFields().

184  : array // Missing array type.
185  {
186  $cexp_definition = [];
187  foreach ($this->definitions as $id => $definition) {
188  if ($definition['course_export']) {
189  $cexp_definition[$id] = $definition;
190  }
191  }
192  return $cexp_definition;
193  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ getDefinition()

ilUserDefinedFields::getDefinition ( int  $a_id)

Definition at line 113 of file class.ilUserDefinedFields.php.

Referenced by deleteValue().

113  : array // Missing array type.
114  {
115  return $this->definitions[$a_id] ?? array();
116  }
+ Here is the caller graph for this function:

◆ getDefinitions()

ilUserDefinedFields::getDefinitions ( )

Definition at line 108 of file class.ilUserDefinedFields.php.

Referenced by addToXML(), ilObjUserGUI\handleIgnoredRequiredFields(), ilObjUserGUI\initForm(), and ilObjUserGUI\loadUserDefinedDataFromForm().

108  : array // Missing array type.
109  {
110  return $this->definitions ?: array();
111  }
+ Here is the caller graph for this function:

◆ getExportableFields()

ilUserDefinedFields::getExportableFields ( int  $a_obj_id)

Get exportable field.

Definition at line 209 of file class.ilUserDefinedFields.php.

References ilObject\_lookupType(), getCourseExportableFields(), and getGroupExportableFields().

209  : array // Missing array type.
210  {
211  if (ilObject::_lookupType($a_obj_id) == 'crs') {
212  return $this->getCourseExportableFields();
213  }
214  if (ilObject::_lookupType($a_obj_id) == 'grp') {
215  return $this->getGroupExportableFields();
216  }
217  return array();
218  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getFieldName()

ilUserDefinedFields::getFieldName ( )

Definition at line 226 of file class.ilUserDefinedFields.php.

References $field_name.

Referenced by add(), and update().

226  : string
227  {
228  return $this->field_name;
229  }
+ Here is the caller graph for this function:

◆ getFieldType()

ilUserDefinedFields::getFieldType ( )

Definition at line 252 of file class.ilUserDefinedFields.php.

References $field_type.

Referenced by add(), and update().

252  : int
253  {
254  return $this->field_type;
255  }
+ Here is the caller graph for this function:

◆ getFieldValues()

ilUserDefinedFields::getFieldValues ( )

Definition at line 270 of file class.ilUserDefinedFields.php.

Referenced by add(), update(), and validateValues().

270  : array // Missing array type.
271  {
272  return $this->field_values ?: array();
273  }
+ Here is the caller graph for this function:

◆ getGroupExportableFields()

ilUserDefinedFields::getGroupExportableFields ( )

Definition at line 195 of file class.ilUserDefinedFields.php.

References $id.

Referenced by getExportableFields().

195  : array // Missing array type.
196  {
197  $cexp_definition = [];
198  foreach ($this->definitions as $id => $definition) {
199  if ($definition['group_export']) {
200  $cexp_definition[$id] = $definition;
201  }
202  }
203  return $cexp_definition;
204  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ getLocalUserAdministrationDefinitions()

ilUserDefinedFields::getLocalUserAdministrationDefinitions ( )

Definition at line 129 of file class.ilUserDefinedFields.php.

References $id.

129  : array // Missing array type.
130  {
131  $visible_definition = [];
132  foreach ($this->definitions as $id => $definition) {
133  if ($definition['visib_lua']) {
134  $visible_definition[$id] = $definition;
135  }
136  }
137  return $visible_definition;
138  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getRegistrationDefinitions()

ilUserDefinedFields::getRegistrationDefinitions ( )

Definition at line 151 of file class.ilUserDefinedFields.php.

References $id.

151  : array // Missing array type.
152  {
153  $visible_definition = [];
154  foreach ($this->definitions as $id => $definition) {
155  if ($definition['visib_reg']) {
156  $visible_definition[$id] = $definition;
157  }
158  }
159  return $visible_definition;
160  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getRequiredDefinitions()

ilUserDefinedFields::getRequiredDefinitions ( )

Definition at line 173 of file class.ilUserDefinedFields.php.

References $id.

173  : array // Missing array type.
174  {
175  $required_definition = [];
176  foreach ($this->definitions as $id => $definition) {
177  if ($definition['required']) {
178  $required_definition[$id] = $definition;
179  }
180  }
181  return $required_definition;
182  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getSearchableDefinitions()

ilUserDefinedFields::getSearchableDefinitions ( )

Definition at line 162 of file class.ilUserDefinedFields.php.

References $id.

162  : array // Missing array type.
163  {
164  $searchable_definition = [];
165  foreach ($this->definitions as $id => $definition) {
166  if ($definition['searchable']) {
167  $searchable_definition[$id] = $definition;
168  }
169  }
170  return $searchable_definition;
171  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getVisibleDefinitions()

ilUserDefinedFields::getVisibleDefinitions ( )

Definition at line 118 of file class.ilUserDefinedFields.php.

References $id.

118  : array // Missing array type.
119  {
120  $visible_definition = [];
121  foreach ($this->definitions as $id => $definition) {
122  if ($definition['visible']) {
123  $visible_definition[$id] = $definition;
124  }
125  }
126  return $visible_definition;
127  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ isPluginType()

ilUserDefinedFields::isPluginType ( )

Definition at line 236 of file class.ilUserDefinedFields.php.

References UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

236  : bool
237  {
238  if (!$this->field_type) {
239  return false;
240  }
241  switch ($this->field_type) {
242  case UDF_TYPE_TEXT:
243  case UDF_TYPE_SELECT:
244  case UDF_TYPE_WYSIWYG:
245  return false;
246 
247  default:
248  return true;
249  }
250  }
const UDF_TYPE_SELECT
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const UDF_TYPE_WYSIWYG

◆ nameExists()

ilUserDefinedFields::nameExists ( string  $a_field_name)

Definition at line 426 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, $query, and $res.

Referenced by ilCustomUserFieldsGUI\validateForm().

426  : bool
427  {
428  global $DIC;
429 
430  $ilDB = $DIC['ilDB'];
431 
432  $query = "SELECT * FROM udf_definition " .
433  "WHERE field_name = " . $this->db->quote($a_field_name, 'text') . " ";
434  $res = $ilDB->query($query);
435 
436  return (bool) $res->numRows();
437  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ setFieldName()

ilUserDefinedFields::setFieldName ( string  $a_name)

Definition at line 221 of file class.ilUserDefinedFields.php.

221  : void
222  {
223  $this->field_name = $a_name;
224  }

◆ setFieldType()

ilUserDefinedFields::setFieldType ( int  $a_type)

Definition at line 231 of file class.ilUserDefinedFields.php.

231  : void
232  {
233  $this->field_type = $a_type;
234  }

◆ setFieldValues()

ilUserDefinedFields::setFieldValues ( array  $a_values)
Parameters
array$a_values,<mixed,mixed>

Definition at line 260 of file class.ilUserDefinedFields.php.

Referenced by ilCustomUserFieldsGUI\validateForm().

260  : void
261  {
262  $this->field_values = array();
263  foreach ($a_values as $value) {
264  if (strlen($value)) {
265  $this->field_values[] = $value;
266  }
267  }
268  }
+ Here is the caller graph for this function:

◆ toXML()

ilUserDefinedFields::toXML ( )

Definition at line 597 of file class.ilUserDefinedFields.php.

References addToXML().

597  : string
598  {
599  $xml_writer = new ilXmlWriter();
600  $this->addToXML($xml_writer);
601  return $xml_writer->xmlDumpMem(false);
602  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addToXML(ilXmlWriter $xml_writer)
add user defined field data to xml (using usr dtd)
+ Here is the call graph for this function:

◆ update()

ilUserDefinedFields::update ( int  $a_id)

Definition at line 494 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, __read(), enabledCertificate(), enabledChangeable(), enabledChangeableLocalUserAdministration(), enabledCourseExport(), enabledExport(), enabledGroupExport(), enabledRequired(), enabledSearchable(), enabledVisible(), enabledVisibleLocalUserAdministration(), enabledVisibleRegistration(), getFieldName(), getFieldType(), and getFieldValues().

494  : void
495  {
496  global $DIC;
497 
498  $ilDB = $DIC['ilDB'];
499 
500  $values = array(
501  'field_name' => array('text',$this->getFieldName()),
502  'field_type' => array('integer', $this->getFieldType()),
503  'field_values' => array('clob',serialize($this->getFieldValues())),
504  'visible' => array('integer', (int) $this->enabledVisible()),
505  'changeable' => array('integer', (int) $this->enabledChangeable()),
506  'required' => array('integer', (int) $this->enabledRequired()),
507  'searchable' => array('integer', (int) $this->enabledSearchable()),
508  'export' => array('integer', (int) $this->enabledExport()),
509  'course_export' => array('integer', (int) $this->enabledCourseExport()),
510  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
511  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
512  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
513  'group_export' => array('integer', (int) $this->enabledGroupExport()),
514  'certificate' => array('integer', (int) $this->enabledCertificate())
515  );
516  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_id)));
517  $this->__read();
518  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ validateValues()

ilUserDefinedFields::validateValues ( )

Definition at line 405 of file class.ilUserDefinedFields.php.

References getFieldValues(), UDF_DUPLICATE_VALUES, and UDF_NO_VALUES.

Referenced by ilCustomUserFieldsGUI\validateForm().

405  : int
406  {
407  $number = 0;
408  $unique = array();
409  foreach ($this->getFieldValues() as $value) {
410  if (!strlen($value)) {
411  continue;
412  }
413  $number++;
414  $unique[$value] = $value;
415  }
416 
417  if (!count($unique)) {
418  return UDF_NO_VALUES;
419  }
420  if ($number != count($unique)) {
421  return UDF_DUPLICATE_VALUES;
422  }
423  return 0;
424  }
const UDF_NO_VALUES
const UDF_DUPLICATE_VALUES
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilUserDefinedFields::$db = null

Definition at line 44 of file class.ilUserDefinedFields.php.

◆ $definitions

array ilUserDefinedFields::$definitions = array()

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

◆ $field_certificate

bool ilUserDefinedFields::$field_certificate = false
protected

Definition at line 31 of file class.ilUserDefinedFields.php.

Referenced by enabledCertificate().

◆ $field_changeable

bool ilUserDefinedFields::$field_changeable = false
protected

Definition at line 38 of file class.ilUserDefinedFields.php.

Referenced by enabledChangeable().

◆ $field_changeable_lua

bool ilUserDefinedFields::$field_changeable_lua = false
protected

◆ $field_course_export

bool ilUserDefinedFields::$field_course_export = false
protected

Definition at line 33 of file class.ilUserDefinedFields.php.

Referenced by enabledCourseExport().

◆ $field_export

bool ilUserDefinedFields::$field_export = false
protected

Definition at line 34 of file class.ilUserDefinedFields.php.

Referenced by enabledExport().

◆ $field_group_export

bool ilUserDefinedFields::$field_group_export = false
protected

Definition at line 32 of file class.ilUserDefinedFields.php.

Referenced by enabledGroupExport().

◆ $field_name

string ilUserDefinedFields::$field_name = ""
protected

Definition at line 42 of file class.ilUserDefinedFields.php.

Referenced by getFieldName().

◆ $field_required

bool ilUserDefinedFields::$field_required = false
protected

Definition at line 36 of file class.ilUserDefinedFields.php.

Referenced by enabledRequired().

◆ $field_searchable

bool ilUserDefinedFields::$field_searchable = false
protected

Definition at line 35 of file class.ilUserDefinedFields.php.

Referenced by enabledSearchable().

◆ $field_type

int ilUserDefinedFields::$field_type = 0
protected

Definition at line 41 of file class.ilUserDefinedFields.php.

Referenced by getFieldType().

◆ $field_values

array ilUserDefinedFields::$field_values = []
protected

Definition at line 40 of file class.ilUserDefinedFields.php.

◆ $field_visib_lua

bool ilUserDefinedFields::$field_visib_lua = false
protected

Definition at line 39 of file class.ilUserDefinedFields.php.

Referenced by enabledVisibleLocalUserAdministration().

◆ $field_visible

bool ilUserDefinedFields::$field_visible = false
protected

Definition at line 43 of file class.ilUserDefinedFields.php.

Referenced by enabledVisible().

◆ $field_visible_registration

int ilUserDefinedFields::$field_visible_registration = 0
private

Definition at line 49 of file class.ilUserDefinedFields.php.

Referenced by enabledVisibleRegistration().


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