24 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
25 include_once(
'Modules/Course/classes/Export/class.ilExportUserSettings.php');
26 include_once(
'./Services/Membership/classes/Export/class.ilMemberExport.php');
27 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
28 include_once(
'Modules/Group/classes/class.ilFSStorageGroup.php');
29 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
30 include_once(
'Services/User/classes/class.ilUserDefinedFields.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)
120 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.member_export.html',
'Modules/Course');
121 $this->tpl->setVariable(
'FORM_ACTION',$this->ctrl->getFormAction($this));
122 $this->tpl->setVariable(
'TXT_EXPORT_SETTINGS',$this->lng->txt(
'ps_export_settings'));
123 $this->tpl->setVariable(
'TXT_USER_SELECTION',$this->lng->txt(
'ps_user_selection'));
124 $this->tpl->setVariable(
'TXT_EXPORT_ADMIN',$this->lng->txt(
'ps_export_admin'));
125 $this->tpl->setVariable(
'TXT_EXPORT_MEMBER',$this->lng->txt(
'ps_export_member'));
126 $this->tpl->setVariable(
'TXT_EXPORT_WAIT',$this->lng->txt(
'ps_export_wait'));
127 $this->tpl->setVariable(
'TXT_EXPORT_SUB',$this->lng->txt(
'ps_export_sub'));
132 $this->tpl->setVariable(
'CHECK_EXPORT_ADMIN',
ilUtil::formCheckbox($this->exportSettings->enabled(
'admin'),
'export_members[admin]',1));
133 if($this->type ==
'crs')
135 $this->tpl->setVariable(
'CHECK_EXPORT_TUTOR',
ilUtil::formCheckbox($this->exportSettings->enabled(
'tutor'),
'export_members[tutor]',1));
136 $this->tpl->setVariable(
'TXT_EXPORT_TUTOR',$this->lng->txt(
'ps_export_tutor'));
138 $this->tpl->setVariable(
'CHECK_EXPORT_MEMBER',
ilUtil::formCheckbox($this->exportSettings->enabled(
'member'),
'export_members[member]',1));
139 $this->tpl->setVariable(
'CHECK_EXPORT_SUB',
ilUtil::formCheckbox($this->exportSettings->enabled(
'subscribers'),
'export_members[subscribers]',1));
140 $this->tpl->setVariable(
'CHECK_EXPORT_WAIT',
ilUtil::formCheckbox($this->exportSettings->enabled(
'waiting_list'),
'export_members[waiting_list]',1));
142 $this->tpl->setVariable(
'TXT_EXPORT',$this->lng->txt(
'ps_perform_export'));
143 $this->tpl->setVariable(
'TXT_EXPORT_EXCEL',$this->lng->txt(
'ps_export_excel'));
146 $this->tpl->setVariable(
'TXT_USER_DATA_SELECTION',$this->lng->txt(
'ps_export_data'));
147 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA_HEADER',$this->lng->txt(
'ps_export_user_data'));
150 $fields = $this->fields_info->getFieldsInfo();
151 foreach($fields as $field => $exportable)
157 $this->tpl->setCurrentBlock(
'user_data_row');
158 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled($field),
'export_members['.$field.
']',1));
159 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$this->lng->txt($field));
160 $this->tpl->parseCurrentBlock();
164 foreach($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data)
166 $this->tpl->setCurrentBlock(
'user_data_row');
167 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'udf_'.$field_id),
168 'export_members[udf_'.$field_id.
']',1));
169 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$udf_data[
'field_name']);
170 $this->tpl->parseCurrentBlock();
175 foreach($cdf_fields as $field_obj)
177 $this->tpl->setCurrentBlock(
'cdf_row');
178 $this->tpl->setVariable(
'CHECK_CDF_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'cdf_'.$field_obj->getId()),
179 'export_members[cdf_'.$field_obj->getId().
']',
181 $this->tpl->setVariable(
'TXT_CDF_NAME',$field_obj->getName());
182 $this->tpl->parseCurrentBlock();
184 if(count($cdf_fields))
186 $this->tpl->setCurrentBlock(
'cdf_fields');
187 $this->tpl->setVariable(
'TXT_CDF_SELECTION',$this->lng->txt(
'ps_'.$this->type.
'_user_fields'));
188 $this->tpl->parseCurrentBlock();
191 if($a_deliver_file and 0)
193 $this->tpl->setCurrentBlock(
'iframe');
194 $this->tpl->setVariable(
'SOURCE',$this->ctrl->getLinkTarget($this,
'deliverData'));
207 foreach($this->fss_export->getMemberExportFiles() as
$file)
211 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
230 if(!count(
$files = $this->fss_export->getMemberExportFiles()))
235 $a_tpl =
new ilTemplate(
'tpl.table.html',
true,
true);
236 $a_tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.member_export_file_row.html",
"Modules/Course");
237 $a_tpl->setVariable(
'FORMACTION',$this->ctrl->getFormaction($this));
239 include_once(
"./Services/Table/classes/class.ilTableGUI.php");
244 $tbl->setTitle($this->lng->txt(
"ps_export_files"));
246 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"type"),
247 $this->lng->txt(
"ps_size"),
248 $this->lng->txt(
"date") ));
250 $cols = array(
"",
"type",
"size",
"date");
252 $header_params = $this->ctrl->getParameterArray($this,
'show');
253 $tbl->setHeaderVars($cols, $header_params);
254 $tbl->setColumnWidth(array(
"1%",
"9%",
"45%",
"45%"));
257 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
258 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
259 $tbl->setLimit($ilUser->getPref(
'hits_per_page',9999));
260 $tbl->setOffset(
$_GET[
"offset"]);
261 $tbl->setMaxCount(count(
$files));
262 $tbl->disable(
"sort");
263 $a_tpl->setVariable(
"COLUMN_COUNTS",4);
269 foreach(
$files as $exp_file)
271 $a_tpl->setCurrentBlock(
"tbl_content");
272 $a_tpl->setVariable(
"TXT_FILENAME", $exp_file[
"file"]);
275 $a_tpl->setVariable(
"CSS_ROW", $css_row);
277 $a_tpl->setVariable(
"TXT_SIZE",$exp_file[
'size']);
278 $a_tpl->setVariable(
"TXT_TYPE", strtoupper($exp_file[
"type"]));
279 $a_tpl->setVariable(
"CHECKBOX_ID",$exp_file[
"timest"]);
280 $a_tpl->setVariable(
"TXT_DATE", date(
"Y-m-d H:i",$exp_file[
'timest']));
281 $a_tpl->parseCurrentBlock();
287 $a_tpl->setCurrentBlock(
"tbl_action_btn");
288 $a_tpl->setVariable(
"BTN_NAME",
"confirmDeleteExportFile");
289 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
290 $a_tpl->parseCurrentBlock();
292 $a_tpl->setCurrentBlock(
"tbl_action_btn");
293 $a_tpl->setVariable(
"BTN_NAME",
"downloadExportFile");
294 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
295 $a_tpl->parseCurrentBlock();
298 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
301 $tbl->setTemplate($a_tpl);
304 #$this->tpl->setCurrentBlock('file_list');
305 $this->tpl->setVariable(
'FILE_LIST_TABLE',$a_tpl->get());
306 #$this->tpl->parseCurrentBlock();
319 if(count(
$_POST[
'files']) != 1)
325 foreach($this->fss_export->getMemberExportFiles() as
$file)
331 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'].
'_participant_export_'.
332 $file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
335 switch($file[
'type'])
340 date(
'Y_m_d_H-i'.$file[
'timest']).
'_member_export_'.$this->obj_id.
'.xls',
341 'application/vnd.ms-excel'
368 if(!count(
$_POST[
'files']))
377 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.member_export_confirm_delete.html',
'Modules/Course');
378 $this->tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
379 $this->tpl->setVariable(
'TEXT',$this->lng->txt(
'ps_delete_export_files'));
383 foreach($this->fss_export->getMemberExportFiles() as
$file)
389 $this->tpl->setCurrentBlock(
'table_row');
391 $this->tpl->setVariable(
'TEXT_TYPE',strtoupper(
$file[
'type']));
393 $this->tpl->parseCurrentBlock();
395 $this->tpl->setCurrentBlock(
'operation_btn');
396 $this->tpl->setVariable(
'BTN_NAME',
'deleteExportFile');
397 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'delete'));
398 $this->tpl->parseCurrentBlock();
400 $this->tpl->setCurrentBlock(
'operation_btn');
401 $this->tpl->setVariable(
'BTN_NAME',
'show');
402 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'cancel'));
403 $this->tpl->parseCurrentBlock();
416 if(!is_array(
$_SESSION[
'il_del_member_export']))
422 foreach($this->fss_export->getMemberExportFiles() as
$file)
428 $this->fss_export->deleteMemberExportFile(
$file[
'timest'].
'_participant_export_'.
$file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
449 $this->exportSettings->
set(
$_POST[
'export_members']);
450 $this->exportSettings->store();
455 $filename = time().
'_participant_export_csv_'.$this->obj_id.
'.csv';
456 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
468 $this->exportSettings->
set(
$_POST[
'export_members']);
469 $this->exportSettings->store();
471 $filename = time().
'_participant_export_xls_'.$this->obj_id.
'.xls';
472 $this->fss_export->initMemberExportDirectory();
473 $filepath = $this->fss_export->getMemberExportDirectory().DIRECTORY_SEPARATOR.$filename;
476 $this->
export->setFilename($filepath);
492 if($this->type ==
'crs')
496 if($this->type ==
'grp')