24include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
25include_once(
'./Services/Membership/classes/Export/class.ilMemberExport.php');
26include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
27include_once(
'Modules/Group/classes/class.ilFSStorageGroup.php');
28include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
29include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
30include_once(
'Services/User/classes/class.ilUserFormSettings.php');
71 $this->lng->loadLanguageModule(
'ps');
72 $this->ref_id = $a_ref_id;
73 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
89 global $ilAccess,$rbacsystem;
91 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
95 $this->ctrl->returnToParent($this);
98 $next_class = $this->ctrl->getNextClass($this);
99 $cmd = $this->ctrl->getCmd();
123 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
125 $form->setFormAction($this->ctrl->getFormAction($this));
126 $form->setTitle($this->lng->txt(
'ps_export_settings'));
128 if((
bool)$a_is_excel)
130 $form->addCommandButton(
'exportExcel', $this->lng->txt(
'ps_export_excel'));
134 $form->addCommandButton(
'export', $this->lng->txt(
'ps_perform_export'));
136 $form->addCommandButton(
'show', $this->lng->txt(
'cancel'));
140 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_admin'),
'admin'));
141 if($this->type ==
'crs')
143 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_tutor'),
'tutor'));
145 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_member'),
'member'));
146 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_sub'),
'subscribers'));
147 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_wait'),
'waiting_list'));
148 $form->addItem($roles);
150 $current_roles = array();
151 foreach(array(
'admin',
'tutor',
'member',
'subscribers',
'waiting_list') as $role)
153 if($this->exportSettings->enabled($role))
155 $current_roles[] = $role;
158 $roles->setValue($current_roles);
161 $current_udata = array();
163 $form->addItem($udata);
166 $this->fields_info->sortExportFields();
167 foreach($this->fields_info->getFieldsInfo() as $field => $exportable)
174 if($this->exportSettings->enabled($field))
176 $current_udata[] = $field;
183 $field =
'udf_'.$field_id;
185 if($this->exportSettings->enabled($field))
187 $current_udata[] = $field;
191 $udata->setValue($current_udata);
195 if(count($cdf_fields))
198 $form->addItem($cdf);
200 $current_cdf = array();
201 foreach($cdf_fields as $field_obj)
203 $field =
'cdf_'.$field_obj->getId();
205 if($this->exportSettings->enabled($field))
207 $current_cdf[] = $field;
211 $cdf->setValue($current_cdf);
215 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
218 $this->lng->loadLanguageModule(
'dateplaner');
219 $chours =
new ilCheckboxInputGUI($this->lng->txt(
'cal_ch_field_ch'),
'export_members[]');
220 $chours->setValue(
'consultation_hour');
221 $chours->setChecked($this->exportSettings->enabled(
'consultation_hour'));
222 $form->addItem($chours);
225 $grp_membr =
new ilCheckboxInputGUI($this->lng->txt(
'crs_members_groups'),
'export_members[]');
226 $grp_membr->setValue(
'group_memberships');
227 $grp_membr->setChecked($this->exportSettings->enabled(
'group_memberships'));
228 $form->addItem($grp_membr);
238 $this->tpl->setContent($a_form->getHTML());
247 $this->tpl->setContent($a_form->getHTML());
260 $ilToolbar->addButton($this->lng->txt(
'ps_perform_export'),
261 $this->ctrl->getLinkTarget($this,
"initCSV"));
262 $ilToolbar->addButton($this->lng->txt(
'ps_export_excel'),
263 $this->ctrl->getLinkTarget($this,
"initExcel"));
271 $incoming =
$_POST[
'export_members'];
272 if(is_array($incoming))
274 foreach($incoming as $id)
276 $settings[$id] =
true;
282 $this->exportSettings->set($settings);
283 $this->exportSettings->store();
299 $filename = time().
'_participant_export_csv_'.$this->obj_id.
'.csv';
300 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
302 $this->ctrl->redirect($this,
'show');
310 $this->fss_export->initMemberExportDirectory();
311 $filepath = $this->fss_export->getMemberExportDirectory().DIRECTORY_SEPARATOR.$filename;
314 $this->
export->setFilename($filepath);
317 $this->ctrl->redirect($this,
'show');
329 foreach($this->fss_export->getMemberExportFiles() as
$file)
333 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
350 include_once
'Services/Membership/classes/Export/class.ilMemberExportFileTableGUI.php';
352 $this->tpl->setContent(
$tbl->getHTML());
364 $hash = trim(
$_GET[
'fl']);
367 $this->ctrl->redirect($this,
'show');
370 foreach($this->fss_export->getMemberExportFiles() as
$file)
372 if(md5(
$file[
'name']) == $hash)
374 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'].
'_participant_export_'.
375 $file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
380 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'].
'_participant_export_'.
381 $file[
'type'].
'_'.$this->obj_id.
'.xlsx');
382 $file[
'type'] =
'xlsx';
385 switch(
$file[
'type'])
390 date(
'Y_m_d_H-i'.
$file[
'timest']).
'_member_export_'.$this->obj_id.
'.xlsx',
391 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
397 date(
'Y_m_d_H-i'.
$file[
'timest']).
'_member_export_'.$this->obj_id.
'.xls',
398 'application/vnd.ms-excel'
426 $this->ctrl->redirect($this,
'show');
429 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
431 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
432 $confirmation_gui->setHeaderText($this->lng->txt(
'info_delete_sure') );
433 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'show');
434 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'deleteExportFile');
437 foreach($this->fss_export->getMemberExportFiles() as
$file)
444 $confirmation_gui->addItem(
"id[]", md5(
$file[
'name']),
445 strtoupper(
$file[
'type']).
' - '.
449 $this->tpl->setContent($confirmation_gui->getHTML());
463 $this->ctrl->redirect($this,
'show');
467 foreach($this->fss_export->getMemberExportFiles() as
$file)
474 $ret = $this->fss_export->deleteMemberExportFile(
$file[
'timest'].
'_participant_export_'.
475 $file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
480 $this->fss_export->deleteMemberExportFile(
$file[
'timest'].
'_participant_export_'.
481 $file[
'type'].
'_'.$this->obj_id.
'.'.
"xlsx");
486 $this->ctrl->redirect($this,
'show');
496 if($this->type ==
'crs')
500 if($this->type ==
'grp')
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
This class represents an option in a checkbox group.
Confirmation screen class.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static _getInstanceByType($a_type)
Get Singleton Instance.
Table presentation of membership export files.
deliverData()
Deliver Data.
downloadExportFile()
Download export file.
deleteExportFile()
Delete member export files.
show()
Show list of export files.
export()
Export Create member export file and store it in data directory.
showFileList()
Show file list of available export files.
initSettingsForm($a_is_excel=false)
initExcel(ilPropertyFormGUI $a_form=null)
confirmDeleteExportFile()
Confirm deletion of export files.
initCSV(ilPropertyFormGUI $a_form=null)
initFileSystemStorage()
Init file object.
__construct($a_ref_id)
Constructor.
executeCommand()
Execute Command.
Class for generation of member export files.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance()
Get instance of ilPrivacySettings.
static _getInstance()
Get instance.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file