ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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, $lng, ilPrivacySettings\_getInstance(), ilObject\_lookupType(), ilMemberAgreement\_readByObjId(), initGroups(), initMembers(), and settings().

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.
$a_type
Definition: workflow.php:93
static _lookupType($a_id, $a_reference=false)
lookup object type
settings()
Definition: settings.php:2
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 224 of file class.ilMemberExport.php.

References getExportType(), and worksheet.

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

225  {
226  switch($this->getExportType())
227  {
228  case self::EXPORT_CSV:
229  $this->csv->addColumn($a_value);
230  break;
231 
232  case self::EXPORT_EXCEL:
233  $this->worksheet->setCell($a_row+1,$a_col,$a_value);
234  break;
235  }
236  }
Rename worksheet
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 629 of file class.ilMemberExport.php.

References $row, and addCol().

Referenced by write().

630  {
631  if(substr($a_field,0,4) != 'cdf_')
632  {
633  return false;
634  }
635  if(!$this->privacy->courseConfirmationRequired() or $this->agreement[$a_usr_id]['accepted'])
636  {
637  $field_info = explode('_',$a_field);
638  $field_id = $field_info[1];
639  $value = $this->user_course_fields[$a_usr_id][$field_id];
640  #$this->csv->addColumn($value);
641  $this->addCol($value, $row, $col);
642  return true;
643  }
644  #$this->csv->addColumn('');
645  $this->addCol('', $row, $col);
646  return true;
647 
648  }
addCol($a_value, $a_row, $a_col)
Write on column.
+ 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 242 of file class.ilMemberExport.php.

References getExportType().

Referenced by write().

243  {
244  switch($this->getExportType())
245  {
246  case self::EXPORT_CSV:
247  $this->csv->addRow();
248  break;
249 
250  case self::EXPORT_EXCEL:
251  break;
252  }
253  }
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 658 of file class.ilMemberExport.php.

References $row, and addCol().

Referenced by write().

659  {
660  if(substr($a_field,0,4) != 'udf_')
661  {
662  return false;
663  }
664  if(!$this->privacy->courseConfirmationRequired() or $this->agreement[$udf_data->getUserId()]['accepted'])
665  {
666  $field_info = explode('_',$a_field);
667  $field_id = $field_info[1];
668  $value = $udf_data->get('f_'.$field_id);
669  #$this->csv->addColumn($value);
670  $this->addCol($value, $row, $col);
671  return true;
672  }
673  #$this->csv->addColumn('');
674  $this->addCol('', $row, $col);
675  }
addCol($a_value, $a_row, $a_col)
Write on column.
+ 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 156 of file class.ilMemberExport.php.

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

157  {
158  $this->fetchUsers();
159 
160  // DONE: Switch different export types
161  switch($this->getExportType())
162  {
163  case self::EXPORT_CSV:
164  $this->createCSV();
165  break;
166 
167  case self::EXPORT_EXCEL:
168  $this->createExcel();
169  break;
170  }
171  }
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 207 of file class.ilMemberExport.php.

References write().

Referenced by create().

208  {
209  include_once('Services/Utilities/classes/class.ilCSVWriter.php');
210  $this->csv = new ilCSVWriter();
211 
212  $this->write();
213  }
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 190 of file class.ilMemberExport.php.

References getFilename(), worksheet, and write().

Referenced by create().

191  {
192  include_once "./Services/Excel/classes/class.ilExcel.php";
193  $this->worksheet = new ilExcel();
194  $this->worksheet->addSheet($this->lng->txt("members"));
195 
196  $this->write();
197 
198  $this->worksheet->writeToFile($this->getFilename());
199  }
Rename worksheet
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 539 of file class.ilMemberExport.php.

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

Referenced by create().

540  {
542 
543  if($this->settings->enabled('admin'))
544  {
545  $this->user_ids = $tmp_ids = $this->members->getAdmins();
546  $this->readCourseData($tmp_ids);
547  }
548  if($this->settings->enabled('tutor'))
549  {
550  $this->user_ids = array_merge($tmp_ids = $this->members->getTutors(),$this->user_ids);
551  $this->readCourseData($tmp_ids);
552  }
553  if($this->settings->enabled('member'))
554  {
555  $this->user_ids = array_merge($tmp_ids = $this->members->getMembers(),$this->user_ids);
556  $this->readCourseData($tmp_ids);
557  }
558  if($this->settings->enabled('subscribers'))
559  {
560  $this->user_ids = array_merge($tmp_ids = $this->members->getSubscribers(),$this->user_ids);
561  $this->readCourseData($tmp_ids,'subscriber');
562  }
563  if($this->settings->enabled('waiting_list'))
564  {
565  include_once('Modules/Course/classes/class.ilCourseWaitingList.php');
566  $waiting_list = new ilCourseWaitingList($this->obj_id);
567  $this->user_ids = array_merge($waiting_list->getUserIds(),$this->user_ids);
568 
569  }
570  // Sort by lastname
571  $this->user_ids = ilUtil::_sortIds($this->user_ids,'usr_data','lastname','usr_id');
572 
573  // Finally read user profile data
574  $this->user_profile_data = ilObjUser::_readUsersProfileData($this->user_ids);
575  }
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.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCSVString()

ilMemberExport::getCSVString ( )

toString method

public

Parameters

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

181  {
182  return $this->csv->getCSVString();
183  }

◆ getExportType()

ilMemberExport::getExportType ( )

get current export type

Returns

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

References $export_type.

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

137  {
138  return $this->export_type;
139  }
+ Here is the caller graph for this function:

◆ getFilename()

ilMemberExport::getFilename ( )

get filename

Returns

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

References $filename.

Referenced by createExcel().

110  {
111  return $this->filename;
112  }
+ Here is the caller graph for this function:

◆ getObjId()

ilMemberExport::getObjId ( )

Get obj id.

Returns

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

References $obj_id.

Referenced by initMembers().

146  {
147  return $this->obj_id;
148  }
+ Here is the caller graph for this function:

◆ getOrderedExportableFields()

ilMemberExport::getOrderedExportableFields ( )
protected

Get ordered enabled fields.

public

Parameters

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

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

Referenced by write().

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

References $ref_id.

119  {
120  return $this->ref_id;
121  }

◆ getType()

ilMemberExport::getType ( )

get obj type

Returns

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

References $type.

Referenced by initMembers(), and readCourseData().

128  {
129  return $this->type;
130  }
+ Here is the caller graph for this function:

◆ initGroups()

ilMemberExport::initGroups ( )
protected

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

References $groups, ilGroupParticipants\_getInstanceByObjId(), and array.

Referenced by __construct().

695  {
696  global $tree, $ilAccess;
697  $parent_node = $tree->getNodeData($this->ref_id);
698  $groups = $tree->getSubTree($parent_node, true, "grp");
699  if(is_array($groups) && sizeof($groups))
700  {
701  include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
702  $this->groups_rights = array();
703  foreach($groups as $idx => $group_data)
704  {
705  // check for group in group
706  if($group_data["parent"] != $this->ref_id && $tree->checkForParentType($group_data["ref_id"], "grp",true))
707  {
708  unset($groups[$idx]);
709  }
710  else
711  {
712  $this->groups[$group_data["ref_id"]] = $group_data["title"];
713  //TODO: change permissions from write to manage_members plus "|| ilObjGroup->getShowMembers()"----- uncomment below; testing required
714  //$obj = new ilObjGroup($group_data["ref_id"], true);
715  $this->groups_rights[$group_data["ref_id"]] = (bool)$ilAccess->checkAccess("write", "", $group_data["ref_id"])/* || $obj->getShowMembers()*/;
716  $gobj = ilGroupParticipants::_getInstanceByObjId($group_data["obj_id"]);
717  $this->groups_participants[$group_data["ref_id"]] = $gobj->getParticipants();
718  }
719  }
720  }
721  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
+ 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 681 of file class.ilMemberExport.php.

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

Referenced by __construct().

682  {
683  if($this->getType() == 'crs')
684  {
685  $this->members = ilCourseParticipants::_getInstanceByObjId($this->getObjId());
686  }
687  if($this->getType() == 'grp')
688  {
689  $this->members = ilGroupParticipants::_getInstanceByObjId($this->getObjId());
690  }
691  return true;
692  }
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 583 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().

584  {
585  foreach($a_user_ids as $user_id)
586  {
587  // Read course related data
588  if($this->members->isAdmin($user_id))
589  {
590  $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_ADMIN : IL_GRP_ADMIN;
591  }
592  elseif($this->members->isTutor($user_id))
593  {
594  $this->user_course_data[$user_id]['role'] = IL_CRS_TUTOR;
595  }
596  elseif($this->members->isMember($user_id))
597  {
598  $this->user_course_data[$user_id]['role'] = $this->getType() == 'crs' ? IL_CRS_MEMBER : IL_GRP_MEMBER;
599  }
600  else
601  {
602  $this->user_course_data[$user_id]['role'] = 'subscriber';
603  }
604  }
605  }
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 614 of file class.ilMemberExport.php.

References ilCourseUserData\_getValuesByObjId().

Referenced by fetchUsers().

615  {
616  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
617  $this->user_course_fields = ilCourseUserData::_getValuesByObjId($this->obj_id);
618  }
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 100 of file class.ilMemberExport.php.

101  {
102  $this->filename = $a_file;
103  }

◆ write()

ilMemberExport::write ( )
protected

Write data.

Returns

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

References $GLOBALS, $groups, $row, ilUserDefinedFields\_getInstance(), ilCourseDefinedFieldDefinition\_lookupName(), addCol(), addCourseField(), addRow(), addUserDefinedField(), array, 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().

317  {
318  // Add header line
319  $row = 0;
320  $col = 0;
321  foreach($all_fields = $this->getOrderedExportableFields() as $field)
322  {
323  switch($field)
324  {
325  case 'role':
326  #$this->csv->addColumn($this->lng->txt($this->getType().'_role_status'));
327  $this->addCol($this->lng->txt($this->getType().'_role_status'), $row, $col++);
328  break;
329  case 'agreement':
330  #$this->csv->addColumn($this->lng->txt('ps_agreement_accepted'));
331  $this->addCol($this->lng->txt('ps_agreement_accepted'), $row, $col++);
332  break;
333  case 'consultation_hour':
334  $this->lng->loadLanguageModule('dateplaner');
335  $this->addCol($this->lng->txt('cal_ch_field_ch'), $row, $col++);
336  break;
337 
338  case 'org_units':
339  $this->addCol($this->lng->txt('org_units'), $row, $col++);
340  break;
341 
342  default:
343  if(substr($field,0,4) == 'udf_')
344  {
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  }
352  elseif(substr($field,0,4) == 'cdf_')
353  {
354  $field_id = explode('_',$field);
355  #$this->csv->addColumn(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]));
356  $this->addCol(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]),$row,$col++);
357  }elseif($field == "username")//User Name Presentation Guideline; username should be named login
358  {
359  $this->addCol($this->lng->txt("login"), $row, $col++);
360  }
361  else
362  {
363  #$this->csv->addColumn($this->lng->txt($field));
364  $this->addCol($this->lng->txt($field), $row, $col++);
365  }
366  break;
367  }
368  }
369  #$this->csv->addRow();
370  $this->addRow();
371  // Add user data
372  foreach($this->user_ids as $usr_id)
373  {
374  $row++;
375  $col = 0;
376 
377  $udf_data = new ilUserDefinedData($usr_id);
378  foreach($all_fields as $field)
379  {
380  // Handle course defined fields
381  if($this->addUserDefinedField($udf_data,$field,$row,$col))
382  {
383  $col++;
384  continue;
385  }
386 
387  if($this->addCourseField($usr_id,$field,$row,$col))
388  {
389  $col++;
390  continue;
391  }
392 
393  switch($field)
394  {
395  case 'role':
396  switch($this->user_course_data[$usr_id]['role'])
397  {
398  case IL_CRS_ADMIN:
399  #$this->csv->addColumn($this->lng->txt('crs_admin'));
400  $this->addCol($this->lng->txt('crs_admin'), $row, $col++);
401  break;
402 
403  case IL_CRS_TUTOR:
404  #$this->csv->addColumn($this->lng->txt('crs_tutor'));
405  $this->addCol($this->lng->txt('crs_tutor'), $row, $col++);
406  break;
407 
408  case IL_CRS_MEMBER:
409  #$this->csv->addColumn($this->lng->txt('crs_member'));
410  $this->addCol($this->lng->txt('crs_member'), $row, $col++);
411  break;
412 
413  case IL_GRP_ADMIN:
414  #$this->csv->addColumn($this->lng->txt('il_grp_admin'));
415  $this->addCol($this->lng->txt('il_grp_admin'), $row, $col++);
416  break;
417 
418  case IL_GRP_MEMBER:
419  #$this->csv->addColumn($this->lng->txt('il_grp_member'));
420  $this->addCol($this->lng->txt('il_grp_member'), $row, $col++);
421  break;
422 
423  case 'subscriber':
424  #$this->csv->addColumn($this->lng->txt($this->getType().'_subscriber'));
425  $this->addCol($this->lng->txt($this->getType().'_subscriber'), $row, $col++);
426  break;
427 
428  default:
429  #$this->csv->addColumn($this->lng->txt('crs_waiting_list'));
430  $this->addCol($this->lng->txt('crs_waiting_list'), $row, $col++);
431  break;
432 
433  }
434  break;
435 
436  case 'agreement':
437  if(isset($this->agreement[$usr_id]))
438  {
439  if($this->agreement[$usr_id]['accepted'])
440  {
441  #$this->csv->addColumn(il-Format::format-Unix-Time($this->agreement[$usr_id]['acceptance_time'],true));
442  $dt = new ilDateTime($this->agreement[$usr_id]['acceptance_time'], IL_CAL_UNIX);
443  $this->addCol($dt->get(IL_CAL_DATETIME),$row,$col++);
444  }
445  else
446  {
447  #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
448  $this->addCol($this->lng->txt('ps_not_accepted'),$row,$col++);
449  }
450  }
451  else
452  {
453  #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
454  $this->addCol($this->lng->txt('ps_not_accepted'),$row,$col++);
455  }
456  break;
457 
458  // These fields are always enabled
459  case 'username':
460  #$this->csv->addColumn($this->user_profile_data[$usr_id]['login']);
461  $this->addCol($this->user_profile_data[$usr_id]['login'],$row,$col++);
462  break;
463 
464  case 'firstname':
465  case 'lastname':
466  #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]);
467  $this->addCol($this->user_profile_data[$usr_id][$field],$row,$col++);
468  break;
469 
470  case 'consultation_hour':
471  include_once './Services/Booking/classes/class.ilBookingEntry.php';
472  $bookings = ilBookingEntry::lookupManagedBookingsForObject($this->obj_id, $GLOBALS['ilUser']->getId());
473 
474  $uts = array();
475  foreach((array) $bookings[$usr_id] as $ut)
476  {
479  new ilDateTime($ut['dt'],IL_CAL_UNIX),
480  new ilDateTime($ut['dtend'],IL_CAL_UNIX)
481  );
482  if(strlen($ut['explanation']))
483  {
484  $tmp .= ' '.$ut['explanation'];
485  }
486  $uts[] = $tmp;
487  }
488  $uts_str = implode(',',$uts);
489  $this->addCol($uts_str, $row, $col++);
490  break;
491  case 'crs_members_groups':
492  $groups = array();
493 
494  foreach(array_keys($this->groups) as $grp_ref)
495  {
496  if(in_array($usr_id, $this->groups_participants[$grp_ref])
497  && $this->groups_rights[$grp_ref])
498  {
499  $groups[] = $this->groups[$grp_ref];
500  }
501  }
502  $this->addCol(implode(", ", $groups), $row, $col++);
503  break;
504 
505  case 'org_units':
506  $this->addCol(ilObjUser::lookupOrgUnitsRepresentation($usr_id), $row, $col++);
507  break;
508 
509  default:
510  // Check aggreement
511  if(!$this->privacy->courseConfirmationRequired() or $this->agreement[$usr_id]['accepted'])
512  {
513  #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]);
514  $this->addCol($this->user_profile_data[$usr_id][$field],$row,$col++);
515  }
516  else
517  {
518  #$this->csv->addColumn('');
519  $this->addCol('', $row, $col++);
520  }
521  break;
522 
523  }
524  }
525  #$this->csv->addRow();
526  $this->addRow();
527  }
528 
529  }
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 formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
Create styles array
The data for the language used.
addCourseField($a_usr_id, $a_field, $row, $col)
fill course specific fields
static _lookupName($a_field_id)
Lookup field name.
+ 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: