ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 $ilDB, $ilSetting, $lng, and read().

52  {
53  global $ilDB,$ilSetting,$lng;
54 
55  $this->db = $ilDB;
56  $this->lng = $lng;
57  $this->settings = $ilSetting;
58 
59  $this->obj_type = $a_type;
60 
61  $this->read();
62  }
global $ilSetting
Definition: privfeed.php:40
global $ilDB
read()
Read info about exportable fields.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByType()

static ilExportFieldsInfo::_getInstanceByType (   $a_type)
static

Get Singleton Instance.

public

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

Referenced by ilMemberExportGUI\__construct(), ilMemberAgreementGUI\addExportFieldInfo(), ilRegistrationGUI\fillAgreement(), ilMemberExport\getOrderedExportableFields(), ilParticipantTableGUI\getSelectableColumns(), ilSubscriberTableGUI\getSelectableColumns(), ilWaitingListTableGUI\getSelectableColumns(), ilObjCourseGUI\infoScreen(), and ilObjGroupGUI\infoScreen().

71  {
72  if(is_object(self::$instance[$a_type]))
73  {
74  return self::$instance[$a_type];
75  }
76  return self::$instance[$a_type] = new ilExportFieldsInfo($a_type);
77  }
+ Here is the caller graph for this function:

◆ exportableFieldsToInfoString()

ilExportFieldsInfo::exportableFieldsToInfoString ( )

Get exportable fields as info string.

public

Returns
string info page string

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

References getExportableFields().

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

◆ getExportableFields()

ilExportFieldsInfo::getExportableFields ( )

Get Exportable Fields.

public

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

Referenced by exportableFieldsToInfoString(), and getSelectableFieldsInfo().

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

◆ getFieldsInfo()

ilExportFieldsInfo::getFieldsInfo ( )

Get informations (exportable) about user data profile fields.

public

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

References $possible_fields.

108  {
109  return $this->possible_fields;
110  }

◆ getSelectableFieldsInfo()

ilExportFieldsInfo::getSelectableFieldsInfo (   $a_obj_id)

Get selectable fields.

Returns

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

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

134  {
135  global $lng;
136 
137  $fields = array();
138  foreach($this->getExportableFields() as $field)
139  {
140  switch($field)
141  {
142  case 'lastname':
143  case 'firstname':
144  break;
145 
146  case 'username':
147  $fields['login']['txt'] = $lng->txt('login');
148  $fields['login']['default'] = 1;
149  break;
150  default:
151  $fields[$field]['txt'] = $lng->txt($field);
152  $fields[$field]['default'] = 0;
153  break;
154  }
155  }
156 
157  include_once './Services/Booking/classes/class.ilBookingEntry.php';
158  if(ilBookingEntry::hasObjectBookingEntries($a_obj_id, $GLOBALS['ilUser']->getId()))
159  {
160  $GLOBALS['lng']->loadLanguageModule('dateplaner');
161  $fields['consultation_hour']['txt'] = $GLOBALS['lng']->txt('cal_ch_field_ch');
162  $fields['consultation_hour']['default'] = 0;
163  }
164 
165  include_once './Services/User/classes/class.ilUserDefinedFields.php';
166  if($this->getType() == 'crs')
167  {
168  $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields();
169  }
170  elseif($this->getType() == 'grp')
171  {
172  $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields();
173  }
174  if($udf)
175  {
176  foreach($udf as $field_id => $field)
177  {
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  {
187  $fields['odf_'.$def->getId()]['txt'] = $def->getName();
188  $fields['odf_'.$def->getId()]['default'] = 0;
189  }
190 
191  if(count($cdf))
192  {
193  // add last edit
194  $fields['odf_last_update']['txt'] = $GLOBALS['lng']->txt($this->getType().'_cdf_tbl_last_edit');
195  $fields['odf_last_update']['default'] = 0;
196  }
197 
198  return $fields;
199  }
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getInstance()
Get instance.
getType()
Get object type.
$GLOBALS['ct_recipient']
getExportableFields()
Get Exportable Fields.
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 83 of file class.ilExportFieldsInfo.php.

References $obj_type.

Referenced by getSelectableFieldsInfo(), and read().

84  {
85  return $this->obj_type;
86  }
+ 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 96 of file class.ilExportFieldsInfo.php.

97  {
98  return array_key_exists($a_field_name,$this->possible_fields);
99  }

◆ read()

ilExportFieldsInfo::read ( )
private

Read info about exportable fields.

private

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

References $data, and getType().

Referenced by __construct().

224  {
225  include_once './Services/User/classes/class.ilUserProfile.php';
226 
227  $profile = new ilUserProfile();
228  $profile->skipGroup('settings');
229 
230  foreach($profile->getStandardFields() as $key => $data)
231  {
232  if($this->getType() == 'crs')
233  {
234  if(!$data['course_export_hide'])
235  {
236  if(isset($data['course_export_fix_value']) and $data['course_export_fix_value'])
237  {
238  $this->possible_fields[$key] = $data['course_export_fix_value'];
239  }
240  else
241  {
242  $this->possible_fields[$key] = 0;
243  }
244  }
245  }
246  elseif($this->getType() == 'grp')
247  {
248  if(!$data['group_export_hide'])
249  {
250  if(isset($data['group_export_fix_value']) and $data['group_export_fix_value'])
251  {
252  $this->possible_fields[$key] = $data['group_export_fix_value'];
253  }
254  else
255  {
256  $this->possible_fields[$key] = 0;
257  }
258  }
259  }
260  }
261  $settings_all = $this->settings->getAll();
262 
263  $field_part_limit = 5;
264  switch($this->getType())
265  {
266  case 'crs':
267  $field_prefix = 'usr_settings_course_export_';
268  $field_part_limit = 5;
269  break;
270 
271  case 'grp':
272  $field_prefix = 'usr_settings_group_export_';
273  $field_part_limit = 5;
274  break;
275  }
276 
277  foreach($settings_all as $key => $value)
278  {
279  if(stristr($key,$field_prefix) and $value)
280  {
281  // added limit for mantis 11096
282  $field_parts = explode('_',$key,$field_part_limit);
283  $field = $field_parts[count($field_parts) - 1];
284  if(array_key_exists($field,$this->possible_fields))
285  {
286  $this->possible_fields[$field] = 1;
287  }
288  }
289  }
290  return true;
291  }
Class ilUserProfile.
getType()
Get object type.
+ 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 296 of file class.ilExportFieldsInfo.php.

297  {
298 
299  $start_order = array("lastname" => array(), "firstname" => array(), "username" => array());
300 
301  foreach($start_order as $key => $value)
302  {
303  if(isset($this->possible_fields[$key]))
304  {
305  $start_order[$key] = $this->possible_fields[$key];
306  unset($this->possible_fields[$key]);
307  }else
308  {
309  unset($start_order[$key]);
310  }
311  }
312 
313  if(count($start_order) > 0)
314  {
315  $this->possible_fields = array_merge($start_order, $this->possible_fields);
316  }
317  }

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: