ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 getProgrammeExportableFields ()
 
 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 ()
 
 enablePrgExport (bool $prg_export)
 
 enabledPrgExport ()
 
 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 = []
 

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
 
bool $field_prg_export = 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 52 of file class.ilUserDefinedFields.php.

References $DIC, and __read().

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

Member Function Documentation

◆ __read()

ilUserDefinedFields::__read ( )
protected

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

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

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

544  : void
545  {
546  global $DIC;
547 
548  $ilSetting = $DIC['ilSetting'];
549 
550  $query = "SELECT * FROM udf_definition;";
551  $res = $this->db->query($query);
552 
553  $this->definitions = [];
554  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
555  $this->definitions[$row->field_id]['field_id'] = $row->field_id;
556  $this->definitions[$row->field_id]['field_name'] = $row->field_name;
557  $this->definitions[$row->field_id]['field_type'] = $row->field_type;
558  $this->definitions[$row->field_id]['il_id'] = 'il_' . $ilSetting->get('inst_id', '0') . '_udf_' . $row->field_id;
559 
560  // #16953
561  $tmp = $sort = [];
562  $is_numeric = true;
563  foreach ((array) unserialize($row->field_values, ['allowed_classes' => false]) as $item) {
564  if (!is_numeric($item)) {
565  $is_numeric = false;
566  }
567  $sort[] = ["value" => $item];
568  }
569  foreach (ilArrayUtil::sortArray($sort, "value", "asc", $is_numeric) as $item) {
570  $tmp[] = $item["value"];
571  }
572 
573  $this->definitions[$row->field_id]['field_values'] = $tmp;
574  $this->definitions[$row->field_id]['visible'] = $row->visible;
575  $this->definitions[$row->field_id]['changeable'] = $row->changeable;
576  $this->definitions[$row->field_id]['required'] = $row->required;
577  $this->definitions[$row->field_id]['searchable'] = $row->searchable;
578  $this->definitions[$row->field_id]['export'] = $row->export;
579  $this->definitions[$row->field_id]['course_export'] = $row->course_export;
580  $this->definitions[$row->field_id]['visib_reg'] = $row->registration_visible;
581  $this->definitions[$row->field_id]['visib_lua'] = $row->visible_lua;
582  $this->definitions[$row->field_id]['changeable_lua'] = $row->changeable_lua;
583  $this->definitions[$row->field_id]['group_export'] = $row->group_export;
584  $this->definitions[$row->field_id]['certificate'] = $row->certificate;
585  $this->definitions[$row->field_id]['prg_export'] = $row->prg_export;
586  }
587  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
global $ilSetting
Definition: privfeed.php:31
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 60 of file class.ilUserDefinedFields.php.

References null.

Referenced by ilUserSearchOptions\__appendUserDefinedFields(), ilObjUserGUI\__checkUserDefinedRequiredFields(), ilUserDefinedFieldsPlaceholderDescription\__construct(), ilUserDefinedFieldsPlaceholderValues\__construct(), ilOpenIdConnectUserSync\__construct(), ilCustomUserFieldSettingsTableGUI\__construct(), ilCustomUserFieldsGUI\__construct(), ilOpenIdConnectSettings\__construct(), ilObjUserGUI\__showUserDefinedFields(), ilMemberAgreementGUI\addExportFieldInfo(), ilUserDefinedData\addToXML(), ilCustomUserFieldsGUI\askDeleteField(), ilAuthProviderSaml\buildUserAttributeXml(), ilCustomUserFieldsGUI\create(), ilCertificateUserDefinedFieldsHelper\createInstance(), ilAccountRegistrationGUI\createUser(), 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(), ilOpenIdConnectSettingsGUI\initUserDefinedFields(), ilLDAPSettingsGUI\initUserDefinedFields(), ilUserProfile\isProfileIncomplete(), ilObjUserGUI\loadUserDefinedDataFromForm(), ilUserQuery\query(), ilAttendanceList\readOrderedExportableFields(), ilUserTableGUI\readUserDefinedFieldsDefinitions(), ilSamlSettingsGUI\saveUserAttributeMapping(), ilUserQuery\setUdfFilter(), ilUserXMLWriter\start(), ilUserDefinedData\update(), ilCustomUserFieldsGUI\update(), ilCustomUserFieldsGUI\updateFields(), and ilMemberExport\write().

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

◆ _newInstance()

static ilUserDefinedFields::_newInstance ( )
static

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

References null.

665  : self
666  {
667  static $udf = null;
668  return $udf = new ilUserDefinedFields();
669  }
Additional user data fields definition.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ add()

ilUserDefinedFields::add ( )

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

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

464  : int
465  {
466  global $DIC;
467 
468  $ilDB = $DIC['ilDB'];
469 
470  // Add definition entry
471  $next_id = $ilDB->nextId('udf_definition');
472 
473  $values = [
474  'field_id' => ['integer',$next_id],
475  'field_name' => ['text',$this->getFieldName()],
476  'field_type' => ['integer', $this->getFieldType()],
477  'field_values' => ['clob',serialize($this->getFieldValues())],
478  'visible' => ['integer', (int) $this->enabledVisible()],
479  'changeable' => ['integer', (int) $this->enabledChangeable()],
480  'required' => ['integer', (int) $this->enabledRequired()],
481  'searchable' => ['integer', (int) $this->enabledSearchable()],
482  'export' => ['integer', (int) $this->enabledExport()],
483  'course_export' => ['integer', (int) $this->enabledCourseExport()],
484  'registration_visible' => ['integer', (int) $this->enabledVisibleRegistration()],
485  'visible_lua' => ['integer', (int) $this->enabledVisibleLocalUserAdministration()],
486  'changeable_lua' => ['integer', (int) $this->enabledChangeableLocalUserAdministration()],
487  'group_export' => ['integer', (int) $this->enabledGroupExport()],
488  'certificate' => ['integer', (int) $this->enabledCertificate()],
489  'prg_export' => ['integer', (int) $this->enabledPrgExport()],
490 
491  ];
492 
493  $ilDB->insert('udf_definition', $values);
494 
495  // add table field in usr_defined_data
496  $field_id = $next_id;
497 
498 
499  $this->__read();
500 
501  return $field_id;
502  }
global $DIC
Definition: shib_login.php:22
+ 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 632 of file class.ilUserDefinedFields.php.

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

Referenced by toXML().

632  : void
633  {
634  $xml_writer->xmlStartTag("UDFDefinitions");
635  foreach ($this->getDefinitions() as $definition) {
636  $attributes = [
637  "Id" => $definition ["il_id"],
638  "Type" => $definition["field_type"] == UDF_TYPE_SELECT ? "SELECT" : "TEXT",
639  "Visible" => $definition["visible"] ? "TRUE" : "FALSE",
640  "Changeable" => $definition["changeable"] ? "TRUE" : "FALSE",
641  "Required" => $definition["required"] ? "TRUE" : "FALSE",
642  "Searchable" => $definition["searchable"] ? "TRUE" : "FALSE",
643  "CourseExport" => $definition["course_export"] ? "TRUE" : "FALSE",
644  "GroupExport" => $definition["group_export"] ? "TRUE" : "FALSE",
645  "PRGExport" => $definition["prg_export"] ? "TRUE" : "FALSE",
646  "Certificate" => $definition["certificate"] ? "TRUE" : "FALSE",
647  "Export" => $definition["export"] ? "TRUE" : "FALSE",
648  "RegistrationVisible" => $definition["visib_reg"] ? "TRUE" : "FALSE",
649  "LocalUserAdministrationVisible" => $definition["visib_lua"] ? "TRUE" : "FALSE",
650  "LocalUserAdministrationChangeable" => $definition["changeable_lua"] ? "TRUE" : "FALSE"
651  ];
652  $xml_writer->xmlStartTag("UDFDefinition", $attributes);
653  $xml_writer->xmlElement('UDFName', null, $definition['field_name']);
654  if ($definition["field_type"] == UDF_TYPE_SELECT) {
655  $field_values = $definition["field_values"];
656  foreach ($field_values as $field_value) {
657  $xml_writer->xmlElement('UDFValue', null, $field_value);
658  }
659  }
660  $xml_writer->xmlEndTag("UDFDefinition");
661  }
662  $xml_writer->xmlEndTag("UDFDefinitions");
663  }
const UDF_TYPE_SELECT
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 504 of file class.ilUserDefinedFields.php.

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

504  : void
505  {
506  global $DIC;
507 
508  $ilDB = $DIC['ilDB'];
509 
510  // Delete definitions
511  $query = "DELETE FROM udf_definition " .
512  "WHERE field_id = " . $this->db->quote($a_id, 'integer') . " ";
513  $ilDB->manipulate($query);
514 
515  // Delete usr_data entries
517 
518  $this->__read();
519  }
static deleteEntriesOfField(int $a_field_id)
Delete data of particular field.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ deleteValue()

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

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

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

592  : void {
593  global $DIC;
594 
595  $ilDB = $DIC['ilDB'];
596  $old_value = "";
597 
598  $definition = $this->getDefinition($a_field_id);
599 
600  $counter = 0;
601  $new_values = [];
602  foreach ($definition['field_values'] as $value) {
603  if ($counter++ != $a_value_id) {
604  $new_values[] = $value;
605  } else {
606  $old_value = $value;
607  }
608  }
609 
610  $values = [
611  'field_values' => ['clob',serialize($new_values)]];
612  $ilDB->update('udf_definition', $values, ['field_id' => ['integer',$a_field_id]]);
613 
614 
615  // sets value to '' where old value is $old_value
616  ilUserDefinedData::deleteFieldValue($a_field_id, $old_value);
617 
618  // finally read data
619  $this->__read();
620  }
global $DIC
Definition: shib_login.php:22
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 390 of file class.ilUserDefinedFields.php.

390  : void
391  {
392  $this->field_certificate = $a_c;
393  }

◆ enableChangeable()

ilUserDefinedFields::enableChangeable ( bool  $a_changeable)

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

310  : void
311  {
312  $this->field_changeable = $a_changeable;
313  }

◆ enableChangeableLocalUserAdministration()

ilUserDefinedFields::enableChangeableLocalUserAdministration ( bool  $a_changeable)

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

320  : void
321  {
322  $this->field_changeable_lua = $a_changeable;
323  }

◆ enableCourseExport()

ilUserDefinedFields::enableCourseExport ( bool  $a_course_export)

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

360  : void
361  {
362  $this->field_course_export = $a_course_export;
363  }

◆ enabledCertificate()

ilUserDefinedFields::enabledCertificate ( )

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

References $field_certificate.

Referenced by add(), and update().

395  : bool
396  {
398  }
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilUserDefinedFields::enabledChangeable ( )

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

References $field_changeable.

Referenced by add(), and update().

315  : bool
316  {
318  }
+ Here is the caller graph for this function:

◆ enabledChangeableLocalUserAdministration()

ilUserDefinedFields::enabledChangeableLocalUserAdministration ( )

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

References $field_changeable_lua.

Referenced by add(), and update().

325  : bool
326  {
328  }
+ Here is the caller graph for this function:

◆ enabledCourseExport()

ilUserDefinedFields::enabledCourseExport ( )

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

References $field_course_export.

Referenced by add(), and update().

365  : bool
366  {
368  }
+ Here is the caller graph for this function:

◆ enabledExport()

ilUserDefinedFields::enabledExport ( )

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

References $field_export.

Referenced by add(), and update().

355  : bool
356  {
357  return $this->field_export;
358  }
+ Here is the caller graph for this function:

◆ enabledGroupExport()

ilUserDefinedFields::enabledGroupExport ( )

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

References $field_group_export.

Referenced by add(), and update().

375  : bool
376  {
378  }
+ Here is the caller graph for this function:

◆ enabledPrgExport()

ilUserDefinedFields::enabledPrgExport ( )

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

References $field_prg_export.

Referenced by add(), and update().

385  : bool
386  {
388  }
+ Here is the caller graph for this function:

◆ enabledRequired()

ilUserDefinedFields::enabledRequired ( )

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

References $field_required.

Referenced by add(), and update().

335  : bool
336  {
337  return $this->field_required;
338  }
+ Here is the caller graph for this function:

◆ enabledSearchable()

ilUserDefinedFields::enabledSearchable ( )

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

References $field_searchable.

Referenced by add(), and update().

345  : bool
346  {
348  }
+ Here is the caller graph for this function:

◆ enabledVisible()

ilUserDefinedFields::enabledVisible ( )

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

References $field_visible.

Referenced by add(), and update().

295  : bool
296  {
297  return $this->field_visible;
298  }
+ Here is the caller graph for this function:

◆ enabledVisibleLocalUserAdministration()

ilUserDefinedFields::enabledVisibleLocalUserAdministration ( )

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

References $field_visib_lua.

Referenced by add(), and update().

305  : bool
306  {
307  return $this->field_visib_lua;
308  }
+ Here is the caller graph for this function:

◆ enabledVisibleRegistration()

ilUserDefinedFields::enabledVisibleRegistration ( )

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

References $field_visible_registration.

Referenced by add(), and update().

405  : bool
406  {
408  }
+ Here is the caller graph for this function:

◆ enableExport()

ilUserDefinedFields::enableExport ( bool  $a_export)

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

350  : void
351  {
352  $this->field_export = $a_export;
353  }

◆ enableGroupExport()

ilUserDefinedFields::enableGroupExport ( bool  $a_group_export)

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

370  : void
371  {
372  $this->field_group_export = $a_group_export;
373  }

◆ enablePrgExport()

ilUserDefinedFields::enablePrgExport ( bool  $prg_export)

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

380  : void
381  {
382  $this->field_prg_export = $prg_export;
383  }

◆ enableRequired()

ilUserDefinedFields::enableRequired ( bool  $a_required)

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

330  : void
331  {
332  $this->field_required = $a_required;
333  }

◆ enableSearchable()

ilUserDefinedFields::enableSearchable ( bool  $a_searchable)

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

340  : void
341  {
342  $this->field_searchable = $a_searchable;
343  }

◆ enableVisible()

ilUserDefinedFields::enableVisible ( bool  $a_visible)

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

290  : void
291  {
292  $this->field_visible = $a_visible;
293  }

◆ enableVisibleLocalUserAdministration()

ilUserDefinedFields::enableVisibleLocalUserAdministration ( bool  $a_visible)

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

300  : void
301  {
302  $this->field_visib_lua = $a_visible;
303  }

◆ enableVisibleRegistration()

ilUserDefinedFields::enableVisibleRegistration ( bool  $a_visible_registration)

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

400  : void
401  {
402  $this->field_visible_registration = $a_visible_registration;
403  }

◆ fetchFieldIdFromImportId()

ilUserDefinedFields::fetchFieldIdFromImportId ( string  $a_import_id)

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

References $DIC, $ilSetting, and $parts.

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

◆ fetchFieldIdFromName()

ilUserDefinedFields::fetchFieldIdFromName ( string  $a_name)

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

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

◆ fieldValuesToSelectArray()

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

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

References $DIC, and $lng.

413  : array {
414  global $DIC;
415 
416  $lng = $DIC->language();
417  $values = [];
418  if ($a_with_selection_info) {
419  $values[''] = $lng->txt('please_select');
420  }
421  foreach ($a_values as $value) {
422  $values[$value] = $value;
423  }
424  if (count($values) > (int) $a_with_selection_info) {
425  return $values;
426  }
427  return [];
428  }
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31

◆ getChangeableLocalUserAdministrationDefinitions()

ilUserDefinedFields::getChangeableLocalUserAdministrationDefinitions ( )

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

References $id.

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

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

◆ getCourseExportableFields()

ilUserDefinedFields::getCourseExportableFields ( )

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

References $id.

Referenced by getExportableFields().

185  : array // Missing array type.
186  {
187  $cexp_definition = [];
188  foreach ($this->definitions as $id => $definition) {
189  if ($definition['course_export']) {
190  $cexp_definition[$id] = $definition;
191  }
192  }
193  return $cexp_definition;
194  }
$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 114 of file class.ilUserDefinedFields.php.

Referenced by deleteValue().

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

◆ getDefinitions()

ilUserDefinedFields::getDefinitions ( )

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

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

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

◆ getExportableFields()

ilUserDefinedFields::getExportableFields ( int  $a_obj_id)

Get exportable field.

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

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

221  : array // Missing array type.
222  {
223  if (ilObject::_lookupType($a_obj_id) === 'crs') {
224  return $this->getCourseExportableFields();
225  }
226  if (ilObject::_lookupType($a_obj_id) === 'grp') {
227  return $this->getGroupExportableFields();
228  }
229  if (ilObject::_lookupType($a_obj_id) === 'prg') {
230  return $this->getPRGExportableFields();
231  }
232  return [];
233  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getFieldName()

ilUserDefinedFields::getFieldName ( )

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

References $field_name.

Referenced by add(), and update().

241  : string
242  {
243  return $this->field_name;
244  }
+ Here is the caller graph for this function:

◆ getFieldType()

ilUserDefinedFields::getFieldType ( )

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

References $field_type.

Referenced by add(), and update().

267  : int
268  {
269  return $this->field_type;
270  }
+ Here is the caller graph for this function:

◆ getFieldValues()

ilUserDefinedFields::getFieldValues ( )

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

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

285  : array // Missing array type.
286  {
287  return $this->field_values ?: [];
288  }
+ Here is the caller graph for this function:

◆ getGroupExportableFields()

ilUserDefinedFields::getGroupExportableFields ( )

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

References $id.

Referenced by getExportableFields().

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

◆ getLocalUserAdministrationDefinitions()

ilUserDefinedFields::getLocalUserAdministrationDefinitions ( )

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

References $id.

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

◆ getProgrammeExportableFields()

ilUserDefinedFields::getProgrammeExportableFields ( )

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

References $id.

207  : array
208  {
209  $prg_exp_definition = [];
210  foreach ($this->definitions as $id => $definition) {
211  if ($definition['prg_export']) {
212  $prg_exp_definition[$id] = $definition;
213  }
214  }
215  return $prg_exp_definition;
216  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getRegistrationDefinitions()

ilUserDefinedFields::getRegistrationDefinitions ( )

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

References $id.

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

◆ getRequiredDefinitions()

ilUserDefinedFields::getRequiredDefinitions ( )

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

References $id.

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

◆ getSearchableDefinitions()

ilUserDefinedFields::getSearchableDefinitions ( )

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

References $id.

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

◆ getVisibleDefinitions()

ilUserDefinedFields::getVisibleDefinitions ( )

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

References $id.

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

◆ isPluginType()

ilUserDefinedFields::isPluginType ( )

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

References UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

251  : bool
252  {
253  if (!$this->field_type) {
254  return false;
255  }
256  switch ($this->field_type) {
257  case UDF_TYPE_TEXT:
258  case UDF_TYPE_SELECT:
259  case UDF_TYPE_WYSIWYG:
260  return false;
261 
262  default:
263  return true;
264  }
265  }
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 451 of file class.ilUserDefinedFields.php.

References $DIC, $ilDB, and $res.

Referenced by ilCustomUserFieldsGUI\validateForm().

451  : bool
452  {
453  global $DIC;
454 
455  $ilDB = $DIC['ilDB'];
456 
457  $query = "SELECT * FROM udf_definition " .
458  "WHERE field_name = " . $this->db->quote($a_field_name, 'text') . " ";
459  $res = $ilDB->query($query);
460 
461  return (bool) $res->numRows();
462  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setFieldName()

ilUserDefinedFields::setFieldName ( string  $a_name)

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

236  : void
237  {
238  $this->field_name = $a_name;
239  }

◆ setFieldType()

ilUserDefinedFields::setFieldType ( int  $a_type)

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

246  : void
247  {
248  $this->field_type = $a_type;
249  }

◆ setFieldValues()

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

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

Referenced by ilCustomUserFieldsGUI\validateForm().

275  : void
276  {
277  $this->field_values = [];
278  foreach ($a_values as $value) {
279  if (strlen($value)) {
280  $this->field_values[] = $value;
281  }
282  }
283  }
+ Here is the caller graph for this function:

◆ toXML()

ilUserDefinedFields::toXML ( )

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

References addToXML().

622  : string
623  {
624  $xml_writer = new ilXmlWriter();
625  $this->addToXML($xml_writer);
626  return $xml_writer->xmlDumpMem(false);
627  }
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 521 of file class.ilUserDefinedFields.php.

References __read(), enabledCertificate(), enabledChangeable(), enabledChangeableLocalUserAdministration(), enabledCourseExport(), enabledExport(), enabledGroupExport(), enabledPrgExport(), enabledRequired(), enabledSearchable(), enabledVisible(), enabledVisibleLocalUserAdministration(), enabledVisibleRegistration(), getFieldName(), getFieldType(), getFieldValues(), and ILIAS\Repository\int().

521  : void
522  {
523  $values = [
524  'field_name' => ['text',$this->getFieldName()],
525  'field_type' => ['integer', $this->getFieldType()],
526  'field_values' => ['clob',serialize($this->getFieldValues())],
527  'visible' => ['integer', (int) $this->enabledVisible()],
528  'changeable' => ['integer', (int) $this->enabledChangeable()],
529  'required' => ['integer', (int) $this->enabledRequired()],
530  'searchable' => ['integer', (int) $this->enabledSearchable()],
531  'export' => ['integer', (int) $this->enabledExport()],
532  'course_export' => ['integer', (int) $this->enabledCourseExport()],
533  'registration_visible' => ['integer', (int) $this->enabledVisibleRegistration()],
534  'visible_lua' => ['integer', (int) $this->enabledVisibleLocalUserAdministration()],
535  'changeable_lua' => ['integer', (int) $this->enabledChangeableLocalUserAdministration()],
536  'group_export' => ['integer', (int) $this->enabledGroupExport()],
537  'certificate' => ['integer', (int) $this->enabledCertificate()],
538  'prg_export' => ['integer', (int) $this->enabledPrgExport()],
539  ];
540  $this->db->update('udf_definition', $values, ['field_id' => ['integer',$a_id]]);
541  $this->__read();
542  }
+ Here is the call graph for this function:

◆ validateValues()

ilUserDefinedFields::validateValues ( )

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

References getFieldValues(), UDF_DUPLICATE_VALUES, and UDF_NO_VALUES.

Referenced by ilCustomUserFieldsGUI\validateForm().

430  : int
431  {
432  $number = 0;
433  $unique = [];
434  foreach ($this->getFieldValues() as $value) {
435  if (!strlen($value)) {
436  continue;
437  }
438  $number++;
439  $unique[$value] = $value;
440  }
441 
442  if (!count($unique)) {
443  return UDF_NO_VALUES;
444  }
445  if ($number != count($unique)) {
446  return UDF_DUPLICATE_VALUES;
447  }
448  return 0;
449  }
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 45 of file class.ilUserDefinedFields.php.

◆ $definitions

array ilUserDefinedFields::$definitions = []

Definition at line 49 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 43 of file class.ilUserDefinedFields.php.

Referenced by getFieldName().

◆ $field_prg_export

bool ilUserDefinedFields::$field_prg_export = false
protected

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

Referenced by enabledPrgExport().

◆ $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 42 of file class.ilUserDefinedFields.php.

Referenced by getFieldType().

◆ $field_values

array ilUserDefinedFields::$field_values = []
protected

Definition at line 41 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 44 of file class.ilUserDefinedFields.php.

Referenced by enabledVisible().

◆ $field_visible_registration

int ilUserDefinedFields::$field_visible_registration = 0
private

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

Referenced by enabledVisibleRegistration().


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