ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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: goto.php:24

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 XapiProxy\$plugin, 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 XapiProxy\$plugin, 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->setValue($a_default_value);
130  $fprop->setSize(40);
131  $fprop->setMaxLength(255);
132  $fprop->setRequired($definition['required'] ? true : false);
133  if (!$a_changeable && (!$definition['required'] || $a_default_value)) {
134  $fprop->setDisabled(true);
135  }
136  break;
137 
138  case UDF_TYPE_WYSIWYG:
139  $fprop = new ilTextAreaInputGUI(
140  $definition['field_name'],
141  'udf_' . $definition['field_id']
142  );
143  $fprop->setValue($a_default_value);
144  $fprop->setUseRte(true);
145  $fprop->setRequired($definition['required'] ? true : false);
146  if (!$a_changeable && (!$definition['required'] || $a_default_value)) {
147  $fprop->setDisabled(true);
148  }
149  break;
150 
151  case UDF_TYPE_SELECT:
152  $fprop = new ilSelectInputGUI(
153  $definition['field_name'],
154  'udf_' . $definition['field_id']
155  );
156 
157  include_once './Services/User/classes/class.ilUserDefinedFields.php';
158  $user_defined_fields = ilUserDefinedFields::_getInstance();
159 
160  $fprop->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
161  $fprop->setValue($a_default_value);
162  $fprop->setRequired($definition['required'] ? true : false);
163  if (!$a_changeable && (!$definition['required'] || $a_default_value)) {
164  $fprop->setDisabled(true);
165  }
166  break;
167 
168  default:
169  // should be a plugin
170  foreach ($this->getActivePlugins() as $plugin) {
171  if ($plugin->getDefinitionType() == $definition['field_type']) {
172  $fprop = $plugin->getFormPropertyForDefinition($definition, $a_changeable, $a_default_value);
173  break;
174  }
175  }
176  break;
177  }
178 
179  return $fprop;
180  }
const UDF_TYPE_SELECT
static _getInstance()
Get instance.
getActivePlugins()
Get plugins for fields.
const UDF_TYPE_TEXT
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 XapiProxy\$plugin, and getActivePlugins().

75  {
76  foreach ($this->getActivePlugins() as $plugin) {
77  if ($plugin->getDefinitionType() == $a_type) {
78  return $plugin;
79  }
80  }
81  return null;
82  }
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 XapiProxy\$plugin, 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: