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');
67 $this->lng->loadLanguageModule(
'ps');
68 $this->ref_id = $a_ref_id;
69 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
85 global $ilAccess,$rbacsystem;
87 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
91 $this->ctrl->returnToParent($this);
94 $next_class = $this->ctrl->getNextClass($this);
95 $cmd = $this->ctrl->getCmd();
115 public function show($a_deliver_file =
false)
118 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.member_export.html',
'Modules/Course');
119 $this->tpl->setVariable(
'FORM_ACTION',$this->ctrl->getFormAction($this));
120 $this->tpl->setVariable(
'TXT_EXPORT_SETTINGS',$this->lng->txt(
'ps_export_settings'));
121 $this->tpl->setVariable(
'TXT_USER_SELECTION',$this->lng->txt(
'ps_user_selection'));
122 $this->tpl->setVariable(
'TXT_EXPORT_ADMIN',$this->lng->txt(
'ps_export_admin'));
123 $this->tpl->setVariable(
'TXT_EXPORT_MEMBER',$this->lng->txt(
'ps_export_member'));
124 $this->tpl->setVariable(
'TXT_EXPORT_WAIT',$this->lng->txt(
'ps_export_wait'));
125 $this->tpl->setVariable(
'TXT_EXPORT_SUB',$this->lng->txt(
'ps_export_sub'));
130 $this->tpl->setVariable(
'CHECK_EXPORT_ADMIN',
ilUtil::formCheckbox($this->exportSettings->enabled(
'admin'),
'export_members[admin]',1));
131 if($this->type ==
'crs')
133 $this->tpl->setVariable(
'CHECK_EXPORT_TUTOR',
ilUtil::formCheckbox($this->exportSettings->enabled(
'tutor'),
'export_members[tutor]',1));
134 $this->tpl->setVariable(
'TXT_EXPORT_TUTOR',$this->lng->txt(
'ps_export_tutor'));
136 $this->tpl->setVariable(
'CHECK_EXPORT_MEMBER',
ilUtil::formCheckbox($this->exportSettings->enabled(
'member'),
'export_members[member]',1));
137 $this->tpl->setVariable(
'CHECK_EXPORT_SUB',
ilUtil::formCheckbox($this->exportSettings->enabled(
'subscribers'),
'export_members[subscribers]',1));
138 $this->tpl->setVariable(
'CHECK_EXPORT_WAIT',
ilUtil::formCheckbox($this->exportSettings->enabled(
'waiting_list'),
'export_members[waiting_list]',1));
140 $this->tpl->setVariable(
'TXT_EXPORT',$this->lng->txt(
'ps_perform_export'));
141 $this->tpl->setVariable(
'TXT_EXPORT_EXCEL',$this->lng->txt(
'ps_export_excel'));
144 $this->tpl->setVariable(
'TXT_USER_DATA_SELECTION',$this->lng->txt(
'ps_export_data'));
145 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA_HEADER',$this->lng->txt(
'ps_export_user_data'));
148 $fields = $this->fields_info->getFieldsInfo();
149 foreach($fields as $field => $exportable)
155 $this->tpl->setCurrentBlock(
'user_data_row');
156 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled($field),
'export_members['.$field.
']',1));
157 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$this->lng->txt($field));
158 $this->tpl->parseCurrentBlock();
162 foreach($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data)
164 $this->tpl->setCurrentBlock(
'user_data_row');
165 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'udf_'.$field_id),
166 'export_members[udf_'.$field_id.
']',1));
167 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$udf_data[
'field_name']);
168 $this->tpl->parseCurrentBlock();
173 foreach($cdf_fields as $field_obj)
175 $this->tpl->setCurrentBlock(
'cdf_row');
176 $this->tpl->setVariable(
'CHECK_CDF_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'cdf_'.$field_obj->getId()),
177 'export_members[cdf_'.$field_obj->getId().
']',
179 $this->tpl->setVariable(
'TXT_CDF_NAME',$field_obj->getName());
180 $this->tpl->parseCurrentBlock();
182 if(count($cdf_fields))
184 $this->tpl->setCurrentBlock(
'cdf_fields');
185 $this->tpl->setVariable(
'TXT_CDF_SELECTION',$this->lng->txt(
'ps_'.$this->type.
'_user_fields'));
186 $this->tpl->parseCurrentBlock();
189 if($a_deliver_file and 0)
191 $this->tpl->setCurrentBlock(
'iframe');
192 $this->tpl->setVariable(
'SOURCE',$this->ctrl->getLinkTarget($this,
'deliverData'));
205 foreach($this->fss_export->getMemberExportFiles() as
$file)
209 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
228 if(!count($files = $this->fss_export->getMemberExportFiles()))
233 $a_tpl =
new ilTemplate(
'tpl.table.html',
true,
true);
234 $a_tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.member_export_file_row.html",
"Modules/Course");
235 $a_tpl->setVariable(
'FORMACTION',$this->ctrl->getFormaction($this));
237 include_once(
"./Services/Table/classes/class.ilTableGUI.php");
242 $tbl->setTitle($this->lng->txt(
"ps_export_files"));
244 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"type"),
245 $this->lng->txt(
"ps_size"),
246 $this->lng->txt(
"date") ));
248 $cols = array(
"",
"type",
"size",
"date");
250 $header_params = $this->ctrl->getParameterArray($this,
'show');
251 $tbl->setHeaderVars($cols, $header_params);
252 $tbl->setColumnWidth(array(
"1%",
"9%",
"45%",
"45%"));
255 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
256 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
257 $tbl->setLimit($ilUser->getPref(
'hits_per_page',9999));
258 $tbl->setOffset(
$_GET[
"offset"]);
259 $tbl->setMaxCount(count($files));
260 $tbl->disable(
"sort");
261 $a_tpl->setVariable(
"COLUMN_COUNTS",4);
263 $files = array_reverse($files);
264 $files = array_slice($files,
$_GET[
"offset"],
$_GET[
"limit"]);
267 foreach($files as $exp_file)
269 $a_tpl->setCurrentBlock(
"tbl_content");
270 $a_tpl->setVariable(
"TXT_FILENAME", $exp_file[
"file"]);
273 $a_tpl->setVariable(
"CSS_ROW", $css_row);
275 $a_tpl->setVariable(
"TXT_SIZE",$exp_file[
'size']);
276 $a_tpl->setVariable(
"TXT_TYPE", strtoupper($exp_file[
"type"]));
277 $a_tpl->setVariable(
"CHECKBOX_ID",$exp_file[
"timest"]);
278 $a_tpl->setVariable(
"TXT_DATE", date(
"Y-m-d H:i",$exp_file[
'timest']));
279 $a_tpl->parseCurrentBlock();
285 $a_tpl->setCurrentBlock(
"tbl_action_btn");
286 $a_tpl->setVariable(
"BTN_NAME",
"confirmDeleteExportFile");
287 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
288 $a_tpl->parseCurrentBlock();
290 $a_tpl->setCurrentBlock(
"tbl_action_btn");
291 $a_tpl->setVariable(
"BTN_NAME",
"downloadExportFile");
292 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
293 $a_tpl->parseCurrentBlock();
296 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
299 $tbl->setTemplate($a_tpl);
302 #$this->tpl->setCurrentBlock('file_list');
303 $this->tpl->setVariable(
'FILE_LIST_TABLE',$a_tpl->get());
304 #$this->tpl->parseCurrentBlock();
317 if(count(
$_POST[
'files']) != 1)
323 foreach($this->fss_export->getMemberExportFiles() as
$file)
329 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'].
'_participant_export_'.
330 $file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
333 switch($file[
'type'])
338 date(
'Y_m_d_H-i'.$file[
'timest']).
'_member_export_'.$this->obj_id.
'.xls',
339 'application/vnd.ms-excel'
366 if(!count(
$_POST[
'files']))
375 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.member_export_confirm_delete.html',
'Modules/Course');
376 $this->tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
377 $this->tpl->setVariable(
'TEXT',$this->lng->txt(
'ps_delete_export_files'));
381 foreach($this->fss_export->getMemberExportFiles() as
$file)
387 $this->tpl->setCurrentBlock(
'table_row');
389 $this->tpl->setVariable(
'TEXT_TYPE',strtoupper(
$file[
'type']));
391 $this->tpl->parseCurrentBlock();
393 $this->tpl->setCurrentBlock(
'operation_btn');
394 $this->tpl->setVariable(
'BTN_NAME',
'deleteExportFile');
395 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'delete'));
396 $this->tpl->parseCurrentBlock();
398 $this->tpl->setCurrentBlock(
'operation_btn');
399 $this->tpl->setVariable(
'BTN_NAME',
'show');
400 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'cancel'));
401 $this->tpl->parseCurrentBlock();
414 if(!is_array(
$_SESSION[
'il_del_member_export']))
420 foreach($this->fss_export->getMemberExportFiles() as
$file)
426 $this->fss_export->deleteMemberExportFile(
$file[
'timest'].
'_participant_export_'.
$file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
445 $this->exportSettings->set(
$_POST[
'export_members']);
446 $this->exportSettings->store();
451 $filename = time().
'_participant_export_csv_'.$this->obj_id.
'.csv';
452 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
462 $this->exportSettings->set(
$_POST[
'export_members']);
463 $this->exportSettings->store();
465 $filename = time().
'_participant_export_xls_'.$this->obj_id.
'.xls';
466 $this->fss_export->initMemberExportDirectory();
467 $filepath = $this->fss_export->getMemberExportDirectory().DIRECTORY_SEPARATOR.$filename;
470 $this->
export->setFilename($filepath);
486 if($this->type ==
'crs')
490 if($this->type ==
'grp')