ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 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)
 
 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 $ilDB, and __read().

34  {
35  global $ilDB;
36 
37  $this->db =& $ilDB;
38 
39  $this->__read();
40  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilUserDefinedFields::__read ( )

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

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

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

492  {
493  global $ilSetting;
494 
495  $query = "SELECT * FROM udf_definition ";
496  $res = $this->db->query($query);
497 
498  $this->definitions = array();
499  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
500  {
501  $this->definitions[$row->field_id]['field_id'] = $row->field_id;
502  $this->definitions[$row->field_id]['field_name'] = $row->field_name;
503  $this->definitions[$row->field_id]['field_type'] = $row->field_type;
504  $this->definitions[$row->field_id]['il_id'] = 'il_'.$ilSetting->get('inst_id',0).'_udf_'.$row->field_id;
505 
506  // #16953
507  $tmp = $sort = array();
508  $is_numeric = true;
509  foreach((array) unserialize($row->field_values) as $item)
510  {
511  if(!is_numeric($item))
512  {
513  $is_numeric = false;
514  }
515  $sort[] = array("value"=>$item);
516  }
517  foreach(ilUtil::sortArray($sort, "value", "asc", $is_numeric) as $item)
518  {
519  $tmp[] = $item["value"];
520  }
521 
522  $this->definitions[$row->field_id]['field_values'] = $tmp;
523  $this->definitions[$row->field_id]['visible'] = $row->visible;
524  $this->definitions[$row->field_id]['changeable'] = $row->changeable;
525  $this->definitions[$row->field_id]['required'] = $row->required;
526  $this->definitions[$row->field_id]['searchable'] = $row->searchable;
527  $this->definitions[$row->field_id]['export'] = $row->export;
528  $this->definitions[$row->field_id]['course_export'] = $row->course_export;
529  $this->definitions[$row->field_id]['visib_reg'] = $row->registration_visible;
530  $this->definitions[$row->field_id]['visib_lua'] = $row->visible_lua;
531  $this->definitions[$row->field_id]['changeable_lua'] = $row->changeable_lua;
532  $this->definitions[$row->field_id]['group_export'] = $row->group_export;
533  // fraunhpatch start
534  $this->definitions[$row->field_id]['certificate'] = $row->certificate;
535  // fraunhpatch end
536  }
537 
538  return true;
539  }
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Create styles array
The data for the language used.
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
object ilUserDefinedFields

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

Referenced by ilUserSearchOptions\__appendUserDefinedFields(), ilObjUserGUI\__checkUserDefinedRequiredFields(), ilPersonalSettingsGUI\__construct(), ilCustomUserFieldSettingsTableGUI\__construct(), ilCustomUserFieldsGUI\__construct(), ilPersonalProfileGUI\__construct(), ilAccountRegistrationGUI\__initForm(), ilObjUserGUI\__showUserDefinedFields(), ilMemberAgreementGUI\addExportFieldInfo(), ilUserDefinedData\addToXML(), ilCustomUserFieldsGUI\askDeleteField(), ilCustomUserFieldsGUI\create(), ilCustomUserFieldsGUI\deleteField(), ilObjUser\deleteUserDefinedFieldEntries(), ilPublicUserProfileGUI\getEmbeddable(), ilAttendanceList\getNonMemberUserData(), ilMemberExport\getOrderedExportableFields(), ilExportFieldsInfo\getSelectableFieldsInfo(), ilLPTableBaseGUI\getSelectableUserColumns(), ilObjUserFolder\getUserDefinedExportFields(), ilObjUserGUI\getValues(), ilObjUserGUI\handleIgnoredRequiredFields(), ilUserImportParser\importEndTag(), ilMemberExportSettingsGUI\initForm(), ilMemberExportGUI\initSettingsForm(), ilLDAPAttributeToUser\initUserDefinedFields(), ilLDAPSettingsGUI\initUserDefinedFields(), ilUserProfile\isProfileIncomplete(), ilAttendanceList\readOrderedExportableFields(), ilAccountRegistrationGUI\saveForm(), ilUserXMLWriter\start(), ilUserDefinedData\update(), ilCustomUserFieldsGUI\update(), ilCustomUserFieldsGUI\updateFields(), and ilMemberExport\write().

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

◆ _newInstance()

static ilUserDefinedFields::_newInstance ( )
static

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

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient().

629  {
630  static $udf = null;
631 
632  return $udf = new ilUserDefinedFields();
633  }
Additional user data fields definition.
+ Here is the caller graph for this function:

◆ add()

ilUserDefinedFields::add ( )

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

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

409  {
410  global $ilDB;
411 
412  // Add definition entry
413  $next_id = $ilDB->nextId('udf_definition');
414 
415  $values = array(
416  'field_id' => array('integer',$next_id),
417  'field_name' => array('text',$this->getFieldName()),
418  'field_type' => array('integer', (int) $this->getFieldType()),
419  'field_values' => array('clob',serialize($this->getFieldValues())),
420  'visible' => array('integer', (int) $this->enabledVisible()),
421  'changeable' => array('integer', (int) $this->enabledChangeable()),
422  'required' => array('integer', (int) $this->enabledRequired()),
423  'searchable' => array('integer', (int) $this->enabledSearchable()),
424  'export' => array('integer', (int) $this->enabledExport()),
425  'course_export' => array('integer', (int) $this->enabledCourseExport()),
426  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
427  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
428  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
429  'group_export' => array('integer', (int) $this->enabledGroupExport()),
430  'certificate' => array('integer', (int) $this->enabledCertificate()),
431  );
432 
433  $ilDB->insert('udf_definition',$values);
434 
435  // add table field in usr_defined_data
436  $field_id = $next_id;
437 
438 
439  $this->__read();
440 
441  return true;
442  }
Create styles array
The data for the language used.
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 591 of file class.ilUserDefinedFields.php.

References array, getDefinitions(), and UDF_TYPE_SELECT.

Referenced by toXML().

592  {
593  $xml_writer->xmlStartTag ("UDFDefinitions");
594  foreach($this->getDefinitions() as $definition)
595  {
596  $attributes = array(
597  "Id" => $definition ["il_id"],
598  "Type" => $definition["field_type"] == UDF_TYPE_SELECT? "SELECT" : "TEXT",
599  "Visible" => $definition["visible"]? "TRUE" : "FALSE",
600  "Changeable" => $definition["changeable"]? "TRUE" : "FALSE",
601  "Required" => $definition["required"]? "TRUE" : "FALSE",
602  "Searchable" => $definition["searchable"]? "TRUE" : "FALSE",
603  "CourseExport" => $definition["course_export"]? "TRUE" : "FALSE",
604  "GroupExport" => $definition["group_export"]? "TRUE" : "FALSE",
605  "Certificate" => $definition["certificate"]? "TRUE" : "FALSE",
606  "Export" => $definition["export"]? "TRUE" : "FALSE",
607  "RegistrationVisible" => $definition["visib_reg"]? "TRUE" : "FALSE",
608  "LocalUserAdministrationVisible" => $definition["visib_lua"]? "TRUE" : "FALSE",
609  "LocalUserAdministrationChangeable" => $definition["changeable_lua"]? "TRUE" : "FALSE",
610 
611  );
612  $xml_writer->xmlStartTag ("UDFDefinition", $attributes);
613  $xml_writer->xmlElement('UDFName', null, $definition['field_name']);
614  if ($definition["field_type"] == UDF_TYPE_SELECT ) {
615  $field_values = $definition["field_values"];
616  foreach ($field_values as $field_value)
617  {
618  $xml_writer->xmlElement('UDFValue', null, $field_value);
619  }
620  }
621  $xml_writer->xmlEndTag ("UDFDefinition");
622  }
623  $xml_writer->xmlEndTag ("UDFDefinitions");
624 
625  }
const UDF_TYPE_SELECT
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilUserDefinedFields::delete (   $a_id)

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

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

444  {
445  global $ilDB;
446 
447  // Delete definitions
448  $query = "DELETE FROM udf_definition ".
449  "WHERE field_id = ".$this->db->quote($a_id,'integer')." ";
450  $res = $ilDB->manipulate($query);
451 
452  // Delete usr_data entries
453 // $ilDB->dropTableColumn('udf_data','f_'.$a_id);
454  include_once("./Services/User/classes/class.ilUserDefinedData.php");
456 
457  $this->__read();
458 
459  return true;
460  }
static deleteEntriesOfField($a_field_id)
Delete data of particular field.
global $ilDB
+ Here is the call graph for this function:

◆ deleteValue()

ilUserDefinedFields::deleteValue (   $a_field_id,
  $a_value_id 
)

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

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

543  {
544  global $ilDB;
545 
546  $definition = $this->getDefinition($a_field_id);
547 
548  $counter = 0;
549  $new_values = array();
550  foreach($definition['field_values'] as $value)
551  {
552  if($counter++ != $a_value_id)
553  {
554  $new_values[] = $value;
555  }
556  else
557  {
558  $old_value = $value;
559  }
560  }
561 
562  $values = array(
563  'field_values' => array('clob',serialize($new_values)));
564  $ilDB->update('udf_definition',$values,array('field_id' => array('integer',$a_field_id)));
565 
566 
567  // sets value to '' where old value is $old_value
568  include_once("./Services/User/classes/class.ilUserDefinedData.php");
569  ilUserDefinedData::deleteFieldValue($a_field_id, $old_value);
570 
571  // fianally read data
572  $this->__read();
573 
574  return true;
575  }
$counter
Create styles array
The data for the language used.
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 345 of file class.ilUserDefinedFields.php.

346  {
347  $this->field_certificate = $a_c;
348  }

◆ enableChangeable()

ilUserDefinedFields::enableChangeable (   $a_changeable)

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

289  {
290  $this->field_changeable = $a_changeable;
291  }

◆ enableChangeableLocalUserAdministration()

ilUserDefinedFields::enableChangeableLocalUserAdministration (   $a_changeable)

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

297  {
298  $this->field_changeable_lua = $a_changeable;
299  }

◆ enableCourseExport()

ilUserDefinedFields::enableCourseExport (   $a_course_export)

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

329  {
330  $this->field_course_export = $a_course_export;
331  }

◆ enabledCertificate()

ilUserDefinedFields::enabledCertificate ( )

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

Referenced by add(), and update().

350  {
351  return $this->field_certificate;
352  }
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilUserDefinedFields::enabledChangeable ( )

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

Referenced by add(), and update().

293  {
294  return $this->field_changeable;
295  }
+ Here is the caller graph for this function:

◆ enabledChangeableLocalUserAdministration()

ilUserDefinedFields::enabledChangeableLocalUserAdministration ( )

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

Referenced by add(), and update().

301  {
302  return $this->field_changeable_lua;
303  }
+ Here is the caller graph for this function:

◆ enabledCourseExport()

ilUserDefinedFields::enabledCourseExport ( )

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

Referenced by add(), and update().

333  {
334  return $this->field_course_export;
335  }
+ Here is the caller graph for this function:

◆ enabledExport()

ilUserDefinedFields::enabledExport ( )

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

Referenced by add(), and update().

325  {
326  return $this->field_export;
327  }
+ Here is the caller graph for this function:

◆ enabledGroupExport()

ilUserDefinedFields::enabledGroupExport ( )

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

Referenced by add(), and update().

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

◆ enabledRequired()

ilUserDefinedFields::enabledRequired ( )

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

Referenced by add(), and update().

309  {
310  return $this->field_required;
311  }
+ Here is the caller graph for this function:

◆ enabledSearchable()

ilUserDefinedFields::enabledSearchable ( )

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

Referenced by add(), and update().

317  {
318  return $this->field_searchable;
319  }
+ Here is the caller graph for this function:

◆ enabledVisible()

ilUserDefinedFields::enabledVisible ( )

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

Referenced by add(), and update().

277  {
278  return $this->field_visible;
279  }
+ Here is the caller graph for this function:

◆ enabledVisibleLocalUserAdministration()

ilUserDefinedFields::enabledVisibleLocalUserAdministration ( )

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

Referenced by add(), and update().

285  {
286  return $this->field_visib_lua;
287  }
+ Here is the caller graph for this function:

◆ enabledVisibleRegistration()

ilUserDefinedFields::enabledVisibleRegistration ( )

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

321  {
322  $this->field_export = $a_export;
323  }

◆ enableGroupExport()

ilUserDefinedFields::enableGroupExport (   $a_group_export)

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

337  {
338  $this->field_group_export = $a_group_export;
339  }

◆ enableRequired()

ilUserDefinedFields::enableRequired (   $a_required)

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

305  {
306  $this->field_required = $a_required;
307  }

◆ enableSearchable()

ilUserDefinedFields::enableSearchable (   $a_searchable)

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

313  {
314  $this->field_searchable = $a_searchable;
315  }

◆ enableVisible()

ilUserDefinedFields::enableVisible (   $a_visible)

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

273  {
274  $this->field_visible = $a_visible;
275  }

◆ enableVisibleLocalUserAdministration()

ilUserDefinedFields::enableVisibleLocalUserAdministration (   $a_visible)

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

281  {
282  $this->field_visib_lua = $a_visible;
283  }

◆ enableVisibleRegistration()

ilUserDefinedFields::enableVisibleRegistration (   $a_visible_registration)

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

355  {
356  $this->field_visible_registration = $a_visible_registration;
357  }

◆ fetchFieldIdFromImportId()

ilUserDefinedFields::fetchFieldIdFromImportId (   $a_import_id)

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

References $ilSetting.

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

◆ fetchFieldIdFromName()

ilUserDefinedFields::fetchFieldIdFromName (   $a_name)

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

90  {
91  foreach($this->definitions as $definition)
92  {
93  if($definition['field_name'] == $a_name)
94  {
95  return $definition['field_id'];
96  }
97  }
98  return 0;
99  }

◆ fieldValuesToSelectArray()

ilUserDefinedFields::fieldValuesToSelectArray (   $a_values)

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

References array.

364  {
365  foreach($a_values as $value)
366  {
367  $values[$value] = $value;
368  }
369  return $values ? $values : array();
370  }
Create styles array
The data for the language used.

◆ getChangeableLocalUserAdministrationDefinitions()

ilUserDefinedFields::getChangeableLocalUserAdministrationDefinitions ( )

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

References array.

136  {
137  foreach($this->definitions as $id => $definition)
138  {
139  if($definition['changeable_lua'])
140  {
141  $visible_definition[$id] = $definition;
142  }
143  }
144  return $visible_definition ? $visible_definition : array();
145  }
Create styles array
The data for the language used.

◆ getCourseExportableFields()

ilUserDefinedFields::getCourseExportableFields ( )

get

public

Parameters

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

References array.

Referenced by getExportableFields().

191  {
192  foreach($this->definitions as $id => $definition)
193  {
194  if($definition['course_export'])
195  {
196  $cexp_definition[$id] = $definition;
197  }
198  }
199  return $cexp_definition ? $cexp_definition : array();
200  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getDefinition()

ilUserDefinedFields::getDefinition (   $a_id)

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

References array.

Referenced by deleteValue().

107  {
108  return is_array($this->definitions[$a_id]) ? $this->definitions[$a_id] : array();
109  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getDefinitions()

ilUserDefinedFields::getDefinitions ( )

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

References array.

Referenced by addToXML().

102  {
103  return $this->definitions ? $this->definitions : array();
104  }
Create styles array
The data for the language used.
+ 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 226 of file class.ilUserDefinedFields.php.

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

227  {
228  if(ilObject::_lookupType($a_obj_id) == 'crs')
229  {
230  return $this->getCourseExportableFields();
231  }
232  if(ilObject::_lookupType($a_obj_id) == 'grp')
233  {
234  return $this->getGroupExportableFields();
235  }
236  return array();
237  }
Create styles array
The data for the language used.
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 244 of file class.ilUserDefinedFields.php.

Referenced by add(), and update().

245  {
246  return $this->field_name;
247  }
+ Here is the caller graph for this function:

◆ getFieldType()

ilUserDefinedFields::getFieldType ( )

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

Referenced by add(), and update().

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

◆ getFieldValues()

ilUserDefinedFields::getFieldValues ( )

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

References array.

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

268  {
269  return $this->field_values ? $this->field_values : array();
270  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getGroupExportableFields()

ilUserDefinedFields::getGroupExportableFields ( )

get fields visible in groups

public

Parameters

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

References array.

Referenced by getExportableFields().

210  {
211  foreach($this->definitions as $id => $definition)
212  {
213  if($definition['group_export'])
214  {
215  $cexp_definition[$id] = $definition;
216  }
217  }
218  return $cexp_definition ? $cexp_definition : array();
219  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getLocalUserAdministrationDefinitions()

ilUserDefinedFields::getLocalUserAdministrationDefinitions ( )

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

References array.

124  {
125  foreach($this->definitions as $id => $definition)
126  {
127  if($definition['visib_lua'])
128  {
129  $visible_definition[$id] = $definition;
130  }
131  }
132  return $visible_definition ? $visible_definition : array();
133  }
Create styles array
The data for the language used.

◆ getRegistrationDefinitions()

ilUserDefinedFields::getRegistrationDefinitions ( )

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

References array.

148  {
149  foreach($this->definitions as $id => $definition)
150  {
151  if($definition['visib_reg'])
152  {
153  $visible_definition[$id] = $definition;
154  }
155  }
156  return $visible_definition ? $visible_definition : array();
157  }
Create styles array
The data for the language used.

◆ getRequiredDefinitions()

ilUserDefinedFields::getRequiredDefinitions ( )

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

References array.

172  {
173  foreach($this->definitions as $id => $definition)
174  {
175  if($definition['required'])
176  {
177  $required_definition[$id] = $definition;
178  }
179  }
180  return $required_definition ? $required_definition : array();
181  }
Create styles array
The data for the language used.

◆ getSearchableDefinitions()

ilUserDefinedFields::getSearchableDefinitions ( )

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

References array.

160  {
161  foreach($this->definitions as $id => $definition)
162  {
163  if($definition['searchable'])
164  {
165  $searchable_definition[$id] = $definition;
166  }
167  }
168  return $searchable_definition ? $searchable_definition : array();
169  }
Create styles array
The data for the language used.

◆ getVisibleDefinitions()

ilUserDefinedFields::getVisibleDefinitions ( )

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

References array.

112  {
113  foreach($this->definitions as $id => $definition)
114  {
115  if($definition['visible'])
116  {
117  $visible_definition[$id] = $definition;
118  }
119  }
120  return $visible_definition ? $visible_definition : array();
121  }
Create styles array
The data for the language used.

◆ nameExists()

ilUserDefinedFields::nameExists (   $a_field_name)

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

References $ilDB, $query, and $res.

398  {
399  global $ilDB;
400 
401  $query = "SELECT * FROM udf_definition ".
402  "WHERE field_name = ".$this->db->quote($a_field_name,'text')." ";
403  $res = $ilDB->query($query);
404 
405  return (bool) $res->numRows();
406  }
global $ilDB

◆ setFieldName()

ilUserDefinedFields::setFieldName (   $a_name)

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

241  {
242  $this->field_name = $a_name;
243  }

◆ setFieldType()

ilUserDefinedFields::setFieldType (   $a_type)

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

References $a_type.

249  {
250  $this->field_type = $a_type;
251  }
$a_type
Definition: workflow.php:93

◆ setFieldValues()

ilUserDefinedFields::setFieldValues (   $a_values)

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

References array.

257  {
258  $this->field_values = array();
259  foreach($a_values as $value)
260  {
261  if(strlen($value))
262  {
263  $this->field_values[] = $value;
264  }
265  }
266  }
Create styles array
The data for the language used.

◆ toXML()

ilUserDefinedFields::toXML ( )

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

References addToXML().

578  {
579  include_once './Services/Xml/classes/class.ilXmlWriter.php';
580  $xml_writer = new ilXmlWriter();
581 
582  $this->addToXML ($xml_writer);
583 
584  return $xml_writer->xmlDumpMem(false);
585  }
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 462 of file class.ilUserDefinedFields.php.

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

463  {
464  global $ilDB;
465 
466  $values = array(
467  'field_name' => array('text',$this->getFieldName()),
468  'field_type' => array('integer', (int) $this->getFieldType()),
469  'field_values' => array('clob',serialize($this->getFieldValues())),
470  'visible' => array('integer', (int) $this->enabledVisible()),
471  'changeable' => array('integer', (int) $this->enabledChangeable()),
472  'required' => array('integer', (int) $this->enabledRequired()),
473  'searchable' => array('integer', (int) $this->enabledSearchable()),
474  'export' => array('integer', (int) $this->enabledExport()),
475  'course_export' => array('integer', (int) $this->enabledCourseExport()),
476  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
477  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
478  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
479  'group_export' => array('integer', (int) $this->enabledGroupExport()),
480  'certificate' => array('integer', (int) $this->enabledCertificate())
481  );
482  $ilDB->update('udf_definition',$values,array('field_id' => array('integer',$a_id)));
483  $this->__read();
484 
485  return true;
486  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ validateValues()

ilUserDefinedFields::validateValues ( )

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

References array, getFieldValues(), UDF_DUPLICATE_VALUES, and UDF_NO_VALUES.

373  {
374  $number = 0;
375  $unique = array();
376  foreach($this->getFieldValues() as $value)
377  {
378  if(!strlen($value))
379  {
380  continue;
381  }
382  $number++;
383  $unique[$value] = $value;
384  }
385 
386  if(!count($unique))
387  {
388  return UDF_NO_VALUES;
389  }
390  if($number != count($unique))
391  {
392  return UDF_DUPLICATE_VALUES;
393  }
394  return 0;
395  }
const UDF_NO_VALUES
Create styles array
The data for the language used.
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: