ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMemberExport Class Reference

Class for generation of member export files. More...

+ Collaboration diagram for ilMemberExport:

Public Member Functions

 __construct ($a_ref_id, $a_type=self::EXPORT_CSV)
 Constructor. More...
 
 filterUsers ($a_usr_ids)
 
 setFilename ($a_file)
 set filename More...
 
 getFilename ()
 get filename More...
 
 getRefId ()
 get ref_id More...
 
 getType ()
 get obj type More...
 
 getExportType ()
 get current export type More...
 
 getObjId ()
 Get obj id. More...
 
 create ()
 Create Export File. More...
 
 getCSVString ()
 toString method More...
 
 createExcel ()
 
 createCSV ()
 Create CSV File. More...
 

Data Fields

const EXPORT_CSV = 1
 
const EXPORT_EXCEL = 2
 

Protected Member Functions

 addCol ($a_value, $a_row, $a_col)
 Write on column. More...
 
 addRow ()
 Add row. More...
 
 getOrderedExportableFields ()
 Get ordered enabled fields. More...
 
 write ()
 Write data. More...
 
 initMembers ()
 Init member object. More...
 
 initGroups ()
 

Private Member Functions

 fetchUsers ()
 Fetch all users that will be exported. More...
 
 readCourseData ($a_user_ids, $a_status='member')
 Read All User related course data. More...
 
 readCourseSpecificFieldsData ()
 Read course specific fields data. More...
 
 addCourseField ($a_usr_id, $a_field, $row, $col)
 fill course specific fields More...
 
 addUserDefinedField ($udf_data, $a_field, $row, $col)
 Add user defined fields. More...
 

Private Attributes

 $ref_id
 
 $obj_id
 
 $type
 
 $members
 
 $groups = array()
 
 $groups_participants = array()
 
 $groups_rights = array()
 
 $lng
 
 $settings
 
 $export_type = null
 
 $filename = null
 
 $user_ids = array()
 
 $user_course_data = array()
 
 $user_course_fields = array()
 
 $user_profile_data = array()
 
 $privacy
 

Detailed Description

Class for generation of member export files.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

/

Definition at line 42 of file class.ilMemberExport.php.

Constructor & Destructor Documentation

◆ __construct()

ilMemberExport::__construct (   $a_ref_id,
  $a_type = self::EXPORT_CSV 
)

Constructor.

@access public

Definition at line 75 of file class.ilMemberExport.php.

76 {
77 global $ilObjDataCache,$lng;
78
79 $this->lng = $lng;
80
81 $this->export_type = $a_type;
82
83 $this->ref_id = $a_ref_id;
84 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
85 $this->type = ilObject::_lookupType($this->obj_id);
86
87 $this->initMembers();
88 $this->initGroups();
89
90 $this->agreement = ilMemberAgreement::_readByObjId($this->obj_id);
91 $this->settings = new ilUserFormSettings('memexp');
92 $this->privacy = ilPrivacySettings::_getInstance();
93 }
static _readByObjId($a_obj_id)
Read user data by object id.
initMembers()
Init member object.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance()
Get instance of ilPrivacySettings.
settings()
Definition: settings.php:2
$a_type
Definition: workflow.php:92

References $a_type, $lng, ilPrivacySettings\_getInstance(), ilObject\_lookupType(), ilMemberAgreement\_readByObjId(), initGroups(), initMembers(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCol()

ilMemberExport::addCol (   $a_value,
  $a_row,
  $a_col 
)
protected

Write on column.

Parameters
object$a_value
object$a_row
object$a_col
Returns

Definition at line 234 of file class.ilMemberExport.php.

235 {
236 switch ($this->getExportType()) {
237 case self::EXPORT_CSV:
238 $this->csv->addColumn($a_value);
239 break;
240
242 $this->worksheet->setCell($a_row+1, $a_col, $a_value);
243 break;
244 }
245 }
getExportType()
get current export type

References EXPORT_CSV, EXPORT_EXCEL, and getExportType().

Referenced by addCourseField(), addUserDefinedField(), and write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCourseField()

ilMemberExport::addCourseField (   $a_usr_id,
  $a_field,
  $row,
  $col 
)
private

fill course specific fields

@access private

Parameters
intusr_id
stringfield
Returns
bool

Definition at line 589 of file class.ilMemberExport.php.

590 {
591 if (substr($a_field, 0, 4) != 'cdf_') {
592 return false;
593 }
594 if (!$this->privacy->courseConfirmationRequired() or $this->agreement[$a_usr_id]['accepted']) {
595 $field_info = explode('_', $a_field);
596 $field_id = $field_info[1];
597 $value = $this->user_course_fields[$a_usr_id][$field_id];
598 #$this->csv->addColumn($value);
599 $this->addCol($value, $row, $col);
600 return true;
601 }
602 #$this->csv->addColumn('');
603 $this->addCol('', $row, $col);
604 return true;
605 }
addCol($a_value, $a_row, $a_col)
Write on column.

References $row, and addCol().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRow()

ilMemberExport::addRow ( )
protected

Add row.

Returns

Definition at line 251 of file class.ilMemberExport.php.

252 {
253 switch ($this->getExportType()) {
254 case self::EXPORT_CSV:
255 $this->csv->addRow();
256 break;
257
259 break;
260 }
261 }

References EXPORT_CSV, EXPORT_EXCEL, and getExportType().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUserDefinedField()

ilMemberExport::addUserDefinedField (   $udf_data,
  $a_field,
  $row,
  $col 
)
private

Add user defined fields.

@access private

Parameters
objectuser defined data object
intfield

Definition at line 615 of file class.ilMemberExport.php.

616 {
617 if (substr($a_field, 0, 4) != 'udf_') {
618 return false;
619 }
620 if (!$this->privacy->courseConfirmationRequired() or $this->agreement[$udf_data->getUserId()]['accepted']) {
621 $field_info = explode('_', $a_field);
622 $field_id = $field_info[1];
623 $value = $udf_data->get('f_' . $field_id);
624 #$this->csv->addColumn($value);
625 $this->addCol($value, $row, $col);
626 return true;
627 }
628 #$this->csv->addColumn('');
629 $this->addCol('', $row, $col);
630 }

References $row, and addCol().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilMemberExport::create ( )

Create Export File.

@access public

Definition at line 167 of file class.ilMemberExport.php.

168 {
169 $this->fetchUsers();
170
171 // DONE: Switch different export types
172 switch ($this->getExportType()) {
173 case self::EXPORT_CSV:
174 $this->createCSV();
175 break;
176
178 $this->createExcel();
179 break;
180 }
181 }
fetchUsers()
Fetch all users that will be exported.
createCSV()
Create CSV File.

References createCSV(), createExcel(), EXPORT_CSV, EXPORT_EXCEL, fetchUsers(), and getExportType().

+ Here is the call graph for this function:

◆ createCSV()

ilMemberExport::createCSV ( )

Create CSV File.

@access public

Definition at line 217 of file class.ilMemberExport.php.

218 {
219 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
220 $this->csv = new ilCSVWriter();
221
222 $this->write();
223 }
Helper class to generate CSV files.

References write().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExcel()

ilMemberExport::createExcel ( )
Returns

Definition at line 200 of file class.ilMemberExport.php.

201 {
202 include_once "./Services/Excel/classes/class.ilExcel.php";
203 $this->worksheet = new ilExcel();
204 $this->worksheet->addSheet($this->lng->txt("members"));
205
206 $this->write();
207
208 $this->worksheet->writeToFile($this->getFilename());
209 }
getFilename()
get filename

References getFilename(), and write().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchUsers()

ilMemberExport::fetchUsers ( )
private

Fetch all users that will be exported.

@access private

Definition at line 511 of file class.ilMemberExport.php.

512 {
514
515 if ($this->settings->enabled('admin')) {
516 $this->user_ids = $tmp_ids = $this->members->getAdmins();
517 $this->readCourseData($tmp_ids);
518 }
519 if ($this->settings->enabled('tutor')) {
520 $this->user_ids = array_merge($tmp_ids = $this->members->getTutors(), $this->user_ids);
521 $this->readCourseData($tmp_ids);
522 }
523 if ($this->settings->enabled('member')) {
524 $this->user_ids = array_merge($tmp_ids = $this->members->getMembers(), $this->user_ids);
525 $this->readCourseData($tmp_ids);
526 }
527 if ($this->settings->enabled('subscribers')) {
528 $this->user_ids = array_merge($tmp_ids = $this->members->getSubscribers(), $this->user_ids);
529 $this->readCourseData($tmp_ids, 'subscriber');
530 }
531 if ($this->settings->enabled('waiting_list')) {
532 include_once('Modules/Course/classes/class.ilCourseWaitingList.php');
533 $waiting_list = new ilCourseWaitingList($this->obj_id);
534 $this->user_ids = array_merge($waiting_list->getUserIds(), $this->user_ids);
535 }
536 $this->user_ids = $this->filterUsers($this->user_ids);
537
538 // Sort by lastname
539 $this->user_ids = ilUtil::_sortIds($this->user_ids, 'usr_data', 'lastname', 'usr_id');
540
541 // Finally read user profile data
542 $this->user_profile_data = ilObjUser::_readUsersProfileData($this->user_ids);
543 }
readCourseData($a_user_ids, $a_status='member')
Read All User related course data.
readCourseSpecificFieldsData()
Read course specific fields data.
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...

References ilObjUser\_readUsersProfileData(), ilUtil\_sortIds(), filterUsers(), readCourseData(), readCourseSpecificFieldsData(), and settings().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterUsers()

ilMemberExport::filterUsers (   $a_usr_ids)

Definition at line 96 of file class.ilMemberExport.php.

97 {
98 return $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
99 'manage_members',
100 'manage_members',
101 $this->ref_id,
102 $a_usr_ids
103 );
104 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS.

Referenced by fetchUsers().

+ Here is the caller graph for this function:

◆ getCSVString()

ilMemberExport::getCSVString ( )

toString method

@access public

Parameters

Definition at line 190 of file class.ilMemberExport.php.

191 {
192 return $this->csv->getCSVString();
193 }

◆ getExportType()

ilMemberExport::getExportType ( )

get current export type

Returns

Definition at line 147 of file class.ilMemberExport.php.

148 {
149 return $this->export_type;
150 }

References $export_type.

Referenced by addCol(), addRow(), and create().

+ Here is the caller graph for this function:

◆ getFilename()

ilMemberExport::getFilename ( )

get filename

Returns

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

121 {
122 return $this->filename;
123 }

References $filename.

Referenced by createExcel().

+ Here is the caller graph for this function:

◆ getObjId()

ilMemberExport::getObjId ( )

Get obj id.

Returns

Definition at line 156 of file class.ilMemberExport.php.

157 {
158 return $this->obj_id;
159 }

References $obj_id.

Referenced by initMembers().

+ Here is the caller graph for this function:

◆ getOrderedExportableFields()

ilMemberExport::getOrderedExportableFields ( )
protected

Get ordered enabled fields.

@access public

Parameters

Definition at line 270 of file class.ilMemberExport.php.

271 {
272 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
273 include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
274 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
275 include_once('Services/User/classes/class.ilUserDefinedFields.php');
276
278 $field_info->sortExportFields();
279 $fields[] = 'role';
280 // Append agreement info
282 if ($privacy->courseConfirmationRequired()) {
283 $fields[] = 'agreement';
284 }
285
286 foreach ($field_info->getExportableFields() as $field) {
287 if ($this->settings->enabled($field)) {
288 $fields[] = $field;
289 }
290 }
291
293 foreach ($udf->getCourseExportableFields() as $field_id => $udf_data) {
294 if ($this->settings->enabled('udf_' . $field_id)) {
295 $fields[] = 'udf_' . $field_id;
296 }
297 }
298
299 // Add course specific fields
300 foreach (ilCourseDefinedFieldDefinition::_getFields($this->obj_id) as $field_obj) {
301 if ($this->settings->enabled('cdf_' . $field_obj->getId())) {
302 $fields[] = 'cdf_' . $field_obj->getId();
303 }
304 }
305 if ($this->settings->enabled('group_memberships')) {
306 $fields[] = 'crs_members_groups';
307 }
308
309 return $fields ? $fields : array();
310 }
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static _getInstanceByType($a_type)
Get Singleton Instance.
static _getInstance()
Get instance.

References $privacy, ilCourseDefinedFieldDefinition\_getFields(), ilPrivacySettings\_getInstance(), ilUserDefinedFields\_getInstance(), ilExportFieldsInfo\_getInstanceByType(), ilObject\_lookupType(), and settings().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilMemberExport::getRefId ( )

get ref_id

Returns

Definition at line 129 of file class.ilMemberExport.php.

130 {
131 return $this->ref_id;
132 }

References $ref_id.

◆ getType()

ilMemberExport::getType ( )

get obj type

Returns

Definition at line 138 of file class.ilMemberExport.php.

139 {
140 return $this->type;
141 }

References $type.

Referenced by initMembers(), and readCourseData().

+ Here is the caller graph for this function:

◆ initGroups()

ilMemberExport::initGroups ( )
protected

Definition at line 647 of file class.ilMemberExport.php.

648 {
649 global $tree, $ilAccess;
650 $parent_node = $tree->getNodeData($this->ref_id);
651 $groups = $tree->getSubTree($parent_node, true, "grp");
652 if (is_array($groups) && sizeof($groups)) {
653 include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
654 $this->groups_rights = array();
655 foreach ($groups as $idx => $group_data) {
656 // check for group in group
657 if ($group_data["parent"] != $this->ref_id && $tree->checkForParentType($group_data["ref_id"], "grp", true)) {
658 unset($groups[$idx]);
659 } else {
660 $this->groups[$group_data["ref_id"]] = $group_data["title"];
661 //TODO: change permissions from write to manage_members plus "|| ilObjGroup->getShowMembers()"----- uncomment below; testing required
662 //$obj = new ilObjGroup($group_data["ref_id"], true);
663 $this->groups_rights[$group_data["ref_id"]] = (bool) $ilAccess->checkAccess("write", "", $group_data["ref_id"])/* || $obj->getShowMembers()*/;
664 $gobj = ilGroupParticipants::_getInstanceByObjId($group_data["obj_id"]);
665 $this->groups_participants[$group_data["ref_id"]] = $gobj->getParticipants();
666 }
667 }
668 }
669 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

References $groups, and ilGroupParticipants\_getInstanceByObjId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initMembers()

ilMemberExport::initMembers ( )
protected

Init member object.

Returns

Definition at line 636 of file class.ilMemberExport.php.

637 {
638 if ($this->getType() == 'crs') {
639 $this->members = ilCourseParticipants::_getInstanceByObjId($this->getObjId());
640 }
641 if ($this->getType() == 'grp') {
642 $this->members = ilGroupParticipants::_getInstanceByObjId($this->getObjId());
643 }
644 return true;
645 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

References ilCourseParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), getObjId(), and getType().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readCourseData()

ilMemberExport::readCourseData (   $a_user_ids,
  $a_status = 'member' 
)
private

Read All User related course data.

@access private

Definition at line 551 of file class.ilMemberExport.php.

552 {
553 foreach ($a_user_ids as $user_id) {
554 // Read course related data
555 if ($this->members->isAdmin($user_id)) {
556 $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_ADMIN : IL_GRP_ADMIN;
557 } elseif ($this->members->isTutor($user_id)) {
558 $this->user_course_data[$user_id]['role'] = IL_CRS_TUTOR;
559 } elseif ($this->members->isMember($user_id)) {
560 $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_MEMBER : IL_GRP_MEMBER;
561 } else {
562 $this->user_course_data[$user_id]['role'] = 'subscriber';
563 }
564 }
565 }
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_GRP_MEMBER
const IL_CRS_TUTOR
const IL_GRP_ADMIN

References getType(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_MEMBER.

Referenced by fetchUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readCourseSpecificFieldsData()

ilMemberExport::readCourseSpecificFieldsData ( )
private

Read course specific fields data.

@access private

Parameters

Definition at line 574 of file class.ilMemberExport.php.

575 {
576 include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
577 $this->user_course_fields = ilCourseUserData::_getValuesByObjId($this->obj_id);
578 }
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)

References ilCourseUserData\_getValuesByObjId().

Referenced by fetchUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFilename()

ilMemberExport::setFilename (   $a_file)

set filename

Parameters
object$a_file
Returns

Definition at line 111 of file class.ilMemberExport.php.

112 {
113 $this->filename = $a_file;
114 }

◆ write()

ilMemberExport::write ( )
protected

Write data.

Returns

Definition at line 316 of file class.ilMemberExport.php.

317 {
318 // Add header line
319 $row = 0;
320 $col = 0;
321 foreach ($all_fields = $this->getOrderedExportableFields() as $field) {
322 switch ($field) {
323 case 'role':
324 #$this->csv->addColumn($this->lng->txt($this->getType().'_role_status'));
325 $this->addCol($this->lng->txt($this->getType() . '_role_status'), $row, $col++);
326 break;
327 case 'agreement':
328 #$this->csv->addColumn($this->lng->txt('ps_agreement_accepted'));
329 $this->addCol($this->lng->txt('ps_agreement_accepted'), $row, $col++);
330 break;
331 case 'consultation_hour':
332 $this->lng->loadLanguageModule('dateplaner');
333 $this->addCol($this->lng->txt('cal_ch_field_ch'), $row, $col++);
334 break;
335
336 case 'org_units':
337 $this->addCol($this->lng->txt('org_units'), $row, $col++);
338 break;
339
340 default:
341 if (substr($field, 0, 4) == 'udf_') {
342 $field_id = explode('_', $field);
343 include_once('Services/User/classes/class.ilUserDefinedFields.php');
345 $def = $udf->getDefinition($field_id[1]);
346 #$this->csv->addColumn($def['field_name']);
347 $this->addCol($def['field_name'], $row, $col++);
348 } elseif (substr($field, 0, 4) == 'cdf_') {
349 $field_id = explode('_', $field);
350 #$this->csv->addColumn(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]));
351 $this->addCol(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]), $row, $col++);
352 } elseif ($field == "username") {//User Name Presentation Guideline; username should be named login
353 $this->addCol($this->lng->txt("login"), $row, $col++);
354 } else {
355 #$this->csv->addColumn($this->lng->txt($field));
356 $this->addCol($this->lng->txt($field), $row, $col++);
357 }
358 break;
359 }
360 }
361 #$this->csv->addRow();
362 $this->addRow();
363 // Add user data
364 foreach ($this->user_ids as $usr_id) {
365 $row++;
366 $col = 0;
367
368 $udf_data = new ilUserDefinedData($usr_id);
369 foreach ($all_fields as $field) {
370 // Handle course defined fields
371 if ($this->addUserDefinedField($udf_data, $field, $row, $col)) {
372 $col++;
373 continue;
374 }
375
376 if ($this->addCourseField($usr_id, $field, $row, $col)) {
377 $col++;
378 continue;
379 }
380
381 switch ($field) {
382 case 'role':
383 switch ($this->user_course_data[$usr_id]['role']) {
384 case IL_CRS_ADMIN:
385 #$this->csv->addColumn($this->lng->txt('crs_admin'));
386 $this->addCol($this->lng->txt('crs_admin'), $row, $col++);
387 break;
388
389 case IL_CRS_TUTOR:
390 #$this->csv->addColumn($this->lng->txt('crs_tutor'));
391 $this->addCol($this->lng->txt('crs_tutor'), $row, $col++);
392 break;
393
394 case IL_CRS_MEMBER:
395 #$this->csv->addColumn($this->lng->txt('crs_member'));
396 $this->addCol($this->lng->txt('crs_member'), $row, $col++);
397 break;
398
399 case IL_GRP_ADMIN:
400 #$this->csv->addColumn($this->lng->txt('il_grp_admin'));
401 $this->addCol($this->lng->txt('il_grp_admin'), $row, $col++);
402 break;
403
404 case IL_GRP_MEMBER:
405 #$this->csv->addColumn($this->lng->txt('il_grp_member'));
406 $this->addCol($this->lng->txt('il_grp_member'), $row, $col++);
407 break;
408
409 case 'subscriber':
410 #$this->csv->addColumn($this->lng->txt($this->getType().'_subscriber'));
411 $this->addCol($this->lng->txt($this->getType() . '_subscriber'), $row, $col++);
412 break;
413
414 default:
415 #$this->csv->addColumn($this->lng->txt('crs_waiting_list'));
416 $this->addCol($this->lng->txt('crs_waiting_list'), $row, $col++);
417 break;
418
419 }
420 break;
421
422 case 'agreement':
423 if (isset($this->agreement[$usr_id])) {
424 if ($this->agreement[$usr_id]['accepted']) {
425 #$this->csv->addColumn(il-Format::format-Unix-Time($this->agreement[$usr_id]['acceptance_time'],true));
426 $dt = new ilDateTime($this->agreement[$usr_id]['acceptance_time'], IL_CAL_UNIX);
427 $this->addCol($dt->get(IL_CAL_DATETIME), $row, $col++);
428 } else {
429 #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
430 $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++);
431 }
432 } else {
433 #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
434 $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++);
435 }
436 break;
437
438 // These fields are always enabled
439 case 'username':
440 #$this->csv->addColumn($this->user_profile_data[$usr_id]['login']);
441 $this->addCol($this->user_profile_data[$usr_id]['login'], $row, $col++);
442 break;
443
444 case 'firstname':
445 case 'lastname':
446 #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]);
447 $this->addCol($this->user_profile_data[$usr_id][$field], $row, $col++);
448 break;
449
450 case 'consultation_hour':
451 include_once './Services/Booking/classes/class.ilBookingEntry.php';
452 $bookings = ilBookingEntry::lookupManagedBookingsForObject($this->obj_id, $GLOBALS['ilUser']->getId());
453
454 $uts = array();
455 foreach ((array) $bookings[$usr_id] as $ut) {
458 new ilDateTime($ut['dt'], IL_CAL_UNIX),
459 new ilDateTime($ut['dtend'], IL_CAL_UNIX)
460 );
461 if (strlen($ut['explanation'])) {
462 $tmp .= ' ' . $ut['explanation'];
463 }
464 $uts[] = $tmp;
465 }
466 $uts_str = implode(',', $uts);
467 $this->addCol($uts_str, $row, $col++);
468 break;
469 case 'crs_members_groups':
470 $groups = array();
471
472 foreach (array_keys($this->groups) as $grp_ref) {
473 if (in_array($usr_id, $this->groups_participants[$grp_ref])
474 && $this->groups_rights[$grp_ref]) {
475 $groups[] = $this->groups[$grp_ref];
476 }
477 }
478 $this->addCol(implode(", ", $groups), $row, $col++);
479 break;
480
481 case 'org_units':
482 $this->addCol(ilObjUser::lookupOrgUnitsRepresentation($usr_id), $row, $col++);
483 break;
484
485 default:
486 // Check aggreement
487 if (!$this->privacy->courseConfirmationRequired() or $this->agreement[$usr_id]['accepted']) {
488 #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]);
489 $this->addCol($this->user_profile_data[$usr_id][$field], $row, $col++);
490 } else {
491 #$this->csv->addColumn('');
492 $this->addCol('', $row, $col++);
493 }
494 break;
495
496 }
497 }
498 #$this->csv->addRow();
499 $this->addRow();
500 }
501 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
static lookupManagedBookingsForObject($a_obj_id, $a_usr_id)
Lookup bookings for own and managed consultation hours of an object.
static _lookupName($a_field_id)
Lookup field name.
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
addUserDefinedField($udf_data, $a_field, $row, $col)
Add user defined fields.
addCourseField($a_usr_id, $a_field, $row, $col)
fill course specific fields
getOrderedExportableFields()
Get ordered enabled fields.
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
Class ilUserDefinedData.
$def
Definition: croninfo.php:21

References $def, $GLOBALS, $groups, $row, ilUserDefinedFields\_getInstance(), ilCourseDefinedFieldDefinition\_lookupName(), addCol(), addCourseField(), addRow(), addUserDefinedField(), ilDatePresentation\formatPeriod(), getOrderedExportableFields(), IL_CAL_DATETIME, IL_CAL_UNIX, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, ilBookingEntry\lookupManagedBookingsForObject(), ilObjUser\lookupOrgUnitsRepresentation(), and ilDatePresentation\setUseRelativeDates().

Referenced by createCSV(), and createExcel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $export_type

ilMemberExport::$export_type = null
private

Definition at line 60 of file class.ilMemberExport.php.

Referenced by getExportType().

◆ $filename

ilMemberExport::$filename = null
private

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

Referenced by getFilename().

◆ $groups

ilMemberExport::$groups = array()
private

Definition at line 52 of file class.ilMemberExport.php.

Referenced by initGroups(), and write().

◆ $groups_participants

ilMemberExport::$groups_participants = array()
private

Definition at line 53 of file class.ilMemberExport.php.

◆ $groups_rights

ilMemberExport::$groups_rights = array()
private

Definition at line 54 of file class.ilMemberExport.php.

◆ $lng

ilMemberExport::$lng
private

Definition at line 56 of file class.ilMemberExport.php.

Referenced by __construct().

◆ $members

ilMemberExport::$members
private

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

◆ $obj_id

ilMemberExport::$obj_id
private

Definition at line 49 of file class.ilMemberExport.php.

Referenced by getObjId().

◆ $privacy

ilMemberExport::$privacy
private

Definition at line 67 of file class.ilMemberExport.php.

Referenced by getOrderedExportableFields().

◆ $ref_id

ilMemberExport::$ref_id
private

Definition at line 48 of file class.ilMemberExport.php.

Referenced by getRefId().

◆ $settings

ilMemberExport::$settings
private

Definition at line 58 of file class.ilMemberExport.php.

◆ $type

ilMemberExport::$type
private

Definition at line 50 of file class.ilMemberExport.php.

Referenced by getType().

◆ $user_course_data

ilMemberExport::$user_course_data = array()
private

Definition at line 64 of file class.ilMemberExport.php.

◆ $user_course_fields

ilMemberExport::$user_course_fields = array()
private

Definition at line 65 of file class.ilMemberExport.php.

◆ $user_ids

ilMemberExport::$user_ids = array()
private

Definition at line 63 of file class.ilMemberExport.php.

◆ $user_profile_data

ilMemberExport::$user_profile_data = array()
private

Definition at line 66 of file class.ilMemberExport.php.

◆ EXPORT_CSV

const ilMemberExport::EXPORT_CSV = 1

Definition at line 44 of file class.ilMemberExport.php.

Referenced by addCol(), addRow(), and create().

◆ EXPORT_EXCEL

const ilMemberExport::EXPORT_EXCEL = 2

Definition at line 45 of file class.ilMemberExport.php.

Referenced by addCol(), addRow(), create(), and ilMemberExportGUI\exportExcel().


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