ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExportFieldsInfo Class Reference
+ Collaboration diagram for ilExportFieldsInfo:

Public Member Functions

 getType ()
 Get object type. More...
 
 isExportable ($a_field_name)
 Check if field is exportable. More...
 
 getFieldsInfo ()
 Get informations (exportable) about user data profile fields. More...
 
 getExportableFields ()
 Get Exportable Fields. More...
 
 getSelectableFieldsInfo ($a_obj_id)
 Get selectable fields. More...
 
 exportableFieldsToInfoString ()
 Get exportable fields as info string. More...
 
 sortExportFields ()
 sort Exports fields User for Name Presentation Guideline More...
 

Static Public Member Functions

static _getInstanceByType ($a_type)
 Get Singleton Instance. More...
 

Private Member Functions

 __construct ($a_type)
 Private Singleton Constructor. More...
 
 read ()
 Read info about exportable fields. More...
 

Private Attributes

 $settings
 
 $db
 
 $lng
 
 $obj_type = ''
 
 $possible_fields = array()
 

Static Private Attributes

static $instance = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilExportFieldsInfo::__construct (   $a_type)
private

Private Singleton Constructor.

Use getInstance

private

Definition at line 51 of file class.ilExportFieldsInfo.php.

References $a_type, $DIC, $ilDB, $ilSetting, $lng, read(), and settings().

52  {
53  global $DIC;
54 
55  $ilDB = $DIC['ilDB'];
56  $ilSetting = $DIC['ilSetting'];
57  $lng = $DIC['lng'];
58 
59  $this->db = $ilDB;
60  $this->lng = $lng;
61  $this->settings = $ilSetting;
62 
63  $this->obj_type = $a_type;
64 
65  $this->read();
66  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilSetting
Definition: privfeed.php:17
global $ilDB
read()
Read info about exportable fields.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByType()

◆ exportableFieldsToInfoString()

ilExportFieldsInfo::exportableFieldsToInfoString ( )

Get exportable fields as info string.

public

Returns
string info page string

Definition at line 205 of file class.ilExportFieldsInfo.php.

References getExportableFields().

206  {
207  $fields = array();
208  foreach ($this->getExportableFields() as $field) {
209  $fields[] = $this->lng->txt($field);
210  }
211  return implode('<br />', $fields);
212  }
getExportableFields()
Get Exportable Fields.
+ Here is the call graph for this function:

◆ getExportableFields()

ilExportFieldsInfo::getExportableFields ( )

Get Exportable Fields.

public

Definition at line 120 of file class.ilExportFieldsInfo.php.

Referenced by exportableFieldsToInfoString(), and getSelectableFieldsInfo().

121  {
122  foreach ($this->possible_fields as $field => $exportable) {
123  if ($exportable) {
124  $fields[] = $field;
125  }
126  }
127  return $fields ? $fields : array();
128  }
+ Here is the caller graph for this function:

◆ getFieldsInfo()

ilExportFieldsInfo::getFieldsInfo ( )

Get informations (exportable) about user data profile fields.

public

Definition at line 110 of file class.ilExportFieldsInfo.php.

References $possible_fields.

111  {
112  return $this->possible_fields;
113  }

◆ getSelectableFieldsInfo()

ilExportFieldsInfo::getSelectableFieldsInfo (   $a_obj_id)

Get selectable fields.

Returns

Definition at line 134 of file class.ilExportFieldsInfo.php.

References $def, $DIC, $GLOBALS, $lng, ilCourseDefinedFieldDefinition\_getFields(), ilUserDefinedFields\_getInstance(), getExportableFields(), getType(), and ilBookingEntry\hasObjectBookingEntries().

135  {
136  global $DIC;
137 
138  $lng = $DIC['lng'];
139 
140  $fields = array();
141  foreach ($this->getExportableFields() as $field) {
142  switch ($field) {
143  case 'lastname':
144  case 'firstname':
145  break;
146 
147  case 'username':
148  $fields['login']['txt'] = $lng->txt('login');
149  $fields['login']['default'] = 1;
150  break;
151 
152  default:
153  // #18795
154  $caption = ($field == "title")
155  ? "person_title"
156  : $field;
157  $fields[$field]['txt'] = $lng->txt($caption);
158  $fields[$field]['default'] = 0;
159  break;
160  }
161  }
162 
163  include_once './Services/Booking/classes/class.ilBookingEntry.php';
164  if (ilBookingEntry::hasObjectBookingEntries($a_obj_id, $GLOBALS['DIC']['ilUser']->getId())) {
165  $GLOBALS['DIC']['lng']->loadLanguageModule('dateplaner');
166  $fields['consultation_hour']['txt'] = $GLOBALS['DIC']['lng']->txt('cal_ch_field_ch');
167  $fields['consultation_hour']['default'] = 0;
168  }
169 
170  include_once './Services/User/classes/class.ilUserDefinedFields.php';
171  if ($this->getType() == 'crs') {
172  $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields();
173  } elseif ($this->getType() == 'grp') {
174  $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields();
175  }
176  if ($udf) {
177  foreach ($udf as $field_id => $field) {
178  $fields['udf_' . $field_id]['txt'] = $field['field_name'];
179  $fields['udf_' . $field_id]['default'] = 0;
180  }
181  }
182 
183  include_once './Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
185  foreach ($cdf as $def) {
186  $fields['odf_' . $def->getId()]['txt'] = $def->getName();
187  $fields['odf_' . $def->getId()]['default'] = 0;
188  }
189 
190  if (count($cdf)) {
191  // add last edit
192  $fields['odf_last_update']['txt'] = $GLOBALS['DIC']['lng']->txt($this->getType() . '_cdf_tbl_last_edit');
193  $fields['odf_last_update']['default'] = 0;
194  }
195 
196  return $fields;
197  }
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getInstance()
Get instance.
global $DIC
Definition: saml.php:7
getType()
Get object type.
$def
Definition: croninfo.php:21
getExportableFields()
Get Exportable Fields.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
+ Here is the call graph for this function:

◆ getType()

ilExportFieldsInfo::getType ( )

Get object type.

Returns

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

References $obj_type.

Referenced by getSelectableFieldsInfo(), and read().

87  {
88  return $this->obj_type;
89  }
+ Here is the caller graph for this function:

◆ isExportable()

ilExportFieldsInfo::isExportable (   $a_field_name)

Check if field is exportable.

public

Parameters
stringfield name
Returns
bool

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

100  {
101  return array_key_exists($a_field_name, $this->possible_fields);
102  }

◆ read()

ilExportFieldsInfo::read ( )
private

Read info about exportable fields.

private

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

References $data, $key, getType(), and settings().

Referenced by __construct().

221  {
222  include_once './Services/User/classes/class.ilUserProfile.php';
223 
224  $profile = new ilUserProfile();
225  $profile->skipGroup('settings');
226 
227  foreach ($profile->getStandardFields() as $key => $data) {
228  if ($this->getType() == 'crs') {
229  if (!$data['course_export_hide']) {
230  if (isset($data['course_export_fix_value']) and $data['course_export_fix_value']) {
231  $this->possible_fields[$key] = $data['course_export_fix_value'];
232  } else {
233  $this->possible_fields[$key] = 0;
234  }
235  }
236  } elseif ($this->getType() == 'grp') {
237  if (!$data['group_export_hide']) {
238  if (isset($data['group_export_fix_value']) and $data['group_export_fix_value']) {
239  $this->possible_fields[$key] = $data['group_export_fix_value'];
240  } else {
241  $this->possible_fields[$key] = 0;
242  }
243  }
244  }
245  }
246  $settings_all = $this->settings->getAll();
247 
248  $field_part_limit = 5;
249  switch ($this->getType()) {
250  case 'crs':
251  $field_prefix = 'usr_settings_course_export_';
252  $field_part_limit = 5;
253  break;
254 
255  case 'grp':
256  $field_prefix = 'usr_settings_group_export_';
257  $field_part_limit = 5;
258  break;
259  }
260 
261  foreach ($settings_all as $key => $value) {
262  if (stristr($key, $field_prefix) and $value) {
263  // added limit for mantis 11096
264  $field_parts = explode('_', $key, $field_part_limit);
265  $field = $field_parts[count($field_parts) - 1];
266  if (array_key_exists($field, $this->possible_fields)) {
267  $this->possible_fields[$field] = 1;
268  }
269  }
270  }
271  return true;
272  }
settings()
Definition: settings.php:2
Class ilUserProfile.
getType()
Get object type.
$key
Definition: croninfo.php:18
$data
Definition: bench.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sortExportFields()

ilExportFieldsInfo::sortExportFields ( )

sort Exports fields User for Name Presentation Guideline

Definition at line 277 of file class.ilExportFieldsInfo.php.

References $key.

278  {
279  $start_order = array("lastname" => array(), "firstname" => array(), "username" => array());
280 
281  foreach ($start_order as $key => $value) {
282  if (isset($this->possible_fields[$key])) {
283  $start_order[$key] = $this->possible_fields[$key];
284  unset($this->possible_fields[$key]);
285  } else {
286  unset($start_order[$key]);
287  }
288  }
289 
290  if (count($start_order) > 0) {
291  $this->possible_fields = array_merge($start_order, $this->possible_fields);
292  }
293  }
$key
Definition: croninfo.php:18

Field Documentation

◆ $db

ilExportFieldsInfo::$db
private

Definition at line 38 of file class.ilExportFieldsInfo.php.

◆ $instance

ilExportFieldsInfo::$instance = null
staticprivate

Definition at line 35 of file class.ilExportFieldsInfo.php.

◆ $lng

ilExportFieldsInfo::$lng
private

Definition at line 39 of file class.ilExportFieldsInfo.php.

Referenced by __construct(), and getSelectableFieldsInfo().

◆ $obj_type

ilExportFieldsInfo::$obj_type = ''
private

Definition at line 41 of file class.ilExportFieldsInfo.php.

Referenced by getType().

◆ $possible_fields

ilExportFieldsInfo::$possible_fields = array()
private

Definition at line 43 of file class.ilExportFieldsInfo.php.

Referenced by getFieldsInfo().

◆ $settings

ilExportFieldsInfo::$settings
private

Definition at line 37 of file class.ilExportFieldsInfo.php.


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