ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

@access private

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

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 }
read()
Read info about exportable fields.
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
global $ilDB
$a_type
Definition: workflow.php:92

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByType()

static ilExportFieldsInfo::_getInstanceByType (   $a_type)
static

◆ exportableFieldsToInfoString()

ilExportFieldsInfo::exportableFieldsToInfoString ( )

Get exportable fields as info string.

@access public

Returns
string info page string

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

200 {
201 $fields = array();
202 foreach ($this->getExportableFields() as $field) {
203 $fields[] = $this->lng->txt($field);
204 }
205 return implode('<br />', $fields);
206 }
getExportableFields()
Get Exportable Fields.

References getExportableFields().

+ Here is the call graph for this function:

◆ getExportableFields()

ilExportFieldsInfo::getExportableFields ( )

Get Exportable Fields.

@access public

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

117 {
118 foreach ($this->possible_fields as $field => $exportable) {
119 if ($exportable) {
120 $fields[] = $field;
121 }
122 }
123 return $fields ? $fields : array();
124 }

Referenced by exportableFieldsToInfoString(), and getSelectableFieldsInfo().

+ Here is the caller graph for this function:

◆ getFieldsInfo()

ilExportFieldsInfo::getFieldsInfo ( )

Get informations (exportable) about user data profile fields.

@access public

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

References $possible_fields.

◆ getSelectableFieldsInfo()

ilExportFieldsInfo::getSelectableFieldsInfo (   $a_obj_id)

Get selectable fields.

Returns

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

131 {
132 global $lng;
133
134 $fields = array();
135 foreach ($this->getExportableFields() as $field) {
136 switch ($field) {
137 case 'lastname':
138 case 'firstname':
139 break;
140
141 case 'username':
142 $fields['login']['txt'] = $lng->txt('login');
143 $fields['login']['default'] = 1;
144 break;
145
146 default:
147 // #18795
148 $caption = ($field == "title")
149 ? "person_title"
150 : $field;
151 $fields[$field]['txt'] = $lng->txt($caption);
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 $GLOBALS['lng']->loadLanguageModule('dateplaner');
160 $fields['consultation_hour']['txt'] = $GLOBALS['lng']->txt('cal_ch_field_ch');
161 $fields['consultation_hour']['default'] = 0;
162 }
163
164 include_once './Services/User/classes/class.ilUserDefinedFields.php';
165 if ($this->getType() == 'crs') {
166 $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields();
167 } elseif ($this->getType() == 'grp') {
168 $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields();
169 }
170 if ($udf) {
171 foreach ($udf as $field_id => $field) {
172 $fields['udf_' . $field_id]['txt'] = $field['field_name'];
173 $fields['udf_' . $field_id]['default'] = 0;
174 }
175 }
176
177 include_once './Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
179 foreach ($cdf as $def) {
180 $fields['odf_' . $def->getId()]['txt'] = $def->getName();
181 $fields['odf_' . $def->getId()]['default'] = 0;
182 }
183
184 if (count($cdf)) {
185 // add last edit
186 $fields['odf_last_update']['txt'] = $GLOBALS['lng']->txt($this->getType() . '_cdf_tbl_last_edit');
187 $fields['odf_last_update']['default'] = 0;
188 }
189
190 return $fields;
191 }
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static _getInstance()
Get instance.
$def
Definition: croninfo.php:21
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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

+ Here is the call graph for this function:

◆ getType()

ilExportFieldsInfo::getType ( )

Get object type.

Returns

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

References $obj_type.

Referenced by getSelectableFieldsInfo(), and read().

+ Here is the caller graph for this function:

◆ isExportable()

ilExportFieldsInfo::isExportable (   $a_field_name)

Check if field is exportable.

@access public

Parameters
stringfield name
Returns
bool

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

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

◆ read()

ilExportFieldsInfo::read ( )
private

Read info about exportable fields.

@access private

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

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

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

Referenced by __construct().

+ 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 271 of file class.ilExportFieldsInfo.php.

272 {
273 $start_order = array("lastname" => array(), "firstname" => array(), "username" => array());
274
275 foreach ($start_order as $key => $value) {
276 if (isset($this->possible_fields[$key])) {
277 $start_order[$key] = $this->possible_fields[$key];
278 unset($this->possible_fields[$key]);
279 } else {
280 unset($start_order[$key]);
281 }
282 }
283
284 if (count($start_order) > 0) {
285 $this->possible_fields = array_merge($start_order, $this->possible_fields);
286 }
287 }

References $key.

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: