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');
72 $ilObjDataCache = $DIC[
'ilObjDataCache'];
77 $this->lng->loadLanguageModule(
'ps');
78 $this->ref_id = $a_ref_id;
79 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
97 $ilAccess = $DIC[
'ilAccess'];
98 $rbacsystem = $DIC[
'rbacsystem'];
101 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
104 $this->ctrl->returnToParent($this);
107 $next_class = $this->ctrl->getNextClass($this);
108 $cmd = $this->ctrl->getCmd();
110 switch ($next_class) {
130 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
132 $form->setFormAction($this->ctrl->getFormAction($this));
133 $form->setTitle($this->lng->txt(
'ps_export_settings'));
135 if ((
bool) $a_is_excel) {
136 $form->addCommandButton(
'exportExcel', $this->lng->txt(
'ps_export_excel'));
138 $form->addCommandButton(
'export', $this->lng->txt(
'ps_perform_export'));
140 $form->addCommandButton(
'show', $this->lng->txt(
'cancel'));
145 if ($this->type ==
'crs') {
146 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_tutor'),
'tutor'));
148 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_member'),
'member'));
149 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_sub'),
'subscribers'));
150 $roles->addOption(
new ilCheckboxOption($this->lng->txt(
'ps_export_wait'),
'waiting_list'));
151 $form->addItem($roles);
153 $current_roles = array();
154 foreach (array(
'admin',
'tutor',
'member',
'subscribers',
'waiting_list') as $role) {
155 if ($this->exportSettings->enabled($role)) {
156 $current_roles[] = $role;
159 $roles->setValue($current_roles);
162 $current_udata = array();
164 $form->addItem($udata);
167 $this->fields_info->sortExportFields();
168 foreach ($this->fields_info->getFieldsInfo() as $field => $exportable) {
173 if ($this->exportSettings->enabled($field)) {
174 $current_udata[] = $field;
180 $field =
'udf_' . $field_id;
182 if ($this->exportSettings->enabled($field)) {
183 $current_udata[] = $field;
187 $udata->setValue($current_udata);
191 if (count($cdf_fields)) {
193 $form->addItem($cdf);
195 $current_cdf = array();
196 foreach ($cdf_fields as $field_obj) {
197 $field =
'cdf_' . $field_obj->getId();
199 if ($this->exportSettings->enabled($field)) {
200 $current_cdf[] = $field;
204 $cdf->setValue($current_cdf);
208 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
210 $this->lng->loadLanguageModule(
'dateplaner');
211 $chours =
new ilCheckboxInputGUI($this->lng->txt(
'cal_ch_field_ch'),
'export_members[]');
212 $chours->
setValue(
'consultation_hour');
213 $chours->setChecked($this->exportSettings->enabled(
'consultation_hour'));
214 $form->addItem($chours);
217 $grp_membr =
new ilCheckboxInputGUI($this->lng->txt(
'crs_members_groups'),
'export_members[]');
218 $grp_membr->
setValue(
'group_memberships');
219 $grp_membr->setChecked($this->exportSettings->enabled(
'group_memberships'));
220 $form->addItem($grp_membr);
229 $this->tpl->setContent($a_form->getHTML());
237 $this->tpl->setContent($a_form->getHTML());
250 $ilToolbar = $DIC[
'ilToolbar'];
252 $ilToolbar->addButton(
253 $this->lng->txt(
'ps_perform_export'),
254 $this->ctrl->getLinkTarget($this,
"initCSV")
256 $ilToolbar->addButton(
257 $this->lng->txt(
'ps_export_excel'),
258 $this->ctrl->getLinkTarget($this,
"initExcel")
267 $incoming =
$_POST[
'export_members'];
268 if (is_array($incoming)) {
269 foreach ($incoming as
$id) {
270 $settings[
$id] =
true;
276 $this->exportSettings->set($settings);
277 $this->exportSettings->store();
293 $filename = time() .
'_participant_export_csv_' . $this->obj_id .
'.csv';
294 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
296 $this->ctrl->redirect($this,
'show');
304 $this->fss_export->initMemberExportDirectory();
305 $filepath = $this->fss_export->getMemberExportDirectory() . DIRECTORY_SEPARATOR .
$filename;
308 $this->
export->setFilename($filepath);
311 $this->ctrl->redirect($this,
'show');
323 foreach ($this->fss_export->getMemberExportFiles() as $file) {
324 if ($file[
'name'] ==
$_SESSION[
'member_export_filename']) {
325 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
342 include_once
'Services/Membership/classes/Export/class.ilMemberExportFileTableGUI.php';
344 $this->tpl->setContent(
$tbl->getHTML());
356 $hash = trim(
$_GET[
'fl']);
358 $this->ctrl->redirect($this,
'show');
361 foreach ($this->fss_export->getMemberExportFiles() as $file) {
362 if (md5($file[
'name']) == $hash) {
363 $contents = $this->fss_export->getMemberExportFile($file[
'timest'] .
'_participant_export_' .
364 $file[
'type'] .
'_' . $this->obj_id .
'.' . $file[
'type']);
367 if ($file[
'type'] ==
'xls' && !$contents) {
368 $contents = $this->fss_export->getMemberExportFile($file[
'timest'] .
'_participant_export_' .
369 $file[
'type'] .
'_' . $this->obj_id .
'.xlsx');
370 $file[
'type'] =
'xlsx';
373 switch ($file[
'type']) {
377 date(
'Y_m_d_H-i' . $file[
'timest']) .
'_member_export_' . $this->obj_id .
'.xlsx',
378 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 385 date(
'Y_m_d_H-i' . $file[
'timest']) .
'_member_export_' . $this->obj_id .
'.xls',
386 'application/vnd.ms-excel' 412 if (!array_key_exists(
'id',
$_POST) || !is_array(
$_POST[
'id']) || !count(
$_POST[
'id'])) {
414 $this->ctrl->redirect($this,
'show');
417 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
419 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
420 $confirmation_gui->setHeaderText($this->lng->txt(
'info_delete_sure') );
421 $confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'show');
422 $confirmation_gui->setConfirm($this->lng->txt(
'delete'),
'deleteExportFile');
425 foreach ($this->fss_export->getMemberExportFiles() as $file) {
426 if (!in_array(md5($file[
'name']),
$_POST[
'id'])) {
430 $confirmation_gui->addItem(
433 strtoupper($file[
'type']) .
' - ' .
438 $this->tpl->setContent($confirmation_gui->getHTML());
450 if (!count(
$_POST[
'id'])) {
451 $this->ctrl->redirect($this,
'show');
455 foreach ($this->fss_export->getMemberExportFiles() as $file) {
456 if (!in_array(md5($file[
'name']),
$_POST[
'id'])) {
460 $ret = $this->fss_export->deleteMemberExportFile($file[
'timest'] .
'_participant_export_' .
461 $file[
'type'] .
'_' . $this->obj_id .
'.' . $file[
'type']);
464 if ($file[
'type'] ==
"xls" && !
$ret) {
465 $this->fss_export->deleteMemberExportFile($file[
'timest'] .
'_participant_export_' .
466 $file[
'type'] .
'_' . $this->obj_id .
'.' .
"xlsx");
470 ilUtil::sendSuccess($this->lng->txt(
'ps_files_deleted'),
true);
471 $this->ctrl->redirect($this,
'show');
481 if ($this->type ==
'crs') {
484 if ($this->type ==
'grp') {
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)
__construct($a_ref_id)
Constructor.
if(!array_key_exists('StateId', $_REQUEST)) $id
initSettingsForm($a_is_excel=false)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
executeCommand()
Execute Command.
if(isset($_POST['submit'])) $form
static _getInstanceByType($a_type)
Get Singleton Instance.
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Confirmation screen class.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.