ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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, $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 $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 472 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().

473  {
474  global $ilSetting;
475 
476  $query = "SELECT * FROM udf_definition ";
477  $res = $this->db->query($query);
478 
479  $this->definitions = array();
480  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
481  $this->definitions[$row->field_id]['field_id'] = $row->field_id;
482  $this->definitions[$row->field_id]['field_name'] = $row->field_name;
483  $this->definitions[$row->field_id]['field_type'] = $row->field_type;
484  $this->definitions[$row->field_id]['il_id'] = 'il_' . $ilSetting->get('inst_id', 0) . '_udf_' . $row->field_id;
485 
486  // #16953
487  $tmp = $sort = array();
488  $is_numeric = true;
489  foreach ((array) unserialize($row->field_values) as $item) {
490  if (!is_numeric($item)) {
491  $is_numeric = false;
492  }
493  $sort[] = array("value"=>$item);
494  }
495  foreach (ilUtil::sortArray($sort, "value", "asc", $is_numeric) as $item) {
496  $tmp[] = $item["value"];
497  }
498 
499  $this->definitions[$row->field_id]['field_values'] = $tmp;
500  $this->definitions[$row->field_id]['visible'] = $row->visible;
501  $this->definitions[$row->field_id]['changeable'] = $row->changeable;
502  $this->definitions[$row->field_id]['required'] = $row->required;
503  $this->definitions[$row->field_id]['searchable'] = $row->searchable;
504  $this->definitions[$row->field_id]['export'] = $row->export;
505  $this->definitions[$row->field_id]['course_export'] = $row->course_export;
506  $this->definitions[$row->field_id]['visib_reg'] = $row->registration_visible;
507  $this->definitions[$row->field_id]['visib_lua'] = $row->visible_lua;
508  $this->definitions[$row->field_id]['changeable_lua'] = $row->changeable_lua;
509  $this->definitions[$row->field_id]['group_export'] = $row->group_export;
510  // fraunhpatch start
511  $this->definitions[$row->field_id]['certificate'] = $row->certificate;
512  // fraunhpatch end
513  }
514 
515  return true;
516  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
foreach($_POST as $key=> $value) $res
$query
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(), ilAuthProviderSaml\buildUserAttributeXml(), ilCustomUserFieldsGUI\create(), ilCustomUserFieldsGUI\deleteField(), ilObjUser\deleteUserDefinedFieldEntries(), ilPublicUserProfileGUI\getEmbeddable(), 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(), ilUserXMLWriter\start(), ilUserDefinedData\update(), ilCustomUserFieldsGUI\update(), ilCustomUserFieldsGUI\updateFields(), and ilMemberExport\write().

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

◆ _newInstance()

static ilUserDefinedFields::_newInstance ( )
static

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

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient().

599  {
600  static $udf = null;
601 
602  return $udf = new ilUserDefinedFields();
603  }
Additional user data fields definition.
+ Here is the caller graph for this function:

◆ add()

ilUserDefinedFields::add ( )

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

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

390  {
391  global $ilDB;
392 
393  // Add definition entry
394  $next_id = $ilDB->nextId('udf_definition');
395 
396  $values = array(
397  'field_id' => array('integer',$next_id),
398  'field_name' => array('text',$this->getFieldName()),
399  'field_type' => array('integer', (int) $this->getFieldType()),
400  'field_values' => array('clob',serialize($this->getFieldValues())),
401  'visible' => array('integer', (int) $this->enabledVisible()),
402  'changeable' => array('integer', (int) $this->enabledChangeable()),
403  'required' => array('integer', (int) $this->enabledRequired()),
404  'searchable' => array('integer', (int) $this->enabledSearchable()),
405  'export' => array('integer', (int) $this->enabledExport()),
406  'course_export' => array('integer', (int) $this->enabledCourseExport()),
407  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
408  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
409  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
410  'group_export' => array('integer', (int) $this->enabledGroupExport()),
411  'certificate' => array('integer', (int) $this->enabledCertificate()),
412  );
413 
414  $ilDB->insert('udf_definition', $values);
415 
416  // add table field in usr_defined_data
417  $field_id = $next_id;
418 
419 
420  $this->__read();
421 
422  return true;
423  }
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 564 of file class.ilUserDefinedFields.php.

References $attributes, array, getDefinitions(), and UDF_TYPE_SELECT.

Referenced by toXML().

565  {
566  $xml_writer->xmlStartTag("UDFDefinitions");
567  foreach ($this->getDefinitions() as $definition) {
568  $attributes = array(
569  "Id" => $definition ["il_id"],
570  "Type" => $definition["field_type"] == UDF_TYPE_SELECT? "SELECT" : "TEXT",
571  "Visible" => $definition["visible"]? "TRUE" : "FALSE",
572  "Changeable" => $definition["changeable"]? "TRUE" : "FALSE",
573  "Required" => $definition["required"]? "TRUE" : "FALSE",
574  "Searchable" => $definition["searchable"]? "TRUE" : "FALSE",
575  "CourseExport" => $definition["course_export"]? "TRUE" : "FALSE",
576  "GroupExport" => $definition["group_export"]? "TRUE" : "FALSE",
577  "Certificate" => $definition["certificate"]? "TRUE" : "FALSE",
578  "Export" => $definition["export"]? "TRUE" : "FALSE",
579  "RegistrationVisible" => $definition["visib_reg"]? "TRUE" : "FALSE",
580  "LocalUserAdministrationVisible" => $definition["visib_lua"]? "TRUE" : "FALSE",
581  "LocalUserAdministrationChangeable" => $definition["changeable_lua"]? "TRUE" : "FALSE",
582 
583  );
584  $xml_writer->xmlStartTag("UDFDefinition", $attributes);
585  $xml_writer->xmlElement('UDFName', null, $definition['field_name']);
586  if ($definition["field_type"] == UDF_TYPE_SELECT) {
587  $field_values = $definition["field_values"];
588  foreach ($field_values as $field_value) {
589  $xml_writer->xmlElement('UDFValue', null, $field_value);
590  }
591  }
592  $xml_writer->xmlEndTag("UDFDefinition");
593  }
594  $xml_writer->xmlEndTag("UDFDefinitions");
595  }
const UDF_TYPE_SELECT
$attributes
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 424 of file class.ilUserDefinedFields.php.

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

425  {
426  global $ilDB;
427 
428  // Delete definitions
429  $query = "DELETE FROM udf_definition " .
430  "WHERE field_id = " . $this->db->quote($a_id, 'integer') . " ";
431  $res = $ilDB->manipulate($query);
432 
433  // Delete usr_data entries
434  // $ilDB->dropTableColumn('udf_data','f_'.$a_id);
435  include_once("./Services/User/classes/class.ilUserDefinedData.php");
437 
438  $this->__read();
439 
440  return true;
441  }
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 519 of file class.ilUserDefinedFields.php.

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

520  {
521  global $ilDB;
522 
523  $definition = $this->getDefinition($a_field_id);
524 
525  $counter = 0;
526  $new_values = array();
527  foreach ($definition['field_values'] as $value) {
528  if ($counter++ != $a_value_id) {
529  $new_values[] = $value;
530  } else {
531  $old_value = $value;
532  }
533  }
534 
535  $values = array(
536  'field_values' => array('clob',serialize($new_values)));
537  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_field_id)));
538 
539 
540  // sets value to '' where old value is $old_value
541  include_once("./Services/User/classes/class.ilUserDefinedData.php");
542  ilUserDefinedData::deleteFieldValue($a_field_id, $old_value);
543 
544  // fianally read data
545  $this->__read();
546 
547  return true;
548  }
$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 316 of file class.ilUserDefinedFields.php.

317  {
318  $this->field_certificate = $a_c;
319  }

◆ enableChangeable()

ilUserDefinedFields::enableChangeable (   $a_changeable)

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

260  {
261  $this->field_changeable = $a_changeable;
262  }

◆ enableChangeableLocalUserAdministration()

ilUserDefinedFields::enableChangeableLocalUserAdministration (   $a_changeable)

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

268  {
269  $this->field_changeable_lua = $a_changeable;
270  }

◆ enableCourseExport()

ilUserDefinedFields::enableCourseExport (   $a_course_export)

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

300  {
301  $this->field_course_export = $a_course_export;
302  }

◆ enabledCertificate()

ilUserDefinedFields::enabledCertificate ( )

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

Referenced by add(), and update().

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

◆ enabledChangeable()

ilUserDefinedFields::enabledChangeable ( )

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

Referenced by add(), and update().

264  {
265  return $this->field_changeable;
266  }
+ Here is the caller graph for this function:

◆ enabledChangeableLocalUserAdministration()

ilUserDefinedFields::enabledChangeableLocalUserAdministration ( )

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

Referenced by add(), and update().

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

◆ enabledCourseExport()

ilUserDefinedFields::enabledCourseExport ( )

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

Referenced by add(), and update().

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

◆ enabledExport()

ilUserDefinedFields::enabledExport ( )

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

Referenced by add(), and update().

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

◆ enabledGroupExport()

ilUserDefinedFields::enabledGroupExport ( )

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

Referenced by add(), and update().

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

◆ enabledRequired()

ilUserDefinedFields::enabledRequired ( )

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

Referenced by add(), and update().

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

◆ enabledSearchable()

ilUserDefinedFields::enabledSearchable ( )

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

Referenced by add(), and update().

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

◆ enabledVisible()

ilUserDefinedFields::enabledVisible ( )

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

Referenced by add(), and update().

248  {
249  return $this->field_visible;
250  }
+ Here is the caller graph for this function:

◆ enabledVisibleLocalUserAdministration()

ilUserDefinedFields::enabledVisibleLocalUserAdministration ( )

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

Referenced by add(), and update().

256  {
257  return $this->field_visib_lua;
258  }
+ Here is the caller graph for this function:

◆ enabledVisibleRegistration()

ilUserDefinedFields::enabledVisibleRegistration ( )

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

292  {
293  $this->field_export = $a_export;
294  }

◆ enableGroupExport()

ilUserDefinedFields::enableGroupExport (   $a_group_export)

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

308  {
309  $this->field_group_export = $a_group_export;
310  }

◆ enableRequired()

ilUserDefinedFields::enableRequired (   $a_required)

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

276  {
277  $this->field_required = $a_required;
278  }

◆ enableSearchable()

ilUserDefinedFields::enableSearchable (   $a_searchable)

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

284  {
285  $this->field_searchable = $a_searchable;
286  }

◆ enableVisible()

ilUserDefinedFields::enableVisible (   $a_visible)

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

244  {
245  $this->field_visible = $a_visible;
246  }

◆ enableVisibleLocalUserAdministration()

ilUserDefinedFields::enableVisibleLocalUserAdministration (   $a_visible)

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

252  {
253  $this->field_visib_lua = $a_visible;
254  }

◆ enableVisibleRegistration()

ilUserDefinedFields::enableVisibleRegistration (   $a_visible_registration)

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

326  {
327  $this->field_visible_registration = $a_visible_registration;
328  }

◆ fetchFieldIdFromImportId()

ilUserDefinedFields::fetchFieldIdFromImportId (   $a_import_id)

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

References $ilSetting.

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

◆ fetchFieldIdFromName()

ilUserDefinedFields::fetchFieldIdFromName (   $a_name)

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

83  {
84  foreach ($this->definitions as $definition) {
85  if ($definition['field_name'] == $a_name) {
86  return $definition['field_id'];
87  }
88  }
89  return 0;
90  }

◆ fieldValuesToSelectArray()

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

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

References $DIC, and $lng.

340  {
341  global $DIC;
342 
343  $lng = $DIC->language();
344  $values = [];
345  if ($a_with_selection_info) {
346  $values[''] = $lng->txt('please_select');
347  }
348  foreach ($a_values as $value) {
349  $values[$value] = $value;
350  }
351  if (count($values) > (int) $a_with_selection_info) {
352  return $values;
353  }
354  return [];
355  }
global $DIC
Definition: saml.php:7
global $lng
Definition: privfeed.php:17

◆ getChangeableLocalUserAdministrationDefinitions()

ilUserDefinedFields::getChangeableLocalUserAdministrationDefinitions ( )

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

References $id, and array.

123  {
124  foreach ($this->definitions as $id => $definition) {
125  if ($definition['changeable_lua']) {
126  $visible_definition[$id] = $definition;
127  }
128  }
129  return $visible_definition ? $visible_definition : array();
130  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.

◆ getCourseExportableFields()

ilUserDefinedFields::getCourseExportableFields ( )

get

public

Parameters

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

References $id, and array.

Referenced by getExportableFields().

170  {
171  foreach ($this->definitions as $id => $definition) {
172  if ($definition['course_export']) {
173  $cexp_definition[$id] = $definition;
174  }
175  }
176  return $cexp_definition ? $cexp_definition : array();
177  }
if(!array_key_exists('StateId', $_REQUEST)) $id
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 97 of file class.ilUserDefinedFields.php.

References array.

Referenced by deleteValue().

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

◆ getDefinitions()

ilUserDefinedFields::getDefinitions ( )

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

References array.

Referenced by addToXML().

93  {
94  return $this->definitions ? $this->definitions : array();
95  }
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 201 of file class.ilUserDefinedFields.php.

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

202  {
203  if (ilObject::_lookupType($a_obj_id) == 'crs') {
204  return $this->getCourseExportableFields();
205  }
206  if (ilObject::_lookupType($a_obj_id) == 'grp') {
207  return $this->getGroupExportableFields();
208  }
209  return array();
210  }
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 217 of file class.ilUserDefinedFields.php.

Referenced by add(), and update().

218  {
219  return $this->field_name;
220  }
+ Here is the caller graph for this function:

◆ getFieldType()

ilUserDefinedFields::getFieldType ( )

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

Referenced by add(), and update().

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

◆ getFieldValues()

ilUserDefinedFields::getFieldValues ( )

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

References array.

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

239  {
240  return $this->field_values ? $this->field_values : array();
241  }
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 186 of file class.ilUserDefinedFields.php.

References $id, and array.

Referenced by getExportableFields().

187  {
188  foreach ($this->definitions as $id => $definition) {
189  if ($definition['group_export']) {
190  $cexp_definition[$id] = $definition;
191  }
192  }
193  return $cexp_definition ? $cexp_definition : array();
194  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getLocalUserAdministrationDefinitions()

ilUserDefinedFields::getLocalUserAdministrationDefinitions ( )

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

References $id, and array.

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

◆ getRegistrationDefinitions()

ilUserDefinedFields::getRegistrationDefinitions ( )

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

References $id, and array.

133  {
134  foreach ($this->definitions as $id => $definition) {
135  if ($definition['visib_reg']) {
136  $visible_definition[$id] = $definition;
137  }
138  }
139  return $visible_definition ? $visible_definition : array();
140  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.

◆ getRequiredDefinitions()

ilUserDefinedFields::getRequiredDefinitions ( )

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

References $id, and array.

153  {
154  foreach ($this->definitions as $id => $definition) {
155  if ($definition['required']) {
156  $required_definition[$id] = $definition;
157  }
158  }
159  return $required_definition ? $required_definition : array();
160  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.

◆ getSearchableDefinitions()

ilUserDefinedFields::getSearchableDefinitions ( )

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

References $id, and array.

143  {
144  foreach ($this->definitions as $id => $definition) {
145  if ($definition['searchable']) {
146  $searchable_definition[$id] = $definition;
147  }
148  }
149  return $searchable_definition ? $searchable_definition : array();
150  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.

◆ getVisibleDefinitions()

ilUserDefinedFields::getVisibleDefinitions ( )

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

References $id, and array.

103  {
104  foreach ($this->definitions as $id => $definition) {
105  if ($definition['visible']) {
106  $visible_definition[$id] = $definition;
107  }
108  }
109  return $visible_definition ? $visible_definition : array();
110  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.

◆ nameExists()

ilUserDefinedFields::nameExists (   $a_field_name)

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

References $ilDB, $query, and $res.

379  {
380  global $ilDB;
381 
382  $query = "SELECT * FROM udf_definition " .
383  "WHERE field_name = " . $this->db->quote($a_field_name, 'text') . " ";
384  $res = $ilDB->query($query);
385 
386  return (bool) $res->numRows();
387  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ setFieldName()

ilUserDefinedFields::setFieldName (   $a_name)

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

214  {
215  $this->field_name = $a_name;
216  }

◆ setFieldType()

ilUserDefinedFields::setFieldType (   $a_type)

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

References $a_type.

222  {
223  $this->field_type = $a_type;
224  }
$a_type
Definition: workflow.php:92

◆ setFieldValues()

ilUserDefinedFields::setFieldValues (   $a_values)

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

References array.

230  {
231  $this->field_values = array();
232  foreach ($a_values as $value) {
233  if (strlen($value)) {
234  $this->field_values[] = $value;
235  }
236  }
237  }
Create styles array
The data for the language used.

◆ toXML()

ilUserDefinedFields::toXML ( )

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

References addToXML().

551  {
552  include_once './Services/Xml/classes/class.ilXmlWriter.php';
553  $xml_writer = new ilXmlWriter();
554 
555  $this->addToXML($xml_writer);
556 
557  return $xml_writer->xmlDumpMem(false);
558  }
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 443 of file class.ilUserDefinedFields.php.

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

444  {
445  global $ilDB;
446 
447  $values = array(
448  'field_name' => array('text',$this->getFieldName()),
449  'field_type' => array('integer', (int) $this->getFieldType()),
450  'field_values' => array('clob',serialize($this->getFieldValues())),
451  'visible' => array('integer', (int) $this->enabledVisible()),
452  'changeable' => array('integer', (int) $this->enabledChangeable()),
453  'required' => array('integer', (int) $this->enabledRequired()),
454  'searchable' => array('integer', (int) $this->enabledSearchable()),
455  'export' => array('integer', (int) $this->enabledExport()),
456  'course_export' => array('integer', (int) $this->enabledCourseExport()),
457  'registration_visible' => array('integer', (int) $this->enabledVisibleRegistration()),
458  'visible_lua' => array('integer', (int) $this->enabledVisibleLocalUserAdministration()),
459  'changeable_lua' => array('integer', (int) $this->enabledChangeableLocalUserAdministration()),
460  'group_export' => array('integer', (int) $this->enabledGroupExport()),
461  'certificate' => array('integer', (int) $this->enabledCertificate())
462  );
463  $ilDB->update('udf_definition', $values, array('field_id' => array('integer',$a_id)));
464  $this->__read();
465 
466  return true;
467  }
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 357 of file class.ilUserDefinedFields.php.

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

358  {
359  $number = 0;
360  $unique = array();
361  foreach ($this->getFieldValues() as $value) {
362  if (!strlen($value)) {
363  continue;
364  }
365  $number++;
366  $unique[$value] = $value;
367  }
368 
369  if (!count($unique)) {
370  return UDF_NO_VALUES;
371  }
372  if ($number != count($unique)) {
373  return UDF_DUPLICATE_VALUES;
374  }
375  return 0;
376  }
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: