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

Description of class class. More...

+ Collaboration diagram for ilCustomUserFieldsHelper:

Public Member Functions

 __construct ()
 
 getUDFTypes ()
 Get udf types. More...
 
 getPluginForType ($a_type)
 Get plugin for udf type. More...
 
 getActivePlugins ()
 Get plugins for fields. More...
 
 getFormPropertyForDefinition ($definition, $a_changeable=true, $a_default_value=null)
 Get form property for definition. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Private Attributes

 $lng = null
 
 $plugin_admin = null
 
 $logger = null
 

Static Private Attributes

static $instance = null
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilCustomUserFieldsHelper.php.

Constructor & Destructor Documentation

◆ __construct()

ilCustomUserFieldsHelper::__construct ( )

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

References $DIC.

32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  $this->logger = $DIC->logger()->usr();
37  $this->plugin_admin = $DIC['ilPluginAdmin'];
38  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ getActivePlugins()

ilCustomUserFieldsHelper::getActivePlugins ( )

Get plugins for fields.

Parameters
array$def_ids
Returns
ilUDFDefinitionPlugin[]

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

References ilUDFDefinitionPlugin\UDF_C_NAME, ilUDFDefinitionPlugin\UDF_C_TYPE, and ilUDFDefinitionPlugin\UDF_SLOT_ID.

Referenced by getFormPropertyForDefinition(), getPluginForType(), and getUDFTypes().

90  {
91  $plugins = array();
92 
93  include_once './Services/User/classes/class.ilUDFDefinitionPlugin.php';
94  foreach (
95  $this->plugin_admin->getActivePluginsForSlot(
99  )
100  as $plugin) {
101  $plug = $this->plugin_admin->getPluginObject(
105  $plugin
106  );
107  if ($plug instanceof ilUDFDefinitionPlugin) {
108  $plugins[] = $plug;
109  }
110  }
111  return $plugins;
112  }
UDF type deefinition plugin.
+ Here is the caller graph for this function:

◆ getFormPropertyForDefinition()

ilCustomUserFieldsHelper::getFormPropertyForDefinition (   $definition,
  $a_changeable = true,
  $a_default_value = null 
)

Get form property for definition.

Parameters
array$definition
Returns
ilFormPropertyGUI

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

References ilUserDefinedFields\_getInstance(), getActivePlugins(), UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

120  {
121  $fprop = null;
122 
123  switch ($definition['field_type']) {
124  case UDF_TYPE_TEXT:
125  $fprop = new ilTextInputGUI(
126  $definition['field_name'],
127  'udf_' . $definition['field_id']
128  );
129  $fprop->setDisabled(!$a_changeable);
130  $fprop->setValue($a_default_value);
131  $fprop->setSize(40);
132  $fprop->setMaxLength(255);
133  $fprop->setRequired($definition['required'] ? true : false);
134  break;
135 
136  case UDF_TYPE_WYSIWYG:
137  $fprop = new ilTextAreaInputGUI(
138  $definition['field_name'],
139  'udf_' . $definition['field_id']
140  );
141  $fprop->setDisabled(!$a_changeable);
142  $fprop->setValue($a_default_value);
143  $fprop->setUseRte(true);
144  $fprop->setRequired($definition['required'] ? true : false);
145  break;
146 
147  case UDF_TYPE_SELECT:
148  $fprop = new ilSelectInputGUI(
149  $definition['field_name'],
150  'udf_' . $definition['field_id']
151  );
152  $fprop->setDisabled(!$a_changeable);
153 
154  include_once './Services/User/classes/class.ilUserDefinedFields.php';
155  $user_defined_fields = ilUserDefinedFields::_getInstance();
156 
157  $fprop->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
158  $fprop->setValue($a_default_value);
159  $fprop->setRequired($definition['required'] ? true : false);
160  break;
161 
162  default:
163  // should be a plugin
164  foreach ($this->getActivePlugins() as $plugin) {
165  if ($plugin->getDefinitionType() == $definition['field_type']) {
166  $fprop = $plugin->getFormPropertyForDefinition($definition, $a_changeable, $a_default_value);
167  break;
168  }
169  }
170  break;
171  }
172 
173  return $fprop;
174  }
const UDF_TYPE_SELECT
static _getInstance()
Get instance.
This class represents a selection list property in a property form.
getActivePlugins()
Get plugins for fields.
const UDF_TYPE_TEXT
This class represents a text property in a property form.
const UDF_TYPE_WYSIWYG
This class represents a text area property in a property form.
+ Here is the call graph for this function:

◆ getInstance()

static ilCustomUserFieldsHelper::getInstance ( )
static

Get instance.

Returns
ilCustomUserFieldsHelper

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

Referenced by ilAccountRegistrationGUI\__initForm(), ilCustomUserFieldsGUI\create(), ilObjUserGUI\getValues(), ilCustomUserFieldsGUI\initForm(), ilPersonalProfileGUI\initPersonalDataForm(), ilUserDefinedData\lookupData(), and ilCustomUserFieldsGUI\update().

45  {
46  if (self::$instance) {
47  return self::$instance;
48  }
49  return self::$instance = new self();
50  }
+ Here is the caller graph for this function:

◆ getPluginForType()

ilCustomUserFieldsHelper::getPluginForType (   $a_type)

Get plugin for udf type.

Returns
ilUDFDefinitionPlugin

Definition at line 74 of file class.ilCustomUserFieldsHelper.php.

References $a_type, and getActivePlugins().

75  {
76  foreach ($this->getActivePlugins() as $plugin) {
77  if ($plugin->getDefinitionType() == $a_type) {
78  return $plugin;
79  }
80  }
81  return null;
82  }
$a_type
Definition: workflow.php:92
getActivePlugins()
Get plugins for fields.
+ Here is the call graph for this function:

◆ getUDFTypes()

ilCustomUserFieldsHelper::getUDFTypes ( )

Get udf types.

Returns
type

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

References getActivePlugins(), UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

57  {
58  $types = array(
59  UDF_TYPE_TEXT => $this->lng->txt('udf_type_text'),
60  UDF_TYPE_SELECT => $this->lng->txt('udf_type_select'),
61  UDF_TYPE_WYSIWYG => $this->lng->txt('udf_type_wysiwyg')
62  );
63  include_once './Services/User/classes/class.ilUDFDefinitionPlugin.php';
64  foreach ($this->getActivePlugins() as $plugin) {
65  $types[$plugin->getDefinitionType()] = $plugin->getDefinitionTypeName();
66  }
67  return $types;
68  }
const UDF_TYPE_SELECT
getActivePlugins()
Get plugins for fields.
const UDF_TYPE_TEXT
const UDF_TYPE_WYSIWYG
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilCustomUserFieldsHelper::$instance = null
staticprivate

Definition at line 13 of file class.ilCustomUserFieldsHelper.php.

◆ $lng

ilCustomUserFieldsHelper::$lng = null
private

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

◆ $logger

ilCustomUserFieldsHelper::$logger = null
private

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

◆ $plugin_admin

ilCustomUserFieldsHelper::$plugin_admin = null
private

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


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