ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

public

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

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

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

References getExportType().

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

238  {
239  switch ($this->getExportType()) {
240  case self::EXPORT_CSV:
241  $this->csv->addColumn($a_value);
242  break;
243 
244  case self::EXPORT_EXCEL:
245  $this->worksheet->setCell($a_row + 1, $a_col, $a_value);
246  break;
247  }
248  }
getExportType()
get current export type
+ 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

private

Parameters
intusr_id
stringfield
Returns
bool

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

References $row, and addCol().

Referenced by write().

593  {
594  if (substr($a_field, 0, 4) != 'cdf_') {
595  return false;
596  }
597  if (!$this->privacy->courseConfirmationRequired() or $this->agreement[$a_usr_id]['accepted']) {
598  $field_info = explode('_', $a_field);
599  $field_id = $field_info[1];
600  $value = $this->user_course_fields[$a_usr_id][$field_id];
601  #$this->csv->addColumn($value);
602  $this->addCol($value, $row, $col);
603  return true;
604  }
605  #$this->csv->addColumn('');
606  $this->addCol('', $row, $col);
607  return true;
608  }
addCol($a_value, $a_row, $a_col)
Write on column.
$row
+ 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 254 of file class.ilMemberExport.php.

References getExportType().

Referenced by write().

255  {
256  switch ($this->getExportType()) {
257  case self::EXPORT_CSV:
258  $this->csv->addRow();
259  break;
260 
261  case self::EXPORT_EXCEL:
262  break;
263  }
264  }
getExportType()
get current export type
+ 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.

private

Parameters
objectuser defined data object
intfield

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

References $row, and addCol().

Referenced by write().

619  {
620  if (substr($a_field, 0, 4) != 'udf_') {
621  return false;
622  }
623 
624  if (!$this->privacy->courseConfirmationRequired() or $this->agreement[$udf_data->getUserId()]['accepted']) {
625  $field_info = explode('_', $a_field);
626  $field_id = $field_info[1];
627  $value = $udf_data->get('f_' . $field_id);
628  #$this->csv->addColumn($value);
629  $this->addCol($value, $row, $col);
630  return true;
631  }
632 
633  $this->addCol('', $row, $col);
634  return true;
635  }
addCol($a_value, $a_row, $a_col)
Write on column.
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilMemberExport::create ( )

Create Export File.

public

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

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

171  {
172  $this->fetchUsers();
173 
174  // DONE: Switch different export types
175  switch ($this->getExportType()) {
176  case self::EXPORT_CSV:
177  $this->createCSV();
178  break;
179 
180  case self::EXPORT_EXCEL:
181  $this->createExcel();
182  break;
183  }
184  }
createCSV()
Create CSV File.
getExportType()
get current export type
fetchUsers()
Fetch all users that will be exported.
+ Here is the call graph for this function:

◆ createCSV()

ilMemberExport::createCSV ( )

Create CSV File.

public

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

References write().

Referenced by create().

221  {
222  include_once('Services/Utilities/classes/class.ilCSVWriter.php');
223  $this->csv = new ilCSVWriter();
224 
225  $this->write();
226  }
Helper class to generate CSV files.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExcel()

ilMemberExport::createExcel ( )
Returns

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

References getFilename(), and write().

Referenced by create().

204  {
205  include_once "./Services/Excel/classes/class.ilExcel.php";
206  $this->worksheet = new ilExcel();
207  $this->worksheet->addSheet($this->lng->txt("members"));
208 
209  $this->write();
210 
211  $this->worksheet->writeToFile($this->getFilename());
212  }
getFilename()
get filename
+ 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.

private

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

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

Referenced by create().

515  {
517 
518  if ($this->settings->enabled('admin')) {
519  $this->user_ids = $tmp_ids = $this->members->getAdmins();
520  $this->readCourseData($tmp_ids);
521  }
522  if ($this->settings->enabled('tutor')) {
523  $this->user_ids = array_merge($tmp_ids = $this->members->getTutors(), $this->user_ids);
524  $this->readCourseData($tmp_ids);
525  }
526  if ($this->settings->enabled('member')) {
527  $this->user_ids = array_merge($tmp_ids = $this->members->getMembers(), $this->user_ids);
528  $this->readCourseData($tmp_ids);
529  }
530  if ($this->settings->enabled('subscribers')) {
531  $this->user_ids = array_merge($tmp_ids = $this->members->getSubscribers(), $this->user_ids);
532  $this->readCourseData($tmp_ids, 'subscriber');
533  }
534  if ($this->settings->enabled('waiting_list')) {
535  include_once('Modules/Course/classes/class.ilCourseWaitingList.php');
536  $waiting_list = new ilCourseWaitingList($this->obj_id);
537  $this->user_ids = array_merge($waiting_list->getUserIds(), $this->user_ids);
538  }
539  $this->user_ids = $this->filterUsers($this->user_ids);
540 
541  // Sort by lastname
542  $this->user_ids = ilUtil::_sortIds($this->user_ids, 'usr_data', 'lastname', 'usr_id');
543 
544  // Finally read user profile data
545  $this->user_profile_data = ilObjUser::_readUsersProfileData($this->user_ids);
546  }
settings()
Definition: settings.php:2
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,7),'usr_data','lastname','usr_id') => sorts by lastname.
+ 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 99 of file class.ilMemberExport.php.

References $GLOBALS.

Referenced by fetchUsers().

100  {
101  return $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
102  'manage_members',
103  'manage_members',
104  $this->ref_id,
105  $a_usr_ids
106  );
107  }
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the caller graph for this function:

◆ getCSVString()

ilMemberExport::getCSVString ( )

toString method

public

Parameters

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

194  {
195  return $this->csv->getCSVString();
196  }

◆ getExportType()

ilMemberExport::getExportType ( )

get current export type

Returns

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

References $export_type.

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

151  {
152  return $this->export_type;
153  }
+ Here is the caller graph for this function:

◆ getFilename()

ilMemberExport::getFilename ( )

get filename

Returns

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

References $filename.

Referenced by createExcel().

124  {
125  return $this->filename;
126  }
+ Here is the caller graph for this function:

◆ getObjId()

ilMemberExport::getObjId ( )

Get obj id.

Returns

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

References $obj_id.

Referenced by initMembers().

160  {
161  return $this->obj_id;
162  }
+ Here is the caller graph for this function:

◆ getOrderedExportableFields()

ilMemberExport::getOrderedExportableFields ( )
protected

Get ordered enabled fields.

public

Parameters

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

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

Referenced by write().

274  {
275  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
276  include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
277  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
278  include_once('Services/User/classes/class.ilUserDefinedFields.php');
279 
281  $field_info->sortExportFields();
282  $fields[] = 'role';
283  // Append agreement info
285  if ($privacy->courseConfirmationRequired()) {
286  $fields[] = 'agreement';
287  }
288 
289  foreach ($field_info->getExportableFields() as $field) {
290  if ($this->settings->enabled($field)) {
291  $fields[] = $field;
292  }
293  }
294 
296  foreach ($udf->getCourseExportableFields() as $field_id => $udf_data) {
297  if ($this->settings->enabled('udf_' . $field_id)) {
298  $fields[] = 'udf_' . $field_id;
299  }
300  }
301 
302  // Add course specific fields
303  foreach (ilCourseDefinedFieldDefinition::_getFields($this->obj_id) as $field_obj) {
304  if ($this->settings->enabled('cdf_' . $field_obj->getId())) {
305  $fields[] = 'cdf_' . $field_obj->getId();
306  }
307  }
308  if ($this->settings->enabled('group_memberships')) {
309  $fields[] = 'crs_members_groups';
310  }
311 
312  return $fields ? $fields : array();
313  }
settings()
Definition: settings.php:2
static _getInstance()
Get instance.
static _getInstanceByType($a_type)
Get Singleton Instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance()
Get instance of ilPrivacySettings.
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:
+ Here is the caller graph for this function:

◆ getRefId()

ilMemberExport::getRefId ( )

get ref_id

Returns

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

References $ref_id.

133  {
134  return $this->ref_id;
135  }

◆ getType()

ilMemberExport::getType ( )

get obj type

Returns

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

References $type.

Referenced by initMembers(), and readCourseData().

142  {
143  return $this->type;
144  }
+ Here is the caller graph for this function:

◆ initGroups()

ilMemberExport::initGroups ( )
protected

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

References $DIC, $groups, $tree, and ilGroupParticipants\_getInstanceByObjId().

Referenced by __construct().

653  {
654  global $DIC;
655 
656  $tree = $DIC['tree'];
657  $ilAccess = $DIC['ilAccess'];
658  $parent_node = $tree->getNodeData($this->ref_id);
659  $groups = $tree->getSubTree($parent_node, true, "grp");
660  if (is_array($groups) && sizeof($groups)) {
661  include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
662  $this->groups_rights = array();
663  foreach ($groups as $idx => $group_data) {
664  // check for group in group
665  if ($group_data["parent"] != $this->ref_id && $tree->checkForParentType($group_data["ref_id"], "grp", true)) {
666  unset($groups[$idx]);
667  } else {
668  $this->groups[$group_data["ref_id"]] = $group_data["title"];
669  //TODO: change permissions from write to manage_members plus "|| ilObjGroup->getShowMembers()"----- uncomment below; testing required
670  //$obj = new ilObjGroup($group_data["ref_id"], true);
671  $this->groups_rights[$group_data["ref_id"]] = (bool) $ilAccess->checkAccess("write", "", $group_data["ref_id"])/* || $obj->getShowMembers()*/;
672  $gobj = ilGroupParticipants::_getInstanceByObjId($group_data["obj_id"]);
673  $this->groups_participants[$group_data["ref_id"]] = $gobj->getParticipants();
674  }
675  }
676  }
677  }
global $DIC
Definition: saml.php:7
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ 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 641 of file class.ilMemberExport.php.

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

Referenced by __construct().

642  {
643  if ($this->getType() == 'crs') {
644  $this->members = ilCourseParticipants::_getInstanceByObjId($this->getObjId());
645  }
646  if ($this->getType() == 'grp') {
647  $this->members = ilGroupParticipants::_getInstanceByObjId($this->getObjId());
648  }
649  return true;
650  }
getObjId()
Get obj id.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
getType()
get obj type
+ 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.

private

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

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

Referenced by fetchUsers().

555  {
556  foreach ($a_user_ids as $user_id) {
557  // Read course related data
558  if ($this->members->isAdmin($user_id)) {
559  $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_ADMIN : IL_GRP_ADMIN;
560  } elseif ($this->members->isTutor($user_id)) {
561  $this->user_course_data[$user_id]['role'] = IL_CRS_TUTOR;
562  } elseif ($this->members->isMember($user_id)) {
563  $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_MEMBER : IL_GRP_MEMBER;
564  } else {
565  $this->user_course_data[$user_id]['role'] = 'subscriber';
566  }
567  }
568  }
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
getType()
get obj type
+ 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.

private

Parameters

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

References ilCourseUserData\_getValuesByObjId().

Referenced by fetchUsers().

578  {
579  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
580  $this->user_course_fields = ilCourseUserData::_getValuesByObjId($this->obj_id);
581  }
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
+ 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 114 of file class.ilMemberExport.php.

115  {
116  $this->filename = $a_file;
117  }

◆ write()

ilMemberExport::write ( )
protected

Write data.

Returns

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

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().

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

Referenced by fetchUsers().

◆ $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.

◆ EXPORT_EXCEL

const ilMemberExport::EXPORT_EXCEL = 2

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

Referenced by ilMemberExportGUI\exportExcel().


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