24 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
25 include_once(
'./Services/Membership/classes/Export/class.ilMemberExport.php');
26 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
27 include_once(
'Modules/Group/classes/class.ilFSStorageGroup.php');
28 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
29 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
30 include_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;
92 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();
101 switch ($next_class) {
121 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
123 $form->setFormAction($this->ctrl->getFormAction($this));
124 $form->setTitle($this->lng->txt(
'ps_export_settings'));
126 if ((
bool) $a_is_excel) {
127 $form->addCommandButton(
'exportExcel', $this->lng->txt(
'ps_export_excel'));
129 $form->addCommandButton(
'export', $this->lng->txt(
'ps_perform_export'));
131 $form->addCommandButton(
'show', $this->lng->txt(
'cancel'));
136 if ($this->type ==
'crs') {
137 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_tutor'),
'tutor'));
139 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_member'),
'member'));
140 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_sub'),
'subscribers'));
141 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_wait'),
'waiting_list'));
142 $form->addItem($roles);
144 $current_roles =
array();
145 foreach (
array(
'admin',
'tutor',
'member',
'subscribers',
'waiting_list') as $role) {
146 if ($this->exportSettings->enabled($role)) {
147 $current_roles[] = $role;
150 $roles->setValue($current_roles);
153 $current_udata =
array();
155 $form->addItem($udata);
158 $this->fields_info->sortExportFields();
159 foreach ($this->fields_info->getFieldsInfo() as $field => $exportable) {
164 if ($this->exportSettings->enabled($field)) {
165 $current_udata[] = $field;
171 $field =
'udf_' . $field_id;
173 if ($this->exportSettings->enabled($field)) {
174 $current_udata[] = $field;
178 $udata->setValue($current_udata);
182 if (count($cdf_fields)) {
184 $form->addItem($cdf);
186 $current_cdf =
array();
187 foreach ($cdf_fields as $field_obj) {
188 $field =
'cdf_' . $field_obj->getId();
190 if ($this->exportSettings->enabled($field)) {
191 $current_cdf[] = $field;
195 $cdf->setValue($current_cdf);
199 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
201 $this->lng->loadLanguageModule(
'dateplaner');
202 $chours =
new ilCheckboxInputGUI($this->lng->txt(
'cal_ch_field_ch'),
'export_members[]');
203 $chours->
setValue(
'consultation_hour');
204 $chours->setChecked($this->exportSettings->enabled(
'consultation_hour'));
205 $form->addItem($chours);
208 $grp_membr =
new ilCheckboxInputGUI($this->lng->txt(
'crs_members_groups'),
'export_members[]');
209 $grp_membr->
setValue(
'group_memberships');
210 $grp_membr->setChecked($this->exportSettings->enabled(
'group_memberships'));
211 $form->addItem($grp_membr);
220 $this->tpl->setContent($a_form->getHTML());
228 $this->tpl->setContent($a_form->getHTML());
241 $ilToolbar->addButton(
242 $this->lng->txt(
'ps_perform_export'),
243 $this->ctrl->getLinkTarget($this,
"initCSV")
245 $ilToolbar->addButton(
246 $this->lng->txt(
'ps_export_excel'),
247 $this->ctrl->getLinkTarget($this,
"initExcel")
256 $incoming =
$_POST[
'export_members'];
257 if (is_array($incoming)) {
258 foreach ($incoming as
$id) {
259 $settings[
$id] =
true;
265 $this->exportSettings->set($settings);
266 $this->exportSettings->store();
282 $filename =
time() .
'_participant_export_csv_' . $this->obj_id .
'.csv';
283 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
285 $this->ctrl->redirect($this,
'show');
293 $this->fss_export->initMemberExportDirectory();
294 $filepath = $this->fss_export->getMemberExportDirectory() . DIRECTORY_SEPARATOR .
$filename;
297 $this->
export->setFilename($filepath);
300 $this->ctrl->redirect($this,
'show');
312 foreach ($this->fss_export->getMemberExportFiles() as
$file) {
314 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
331 include_once
'Services/Membership/classes/Export/class.ilMemberExportFileTableGUI.php';
333 $this->tpl->setContent(
$tbl->getHTML());
345 $hash = trim(
$_GET[
'fl']);
347 $this->ctrl->redirect($this,
'show');
350 foreach ($this->fss_export->getMemberExportFiles() as
$file) {
351 if (md5(
$file[
'name']) == $hash) {
352 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'] .
'_participant_export_' .
353 $file[
'type'] .
'_' . $this->obj_id .
'.' .
$file[
'type']);
356 if ($file[
'type'] ==
'xls' && !
$contents) {
357 $contents = $this->fss_export->getMemberExportFile($file[
'timest'] .
'_participant_export_' .
358 $file[
'type'] .
'_' . $this->obj_id .
'.xlsx');
359 $file[
'type'] =
'xlsx';
362 switch ($file[
'type']) {
366 date(
'Y_m_d_H-i' . $file[
'timest']) .
'_member_export_' . $this->obj_id .
'.xlsx',
367 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 374 date(
'Y_m_d_H-i' . $file[
'timest']) .
'_member_export_' . $this->obj_id .
'.xls',
375 'application/vnd.ms-excel' 401 if (!count(
$_POST[
'id'])) {
403 $this->ctrl->redirect($this,
'show');
406 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
408 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
409 $confirmation_gui->setHeaderText($this->lng->txt(
'info_delete_sure') );
410 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'show');
411 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'deleteExportFile');
414 foreach ($this->fss_export->getMemberExportFiles() as
$file) {
419 $confirmation_gui->addItem(
422 strtoupper(
$file[
'type']) .
' - ' .
427 $this->tpl->setContent($confirmation_gui->getHTML());
439 if (!count(
$_POST[
'id'])) {
440 $this->ctrl->redirect($this,
'show');
444 foreach ($this->fss_export->getMemberExportFiles() as
$file) {
449 $ret = $this->fss_export->deleteMemberExportFile(
$file[
'timest'] .
'_participant_export_' .
450 $file[
'type'] .
'_' . $this->obj_id .
'.' .
$file[
'type']);
453 if ($file[
'type'] ==
"xls" && !
$ret) {
454 $this->fss_export->deleteMemberExportFile($file[
'timest'] .
'_participant_export_' .
455 $file[
'type'] .
'_' . $this->obj_id .
'.' .
"xlsx");
460 $this->ctrl->redirect($this,
'show');
470 if ($this->type ==
'crs') {
473 if ($this->type ==
'grp') {
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
deliverData()
Deliver Data.
Class for generation of member export files.
downloadExportFile()
Download export file.
deleteExportFile()
Delete member export files.
showFileList()
Show file list of available export files.
This class represents an option in a checkbox group.
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getInstance()
Get instance.
export()
Export Create member export file and store it in data directory.
initExcel(ilPropertyFormGUI $a_form=null)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
__construct($a_ref_id)
Constructor.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
initSettingsForm($a_is_excel=false)
executeCommand()
Execute Command.
if(isset($_POST['submit'])) $form
static _getInstanceByType($a_type)
Get Singleton Instance.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
show()
Show list of export files.
confirmDeleteExportFile()
Confirm deletion of export files.
Table presentation of membership export files.
initCSV(ilPropertyFormGUI $a_form=null)
initFileSystemStorage()
Init file object.
static _getInstance()
Get instance of ilPrivacySettings.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
Confirmation screen class.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.