ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExportFieldsInfo Class Reference
+ Collaboration diagram for ilExportFieldsInfo:

Public Member Functions

 getType ()
 
 isExportable ($a_field_name)
 Check if field is exportable. More...
 
 getFieldsInfo ()
 Get informations (exportable) about user data profile fields public. More...
 
 getExportableFields ()
 Get Exportable Fields. More...
 
 getSelectableFieldsInfo (?int $a_obj_id=null)
 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 (string $a_type)
 Get Singleton Instance. More...
 

Private Member Functions

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

Private Attributes

ilSetting $settings
 
ilLanguage $lng
 
string $obj_type = ''
 
array $possible_fields = array()
 

Static Private Attributes

static array $instances = []
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilExportFieldsInfo::__construct ( string  $a_type)
private

Private Singleton Constructor.

Use getInstance private

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

References $DIC, ILIAS\Repository\lng(), read(), and ILIAS\Repository\settings().

40  {
41  global $DIC;
42 
43  $this->lng = $DIC->language();
44  $this->settings = $DIC->settings();
45  $this->obj_type = $a_type;
46 
47  $this->read();
48  }
global $DIC
Definition: shib_login.php:22
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.

Returns
string info page string

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

References getExportableFields(), and ILIAS\Repository\lng().

174  : string
175  {
176  $fields = [];
177  foreach ($this->getExportableFields() as $field) {
178  $fields[] = $this->lng->txt($field);
179  }
180  return implode('<br />', $fields);
181  }
getExportableFields()
Get Exportable Fields.
+ Here is the call graph for this function:

◆ getExportableFields()

ilExportFieldsInfo::getExportableFields ( )

Get Exportable Fields.

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

Referenced by exportableFieldsToInfoString(), and getSelectableFieldsInfo().

86  : array
87  {
88  $fields = [];
89  foreach ($this->possible_fields as $field => $exportable) {
90  if ($exportable) {
91  $fields[] = $field;
92  }
93  }
94  return $fields;
95  }
+ Here is the caller graph for this function:

◆ getFieldsInfo()

ilExportFieldsInfo::getFieldsInfo ( )

Get informations (exportable) about user data profile fields public.

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

References $possible_fields.

78  : array
79  {
81  }

◆ getSelectableFieldsInfo()

ilExportFieldsInfo::getSelectableFieldsInfo ( ?int  $a_obj_id = null)

Get selectable fields.

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

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

Referenced by ilPRGAssignmentDBRepository\__construct().

100  : array
101  {
102  global $DIC;
103 
104  $user = $DIC->user();
105 
106  $fields = [];
107  foreach ($this->getExportableFields() as $field) {
108  switch ($field) {
109  case 'lastname':
110  case 'firstname':
111  break;
112 
113  case 'username':
114  $fields['login']['txt'] = $this->lng->txt('login');
115  $fields['login']['default'] = 1;
116  break;
117 
118  default:
119  // #18795
120  $caption = ($field == "title")
121  ? "person_title"
122  : $field;
123  $fields[$field]['txt'] = $this->lng->txt($caption);
124  $fields[$field]['default'] = 0;
125  break;
126  }
127  }
128 
129  if ($a_obj_id && ilBookingEntry::hasObjectBookingEntries($a_obj_id, $user->getId())) {
130  $this->lng->loadLanguageModule('dateplaner');
131  $fields['consultation_hour']['txt'] = $this->lng->txt('cal_ch_field_ch');
132  $fields['consultation_hour']['default'] = 0;
133  }
134 
135  $udf = [];
136  switch ($this->getType()) {
137  case 'crs':
138  $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields();
139  break;
140  case 'grp':
141  $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields();
142  break;
143  case 'prg':
144  $udf = ilUserDefinedFields::_getInstance()->getProgrammeExportableFields();
145  break;
146  }
147 
148  if ($udf !== []) {
149  foreach ($udf as $field_id => $field) {
150  $fields['udf_' . $field_id]['txt'] = $field['field_name'];
151  $fields['udf_' . $field_id]['default'] = 0;
152  }
153  }
154 
155  if ($a_obj_id) {
157  foreach ($cdf as $def) {
158  $fields['odf_' . $def->getId()]['txt'] = $def->getName();
159  $fields['odf_' . $def->getId()]['default'] = 0;
160  }
161  if (count($cdf)) {
162  // add last edit
163  $fields['odf_last_update']['txt'] = $this->lng->txt($this->getType() . '_cdf_tbl_last_edit');
164  $fields['odf_last_update']['default'] = 0;
165  }
166  }
167  return $fields;
168  }
static hasObjectBookingEntries(int $a_obj_id, int $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getFields(int $a_container_id, $a_sort=self::IL_CDF_SORT_NAME)
Get all fields of a container.
global $DIC
Definition: shib_login.php:22
getExportableFields()
Get Exportable Fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExportFieldsInfo::getType ( )

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

References $obj_type.

Referenced by getSelectableFieldsInfo(), and read().

61  : string
62  {
63  return $this->obj_type;
64  }
+ Here is the caller graph for this function:

◆ isExportable()

ilExportFieldsInfo::isExportable (   $a_field_name)

Check if field is exportable.

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

69  : bool
70  {
71  return array_key_exists($a_field_name, $this->possible_fields);
72  }

◆ read()

ilExportFieldsInfo::read ( )
private

Read info about exportable fields.

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

References $data, getType(), null, and ILIAS\Repository\settings().

Referenced by __construct().

186  : void
187  {
188  $profile = new ilUserProfile();
189  $profile->skipGroup('settings');
190 
191  $field_prefix = null;
192  $field_part_limit = 5;
193  $export_hide = null;
194  $export_fix_val = null;
195  $type = $this->getType();
196 
197  $type_vals = [
198  'crs' => ['course_export_hide', 'course_export_fix_value', 'usr_settings_course_export_'],
199  'grp' => ['group_export_hide', 'group_export_fix_value', 'usr_settings_group_export_'],
200  'prg' => ['prg_export_hide', 'prg_export_fix_value', 'usr_settings_prg_export_']
201  ];
202  if (array_key_exists($type, $type_vals)) {
203  list($export_hide, $export_fix_val, $field_prefix) = $type_vals[$type];
204  }
205 
206  foreach ($profile->getStandardFields() as $key => $data) {
207  if (!array_key_exists($export_hide, $data) || !$data[$export_hide]) {
208  if (isset($data[$export_fix_val]) and $data[$export_fix_val]) {
209  $this->possible_fields[$key] = $data[$export_fix_val];
210  } else {
211  $this->possible_fields[$key] = 0;
212  }
213  }
214  }
215 
216  $settings_all = $this->settings->getAll();
217  foreach ($settings_all as $key => $value) {
218  if ($field_prefix && stristr($key, $field_prefix) and $value) {
219  // added limit for mantis 11096
220  $field_parts = explode('_', $key, $field_part_limit);
221  $field = $field_parts[count($field_parts) - 1];
222  if (array_key_exists($field, $this->possible_fields)) {
223  $this->possible_fields[$field] = 1;
224  }
225  }
226  }
227  }
Class ilUserProfile.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 232 of file class.ilExportFieldsInfo.php.

232  : void
233  {
234  $start_order = array("lastname" => array(), "firstname" => array(), "username" => array());
235 
236  foreach ($start_order as $key => $value) {
237  if (isset($this->possible_fields[$key])) {
238  $start_order[$key] = $this->possible_fields[$key];
239  unset($this->possible_fields[$key]);
240  } else {
241  unset($start_order[$key]);
242  }
243  }
244 
245  if (count($start_order) > 0) {
246  $this->possible_fields = array_merge($start_order, $this->possible_fields);
247  }
248  }

Field Documentation

◆ $instances

array ilExportFieldsInfo::$instances = []
staticprivate

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

◆ $lng

ilLanguage ilExportFieldsInfo::$lng
private

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

◆ $obj_type

string ilExportFieldsInfo::$obj_type = ''
private

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

Referenced by getType().

◆ $possible_fields

array ilExportFieldsInfo::$possible_fields = array()
private

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

Referenced by getFieldsInfo().

◆ $settings

ilSetting ilExportFieldsInfo::$settings
private

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


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