ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilUserDefinedFields Class Reference

Additional user data fields definition. More...

+ Collaboration diagram for ilUserDefinedFields:

Public Member Functions

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

Static Public Member Functions

static _getInstance ()
 Get instance. More...
 
static _newInstance ()
 

Data Fields

 $db = null
 
 $definitions = array()
 

Private Member Functions

 __construct ()
 Constructor is private -> use getInstance These definition are used e.g in User XML import. More...
 

Private Attributes

 $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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilUserDefinedFields::__construct ( )
private

Constructor is private -> use getInstance These definition are used e.g in User XML import.

To avoid instances of this class for every user object during import, it caches this object in a singleton.

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

References $DIC, $ilDB, and __read().

34  {
35  global $DIC;
36 
37  $ilDB = $DIC['ilDB'];
38 
39  $this->db = &$ilDB;
40 
41  $this->__read();
42  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilUserDefinedFields::__read ( )

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

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

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

505  {
506  global $DIC;
507 
508  $ilSetting = $DIC['ilSetting'];
509 
510  $query = "SELECT * FROM udf_definition ";
511  $res = $this->db->query($query);
512 
513  $this->definitions = array();
514  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
515  $this->definitions[$row->field_id]['field_id'] = $row->field_id;
516  $this->definitions[$row->field_id]['field_name'] = $row->field_name;
517  $this->definitions[$row->field_id]['field_type'] = $row->field_type;
518  $this->definitions[$row->field_id]['il_id'] = 'il_' . $ilSetting->get('inst_id', 0) . '_udf_' . $row->field_id;
519 
520  // #16953
521  $tmp = $sort = array();
522  $is_numeric = true;
523  foreach ((array) unserialize($row->field_values) as $item) {
524  if (!is_numeric($item)) {
525  $is_numeric = false;
526  }
527  $sort[] = array("value" => $item);
528  }
529  foreach (ilUtil::sortArray($sort, "value", "asc", $is_numeric) as $item) {
530  $tmp[] = $item["value"];
531  }
532 
533  $this->definitions[$row->field_id]['field_values'] = $tmp;
534  $this->definitions[$row->field_id]['visible'] = $row->visible;
535  $this->definitions[$row->field_id]['changeable'] = $row->changeable;
536  $this->definitions[$row->field_id]['required'] = $row->required;
537  $this->definitions[$row->field_id]['searchable'] = $row->searchable;
538  $this->definitions[$row->field_id]['export'] = $row->export;
539  $this->definitions[$row->field_id]['course_export'] = $row->course_export;
540  $this->definitions[$row->field_id]['visib_reg'] = $row->registration_visible;
541  $this->definitions[$row->field_id]['visib_lua'] = $row->visible_lua;
542  $this->definitions[$row->field_id]['changeable_lua'] = $row->changeable_lua;
543  $this->definitions[$row->field_id]['group_export'] = $row->group_export;
544  // fraunhpatch start
545  $this->definitions[$row->field_id]['certificate'] = $row->certificate;
546  // fraunhpatch end
547  }
548 
549  return true;
550  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getInstance()

static ilUserDefinedFields::_getInstance ( )
static

Get instance.

Returns
ilUserDefinedFields

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

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

49  {
50  static $udf = null;
51 
52  if (!is_object($udf)) {
53  return $udf = new ilUserDefinedFields();
54  }
55  return $udf;
56  }
Additional user data fields definition.
+ Here is the caller graph for this function:

◆ _newInstance()

static ilUserDefinedFields::_newInstance ( )
static

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

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient().

635  {
636  static $udf = null;
637 
638  return $udf = new ilUserDefinedFields();
639  }
Additional user data fields definition.
+ Here is the caller graph for this function:

◆ add()

ilUserDefinedFields::add ( )

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

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

416  {
417  global $DIC;
418 
419  $ilDB = $DIC['ilDB'];
420 
421  // Add definition entry
422  $next_id = $ilDB->nextId('udf_definition');
423 
424  $values = array(
425  'field_id' => array('integer',$next_id),
426  'field_name' => array('text',$this->getFieldName()),
427  'field_type' => array('integer', (int) $this->getFieldType()),
428  'field_values' => array('clob',serialize($this->getFieldValues())),
429  'visible' => array('integer', (int) $this->enabledVisible()),
430  'changeable' => array('integer', (int) $this->enabledChangeable()),
431  'required' => array('integer', (int) $this->enabledRequired()),
432  'searchable' => array('integer', (int) $this->enabledSearchable()),
433  'export' => array('integer', (int) $this->enabledExport()),
434  'course_export' => array('integer', (int) $this->enabledCourseExport()),
435  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
436  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
437  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
438  'group_export' => array('integer', (int) $this->enabledGroupExport()),
439  'certificate' => array('integer', (int) $this->enabledCertificate()),
440  );
441 
442  $ilDB->insert('udf_definition', $values);
443 
444  // add table field in usr_defined_data
445  $field_id = $next_id;
446 
447 
448  $this->__read();
449 
450  return $field_id;
451  }
global $DIC
Definition: saml.php:7
$values
global $ilDB
+ Here is the call graph for this function:

◆ addToXML()

ilUserDefinedFields::addToXML (   $xml_writer)

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

Parameters

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

References $attributes, getDefinitions(), and UDF_TYPE_SELECT.

Referenced by toXML().

601  {
602  $xml_writer->xmlStartTag("UDFDefinitions");
603  foreach ($this->getDefinitions() as $definition) {
604  $attributes = array(
605  "Id" => $definition ["il_id"],
606  "Type" => $definition["field_type"] == UDF_TYPE_SELECT? "SELECT" : "TEXT",
607  "Visible" => $definition["visible"]? "TRUE" : "FALSE",
608  "Changeable" => $definition["changeable"]? "TRUE" : "FALSE",
609  "Required" => $definition["required"]? "TRUE" : "FALSE",
610  "Searchable" => $definition["searchable"]? "TRUE" : "FALSE",
611  "CourseExport" => $definition["course_export"]? "TRUE" : "FALSE",
612  "GroupExport" => $definition["group_export"]? "TRUE" : "FALSE",
613  "Certificate" => $definition["certificate"]? "TRUE" : "FALSE",
614  "Export" => $definition["export"]? "TRUE" : "FALSE",
615  "RegistrationVisible" => $definition["visib_reg"]? "TRUE" : "FALSE",
616  "LocalUserAdministrationVisible" => $definition["visib_lua"]? "TRUE" : "FALSE",
617  "LocalUserAdministrationChangeable" => $definition["changeable_lua"]? "TRUE" : "FALSE",
618 
619  );
620  $xml_writer->xmlStartTag("UDFDefinition", $attributes);
621  $xml_writer->xmlElement('UDFName', null, $definition['field_name']);
622  if ($definition["field_type"] == UDF_TYPE_SELECT) {
623  $field_values = $definition["field_values"];
624  foreach ($field_values as $field_value) {
625  $xml_writer->xmlElement('UDFValue', null, $field_value);
626  }
627  }
628  $xml_writer->xmlEndTag("UDFDefinition");
629  }
630  $xml_writer->xmlEndTag("UDFDefinitions");
631  }
const UDF_TYPE_SELECT
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilUserDefinedFields::delete (   $a_id)

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

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

453  {
454  global $DIC;
455 
456  $ilDB = $DIC['ilDB'];
457 
458  // Delete definitions
459  $query = "DELETE FROM udf_definition " .
460  "WHERE field_id = " . $this->db->quote($a_id, 'integer') . " ";
461  $res = $ilDB->manipulate($query);
462 
463  // Delete usr_data entries
464  // $ilDB->dropTableColumn('udf_data','f_'.$a_id);
465  include_once("./Services/User/classes/class.ilUserDefinedData.php");
467 
468  $this->__read();
469 
470  return true;
471  }
global $DIC
Definition: saml.php:7
static deleteEntriesOfField($a_field_id)
Delete data of particular field.
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ deleteValue()

ilUserDefinedFields::deleteValue (   $a_field_id,
  $a_value_id 
)

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

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

554  {
555  global $DIC;
556 
557  $ilDB = $DIC['ilDB'];
558 
559  $definition = $this->getDefinition($a_field_id);
560 
561  $counter = 0;
562  $new_values = array();
563  foreach ($definition['field_values'] as $value) {
564  if ($counter++ != $a_value_id) {
565  $new_values[] = $value;
566  } else {
567  $old_value = $value;
568  }
569  }
570 
571  $values = array(
572  'field_values' => array('clob',serialize($new_values)));
573  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_field_id)));
574 
575 
576  // sets value to '' where old value is $old_value
577  include_once("./Services/User/classes/class.ilUserDefinedData.php");
578  ilUserDefinedData::deleteFieldValue($a_field_id, $old_value);
579 
580  // fianally read data
581  $this->__read();
582 
583  return true;
584  }
global $DIC
Definition: saml.php:7
$values
global $ilDB
static deleteFieldValue($a_field_id, $a_value)
Delete data of particular value of a (selection) field.
+ Here is the call graph for this function:

◆ enableCertificate()

ilUserDefinedFields::enableCertificate (   $a_c)

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

341  {
342  $this->field_certificate = $a_c;
343  }

◆ enableChangeable()

ilUserDefinedFields::enableChangeable (   $a_changeable)

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

284  {
285  $this->field_changeable = $a_changeable;
286  }

◆ enableChangeableLocalUserAdministration()

ilUserDefinedFields::enableChangeableLocalUserAdministration (   $a_changeable)

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

292  {
293  $this->field_changeable_lua = $a_changeable;
294  }

◆ enableCourseExport()

ilUserDefinedFields::enableCourseExport (   $a_course_export)

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

324  {
325  $this->field_course_export = $a_course_export;
326  }

◆ enabledCertificate()

ilUserDefinedFields::enabledCertificate ( )

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

Referenced by add(), and update().

345  {
346  return $this->field_certificate;
347  }
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilUserDefinedFields::enabledChangeable ( )

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

Referenced by add(), and update().

288  {
289  return $this->field_changeable;
290  }
+ Here is the caller graph for this function:

◆ enabledChangeableLocalUserAdministration()

ilUserDefinedFields::enabledChangeableLocalUserAdministration ( )

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

Referenced by add(), and update().

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

◆ enabledCourseExport()

ilUserDefinedFields::enabledCourseExport ( )

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

Referenced by add(), and update().

328  {
329  return $this->field_course_export;
330  }
+ Here is the caller graph for this function:

◆ enabledExport()

ilUserDefinedFields::enabledExport ( )

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

Referenced by add(), and update().

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

◆ enabledGroupExport()

ilUserDefinedFields::enabledGroupExport ( )

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

Referenced by add(), and update().

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

◆ enabledRequired()

ilUserDefinedFields::enabledRequired ( )

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

Referenced by add(), and update().

304  {
305  return $this->field_required;
306  }
+ Here is the caller graph for this function:

◆ enabledSearchable()

ilUserDefinedFields::enabledSearchable ( )

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

Referenced by add(), and update().

312  {
313  return $this->field_searchable;
314  }
+ Here is the caller graph for this function:

◆ enabledVisible()

ilUserDefinedFields::enabledVisible ( )

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

Referenced by add(), and update().

272  {
273  return $this->field_visible;
274  }
+ Here is the caller graph for this function:

◆ enabledVisibleLocalUserAdministration()

ilUserDefinedFields::enabledVisibleLocalUserAdministration ( )

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

Referenced by add(), and update().

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

◆ enabledVisibleRegistration()

ilUserDefinedFields::enabledVisibleRegistration ( )

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

References $field_visible_registration.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ enableExport()

ilUserDefinedFields::enableExport (   $a_export)

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

316  {
317  $this->field_export = $a_export;
318  }

◆ enableGroupExport()

ilUserDefinedFields::enableGroupExport (   $a_group_export)

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

332  {
333  $this->field_group_export = $a_group_export;
334  }

◆ enableRequired()

ilUserDefinedFields::enableRequired (   $a_required)

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

300  {
301  $this->field_required = $a_required;
302  }

◆ enableSearchable()

ilUserDefinedFields::enableSearchable (   $a_searchable)

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

308  {
309  $this->field_searchable = $a_searchable;
310  }

◆ enableVisible()

ilUserDefinedFields::enableVisible (   $a_visible)

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

268  {
269  $this->field_visible = $a_visible;
270  }

◆ enableVisibleLocalUserAdministration()

ilUserDefinedFields::enableVisibleLocalUserAdministration (   $a_visible)

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

276  {
277  $this->field_visib_lua = $a_visible;
278  }

◆ enableVisibleRegistration()

ilUserDefinedFields::enableVisibleRegistration (   $a_visible_registration)

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

350  {
351  $this->field_visible_registration = $a_visible_registration;
352  }

◆ fetchFieldIdFromImportId()

ilUserDefinedFields::fetchFieldIdFromImportId (   $a_import_id)

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

References $DIC, and $ilSetting.

59  {
60  global $DIC;
61 
62  $ilSetting = $DIC['ilSetting'];
63 
64  if (!strlen($a_import_id)) {
65  return 0;
66  }
67  $parts = explode('_', $a_import_id);
68 
69  if ($parts[0] != 'il') {
70  return 0;
71  }
72  if ($parts[1] != $ilSetting->get('inst_id', 0)) {
73  return 0;
74  }
75  if ($parts[2] != 'udf') {
76  return 0;
77  }
78  if ($parts[3]) {
79  // Check if field exists
80  if (is_array($this->definitions["$parts[3]"])) {
81  return $parts[3];
82  }
83  }
84  return 0;
85  }
global $DIC
Definition: saml.php:7
global $ilSetting
Definition: privfeed.php:17

◆ fetchFieldIdFromName()

ilUserDefinedFields::fetchFieldIdFromName (   $a_name)

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

87  {
88  foreach ($this->definitions as $definition) {
89  if ($definition['field_name'] == $a_name) {
90  return $definition['field_id'];
91  }
92  }
93  return 0;
94  }

◆ fieldValuesToSelectArray()

ilUserDefinedFields::fieldValuesToSelectArray (   $a_values,
  $a_with_selection_info = true 
)
Parameters
mixed[]$a_values
bool$a_with
Returns
array

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

References $DIC, $lng, and $values.

364  {
365  global $DIC;
366 
367  $lng = $DIC->language();
368  $values = [];
369  if ($a_with_selection_info) {
370  $values[''] = $lng->txt('please_select');
371  }
372  foreach ($a_values as $value) {
373  $values[$value] = $value;
374  }
375  if (count($values) > (int) $a_with_selection_info) {
376  return $values;
377  }
378  return [];
379  }
global $DIC
Definition: saml.php:7
$lng
$values

◆ getChangeableLocalUserAdministrationDefinitions()

ilUserDefinedFields::getChangeableLocalUserAdministrationDefinitions ( )

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

References $id.

130  {
131  foreach ($this->definitions as $id => $definition) {
132  if ($definition['changeable_lua']) {
133  $visible_definition[$id] = $definition;
134  }
135  }
136  return $visible_definition ? $visible_definition : array();
137  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getCourseExportableFields()

ilUserDefinedFields::getCourseExportableFields ( )

get

public

Parameters

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

References $id.

Referenced by getExportableFields().

177  {
178  foreach ($this->definitions as $id => $definition) {
179  if ($definition['course_export']) {
180  $cexp_definition[$id] = $definition;
181  }
182  }
183  return $cexp_definition ? $cexp_definition : array();
184  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getDefinition()

ilUserDefinedFields::getDefinition (   $a_id)

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

Referenced by deleteValue().

105  {
106  return is_array($this->definitions[$a_id]) ? $this->definitions[$a_id] : array();
107  }
+ Here is the caller graph for this function:

◆ getDefinitions()

ilUserDefinedFields::getDefinitions ( )
Returns
array

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

Referenced by addToXML().

100  {
101  return $this->definitions ? $this->definitions : array();
102  }
+ Here is the caller graph for this function:

◆ getExportableFields()

ilUserDefinedFields::getExportableFields (   $a_obj_id)

Get exportable field.

Parameters
int$a_obj_id
Returns

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

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

209  {
210  if (ilObject::_lookupType($a_obj_id) == 'crs') {
211  return $this->getCourseExportableFields();
212  }
213  if (ilObject::_lookupType($a_obj_id) == 'grp') {
214  return $this->getGroupExportableFields();
215  }
216  return array();
217  }
static _lookupType($a_id, $a_reference=false)
lookup object type
getGroupExportableFields()
get fields visible in groups
+ Here is the call graph for this function:

◆ getFieldName()

ilUserDefinedFields::getFieldName ( )

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

Referenced by add(), and update().

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

◆ getFieldType()

ilUserDefinedFields::getFieldType ( )

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

Referenced by add(), and update().

250  {
251  return $this->field_type;
252  }
+ Here is the caller graph for this function:

◆ getFieldValues()

ilUserDefinedFields::getFieldValues ( )

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

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

263  {
264  return $this->field_values ? $this->field_values : array();
265  }
+ Here is the caller graph for this function:

◆ getGroupExportableFields()

ilUserDefinedFields::getGroupExportableFields ( )

get fields visible in groups

public

Parameters

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

References $id.

Referenced by getExportableFields().

194  {
195  foreach ($this->definitions as $id => $definition) {
196  if ($definition['group_export']) {
197  $cexp_definition[$id] = $definition;
198  }
199  }
200  return $cexp_definition ? $cexp_definition : array();
201  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getLocalUserAdministrationDefinitions()

ilUserDefinedFields::getLocalUserAdministrationDefinitions ( )

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

References $id.

120  {
121  foreach ($this->definitions as $id => $definition) {
122  if ($definition['visib_lua']) {
123  $visible_definition[$id] = $definition;
124  }
125  }
126  return $visible_definition ? $visible_definition : array();
127  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getRegistrationDefinitions()

ilUserDefinedFields::getRegistrationDefinitions ( )

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

References $id.

140  {
141  foreach ($this->definitions as $id => $definition) {
142  if ($definition['visib_reg']) {
143  $visible_definition[$id] = $definition;
144  }
145  }
146  return $visible_definition ? $visible_definition : array();
147  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getRequiredDefinitions()

ilUserDefinedFields::getRequiredDefinitions ( )

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

References $id.

160  {
161  foreach ($this->definitions as $id => $definition) {
162  if ($definition['required']) {
163  $required_definition[$id] = $definition;
164  }
165  }
166  return $required_definition ? $required_definition : array();
167  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getSearchableDefinitions()

ilUserDefinedFields::getSearchableDefinitions ( )

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

References $id.

150  {
151  foreach ($this->definitions as $id => $definition) {
152  if ($definition['searchable']) {
153  $searchable_definition[$id] = $definition;
154  }
155  }
156  return $searchable_definition ? $searchable_definition : array();
157  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getVisibleDefinitions()

ilUserDefinedFields::getVisibleDefinitions ( )

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

References $id.

110  {
111  foreach ($this->definitions as $id => $definition) {
112  if ($definition['visible']) {
113  $visible_definition[$id] = $definition;
114  }
115  }
116  return $visible_definition ? $visible_definition : array();
117  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ isPluginType()

ilUserDefinedFields::isPluginType ( )

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

References UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

234  {
235  if (!$this->field_type) {
236  return false;
237  }
238  switch ($this->field_type) {
239  case UDF_TYPE_TEXT:
240  case UDF_TYPE_SELECT:
241  case UDF_TYPE_WYSIWYG:
242  return false;
243 
244  default:
245  return true;
246  }
247  }
const UDF_TYPE_SELECT
const UDF_TYPE_TEXT
const UDF_TYPE_WYSIWYG

◆ nameExists()

ilUserDefinedFields::nameExists (   $a_field_name)

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

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

403  {
404  global $DIC;
405 
406  $ilDB = $DIC['ilDB'];
407 
408  $query = "SELECT * FROM udf_definition " .
409  "WHERE field_name = " . $this->db->quote($a_field_name, 'text') . " ";
410  $res = $ilDB->query($query);
411 
412  return (bool) $res->numRows();
413  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ setFieldName()

ilUserDefinedFields::setFieldName (   $a_name)

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

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

◆ setFieldType()

ilUserDefinedFields::setFieldType (   $a_type)

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

References $a_type.

229  {
230  $this->field_type = $a_type;
231  }
$a_type
Definition: workflow.php:92

◆ setFieldValues()

ilUserDefinedFields::setFieldValues (   $a_values)

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

254  {
255  $this->field_values = array();
256  foreach ($a_values as $value) {
257  if (strlen($value)) {
258  $this->field_values[] = $value;
259  }
260  }
261  }

◆ toXML()

ilUserDefinedFields::toXML ( )

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

References addToXML().

587  {
588  include_once './Services/Xml/classes/class.ilXmlWriter.php';
589  $xml_writer = new ilXmlWriter();
590 
591  $this->addToXML($xml_writer);
592 
593  return $xml_writer->xmlDumpMem(false);
594  }
addToXML($xml_writer)
add user defined field data to xml (using usr dtd)
XML writer class.
+ Here is the call graph for this function:

◆ update()

ilUserDefinedFields::update (   $a_id)

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

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

474  {
475  global $DIC;
476 
477  $ilDB = $DIC['ilDB'];
478 
479  $values = array(
480  'field_name' => array('text',$this->getFieldName()),
481  'field_type' => array('integer', (int) $this->getFieldType()),
482  'field_values' => array('clob',serialize($this->getFieldValues())),
483  'visible' => array('integer', (int) $this->enabledVisible()),
484  'changeable' => array('integer', (int) $this->enabledChangeable()),
485  'required' => array('integer', (int) $this->enabledRequired()),
486  'searchable' => array('integer', (int) $this->enabledSearchable()),
487  'export' => array('integer', (int) $this->enabledExport()),
488  'course_export' => array('integer', (int) $this->enabledCourseExport()),
489  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
490  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
491  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
492  'group_export' => array('integer', (int) $this->enabledGroupExport()),
493  'certificate' => array('integer', (int) $this->enabledCertificate())
494  );
495  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_id)));
496  $this->__read();
497 
498  return true;
499  }
global $DIC
Definition: saml.php:7
$values
global $ilDB
+ Here is the call graph for this function:

◆ validateValues()

ilUserDefinedFields::validateValues ( )

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

References getFieldValues(), UDF_DUPLICATE_VALUES, and UDF_NO_VALUES.

382  {
383  $number = 0;
384  $unique = array();
385  foreach ($this->getFieldValues() as $value) {
386  if (!strlen($value)) {
387  continue;
388  }
389  $number++;
390  $unique[$value] = $value;
391  }
392 
393  if (!count($unique)) {
394  return UDF_NO_VALUES;
395  }
396  if ($number != count($unique)) {
397  return UDF_DUPLICATE_VALUES;
398  }
399  return 0;
400  }
const UDF_NO_VALUES
const UDF_DUPLICATE_VALUES
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilUserDefinedFields::$db = null

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

◆ $definitions

ilUserDefinedFields::$definitions = array()

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

◆ $field_visible_registration

ilUserDefinedFields::$field_visible_registration = 0
private

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

Referenced by enabledVisibleRegistration().


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