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');
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'));
147 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
150 $this->tpl->setCurrentBlock(
'consultation');
151 $this->lng->loadLanguageModule(
'dateplaner');
152 $this->tpl->setVariable(
'TXT_CH',$this->lng->txt(
'cal_ch_field_ch'));
153 $this->tpl->setVariable(
'TXT_EXPORT_CH',$this->lng->txt(
'cal_ch_export_apps'));
154 $this->tpl->setVariable(
'CHECK_EXPORT_CH',
ilUtil::formCheckbox($this->exportSettings->enabled(
'consultation_hour'),
'export_members[consultation_hour]', 1));
155 $this->tpl->parseCurrentBlock();
157 $this->fields_info->sortExportFields();
158 $fields = $this->fields_info->getFieldsInfo();
159 foreach($fields as $field => $exportable)
165 $this->tpl->setCurrentBlock(
'user_data_row');
166 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled($field),
'export_members['.$field.
']',1));
167 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$this->lng->txt($field));
169 if($field ==
"username")
171 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$this->lng->txt(
"login"));
173 $this->tpl->parseCurrentBlock();
177 foreach($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data)
179 $this->tpl->setCurrentBlock(
'user_data_row');
180 $this->tpl->setVariable(
'CHECK_EXPORT_USER_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'udf_'.$field_id),
181 'export_members[udf_'.$field_id.
']',1));
182 $this->tpl->setVariable(
'TXT_EXPORT_USER_DATA',$udf_data[
'field_name']);
183 $this->tpl->parseCurrentBlock();
188 foreach($cdf_fields as $field_obj)
190 $this->tpl->setCurrentBlock(
'cdf_row');
191 $this->tpl->setVariable(
'CHECK_CDF_DATA',
ilUtil::formCheckbox($this->exportSettings->enabled(
'cdf_'.$field_obj->getId()),
192 'export_members[cdf_'.$field_obj->getId().
']',
194 $this->tpl->setVariable(
'TXT_CDF_NAME',$field_obj->getName());
195 $this->tpl->parseCurrentBlock();
197 if(count($cdf_fields))
199 $this->tpl->setCurrentBlock(
'cdf_fields');
200 $this->tpl->setVariable(
'TXT_CDF_SELECTION',$this->lng->txt(
'ps_'.$this->type.
'_user_fields'));
201 $this->tpl->parseCurrentBlock();
204 if($a_deliver_file and 0)
206 $this->tpl->setCurrentBlock(
'iframe');
207 $this->tpl->setVariable(
'SOURCE',$this->ctrl->getLinkTarget($this,
'deliverData'));
220 foreach($this->fss_export->getMemberExportFiles() as
$file)
224 $content = $this->fss_export->getMemberExportFile(
$_SESSION[
'member_export_filename']);
243 if(!count($files = $this->fss_export->getMemberExportFiles()))
248 $a_tpl =
new ilTemplate(
'tpl.table.html',
true,
true);
249 $a_tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.member_export_file_row.html",
"Modules/Course");
250 $a_tpl->setVariable(
'FORMACTION',$this->ctrl->getFormaction($this));
252 include_once(
"./Services/Table/classes/class.ilTableGUI.php");
257 $tbl->setTitle($this->lng->txt(
"ps_export_files"));
259 $tbl->setHeaderNames(array(
"", $this->lng->txt(
"type"),
260 $this->lng->txt(
"ps_size"),
261 $this->lng->txt(
"date") ));
263 $cols = array(
"",
"type",
"size",
"date");
265 $header_params = $this->ctrl->getParameterArray($this,
'show');
266 $tbl->setHeaderVars($cols, $header_params);
267 $tbl->setColumnWidth(array(
"1%",
"9%",
"45%",
"45%"));
270 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
271 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
272 $tbl->setLimit(
$ilUser->getPref(
'hits_per_page',9999));
273 $tbl->setOffset(
$_GET[
"offset"]);
274 $tbl->setMaxCount(count($files));
275 $tbl->disable(
"sort");
276 $a_tpl->setVariable(
"COLUMN_COUNTS",4);
278 $files = array_reverse($files);
279 $files = array_slice($files,
$_GET[
"offset"],
$_GET[
"limit"]);
282 foreach($files as $exp_file)
284 $a_tpl->setCurrentBlock(
"tbl_content");
285 $a_tpl->setVariable(
"TXT_FILENAME", $exp_file[
"file"]);
288 $a_tpl->setVariable(
"CSS_ROW", $css_row);
290 $a_tpl->setVariable(
"TXT_SIZE",$exp_file[
'size']);
291 $a_tpl->setVariable(
"TXT_TYPE", strtoupper($exp_file[
"type"]));
292 $a_tpl->setVariable(
"CHECKBOX_ID",$exp_file[
"timest"]);
293 $a_tpl->setVariable(
"TXT_DATE", date(
"Y-m-d H:i",$exp_file[
'timest']));
294 $a_tpl->parseCurrentBlock();
300 $a_tpl->setCurrentBlock(
"tbl_action_btn");
301 $a_tpl->setVariable(
"BTN_NAME",
"confirmDeleteExportFile");
302 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
303 $a_tpl->parseCurrentBlock();
305 $a_tpl->setCurrentBlock(
"tbl_action_btn");
306 $a_tpl->setVariable(
"BTN_NAME",
"downloadExportFile");
307 $a_tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
308 $a_tpl->parseCurrentBlock();
311 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
314 $tbl->setTemplate($a_tpl);
317 #$this->tpl->setCurrentBlock('file_list');
318 $this->tpl->setVariable(
'FILE_LIST_TABLE',$a_tpl->get());
319 #$this->tpl->parseCurrentBlock();
332 if(count(
$_POST[
'files']) != 1)
338 foreach($this->fss_export->getMemberExportFiles() as
$file)
344 $contents = $this->fss_export->getMemberExportFile(
$file[
'timest'].
'_participant_export_'.
345 $file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
348 switch(
$file[
'type'])
353 date(
'Y_m_d_H-i'.
$file[
'timest']).
'_member_export_'.$this->obj_id.
'.xls',
354 'application/vnd.ms-excel'
381 if(!count(
$_POST[
'files']))
390 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.member_export_confirm_delete.html',
'Modules/Course');
391 $this->tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
392 $this->tpl->setVariable(
'TEXT',$this->lng->txt(
'ps_delete_export_files'));
396 foreach($this->fss_export->getMemberExportFiles() as
$file)
402 $this->tpl->setCurrentBlock(
'table_row');
404 $this->tpl->setVariable(
'TEXT_TYPE',strtoupper(
$file[
'type']));
406 $this->tpl->parseCurrentBlock();
408 $this->tpl->setCurrentBlock(
'operation_btn');
409 $this->tpl->setVariable(
'BTN_NAME',
'deleteExportFile');
410 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'delete'));
411 $this->tpl->parseCurrentBlock();
413 $this->tpl->setCurrentBlock(
'operation_btn');
414 $this->tpl->setVariable(
'BTN_NAME',
'show');
415 $this->tpl->setVariable(
'BTN_VALUE',$this->lng->txt(
'cancel'));
416 $this->tpl->parseCurrentBlock();
429 if(!is_array(
$_SESSION[
'il_del_member_export']))
435 foreach($this->fss_export->getMemberExportFiles() as
$file)
441 $this->fss_export->deleteMemberExportFile(
$file[
'timest'].
'_participant_export_'.
$file[
'type'].
'_'.$this->obj_id.
'.'.
$file[
'type']);
460 $this->exportSettings->set(
$_POST[
'export_members']);
461 $this->exportSettings->store();
466 $filename = time().
'_participant_export_csv_'.$this->obj_id.
'.csv';
467 $this->fss_export->addMemberExportFile($this->
export->getCSVString(),
$filename);
477 $this->exportSettings->set(
$_POST[
'export_members']);
478 $this->exportSettings->store();
480 $filename = time().
'_participant_export_xls_'.$this->obj_id.
'.xls';
481 $this->fss_export->initMemberExportDirectory();
482 $filepath = $this->fss_export->getMemberExportDirectory().DIRECTORY_SEPARATOR.$filename;
485 $this->
export->setFilename($filepath);
501 if($this->type ==
'crs')
505 if($this->type ==
'grp')
static hasObjectBookingEntries($a_obj_id, $a_usr_id)
Check if object has assigned consultation hour appointments.
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.
deliverData()
Deliver Data.
downloadExportFile()
Download export file.
deleteExportFile()
Delete member export files.
export()
Export Create member export file and store it in data directory.
showFileList()
Show file list of available export files.
show($a_deliver_file=false)
Show list of export files.
confirmDeleteExportFile()
Confirm deletion of export files.
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.
special template class to simplify handling of ITX/PEAR
static _getInstance()
Get instance.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
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.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)