ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMemberExportGUI Class Reference
+ Collaboration diagram for ilMemberExportGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor.
 executeCommand ()
 Execute Command.
 show ($a_deliver_file=false)
 Show list of export files.
 deliverData ()
 Deliver Data.
 showFileList ()
 Show file list of available export files.
 downloadExportFile ()
 Download export file.
 confirmDeleteExportFile ()
 Confirm deletion of export files.
 deleteExportFile ()
 Delete member export files.
 export ()
 Export Create member export file and store it in data directory.
 exportExcel ()

Protected Member Functions

 initFileSystemStorage ()
 Init file object.

Private Attributes

 $ref_id
 $obj_id
 $type
 $ctrl
 $tpl
 $lng
 $fields_info
 $fss_export = null

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilMemberExportGUI:

Definition at line 41 of file class.ilMemberExportGUI.php.

Constructor & Destructor Documentation

ilMemberExportGUI::__construct (   $a_ref_id)

Constructor.

public

Parameters

Definition at line 60 of file class.ilMemberExportGUI.php.

References $ilCtrl, $ilUser, $lng, $tpl, ilExportFieldsInfo\_getInstanceByType(), ilObject\_lookupType(), and initFileSystemStorage().

{
global $ilCtrl,$tpl,$lng,$ilUser,$ilObjDataCache;
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('ps');
$this->ref_id = $a_ref_id;
$this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
$this->type = ilObject::_lookupType($this->obj_id);
$this->fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->obj_id));
}

+ Here is the call graph for this function:

Member Function Documentation

ilMemberExportGUI::confirmDeleteExportFile ( )

Confirm deletion of export files.

public

Parameters

Definition at line 374 of file class.ilMemberExportGUI.php.

References $_POST, $_SESSION, $file, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilUtil\sendFailure(), ilUtil\sendQuestion(), show(), and ilUtil\switchColor().

{
if(!count($_POST['files']))
{
ilUtil::sendFailure($this->lng->txt('ps_select_one'));
$this->show();
return false;
}
$_SESSION['il_del_member_export'] = $_POST['files'];
ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.member_export_confirm_delete.html','Modules/Course');
$this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
$this->tpl->setVariable('TEXT',$this->lng->txt('ps_delete_export_files'));
$counter = 0;
foreach($this->fss_export->getMemberExportFiles() as $file)
{
if(!in_array($file['timest'],$_POST['files']))
{
continue;
}
$this->tpl->setCurrentBlock('table_row');
$this->tpl->setVariable('CSS_ROW',ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
$this->tpl->setVariable('TEXT_TYPE',strtoupper($file['type']));
$this->tpl->setVariable('DATE',ilDatePresentation::formatDate(new ilDateTime($file['timest'],IL_CAL_UNIX)));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('operation_btn');
$this->tpl->setVariable('BTN_NAME','deleteExportFile');
$this->tpl->setVariable('BTN_VALUE',$this->lng->txt('delete'));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock('operation_btn');
$this->tpl->setVariable('BTN_NAME','show');
$this->tpl->setVariable('BTN_VALUE',$this->lng->txt('cancel'));
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilMemberExportGUI::deleteExportFile ( )

Delete member export files.

public

Parameters

Definition at line 422 of file class.ilMemberExportGUI.php.

References $_SESSION, $file, ilUtil\sendSuccess(), and show().

{
if(!is_array($_SESSION['il_del_member_export']))
{
$this->show();
return false;
}
$counter = 0;
foreach($this->fss_export->getMemberExportFiles() as $file)
{
if(!in_array($file['timest'],$_SESSION['il_del_member_export']))
{
continue;
}
$this->fss_export->deleteMemberExportFile($file['timest'].'_participant_export_'.$file['type'].'_'.$this->obj_id.'.'.$file['type']);
}
ilUtil::sendSuccess($this->lng->txt('ps_files_deleted'));
$this->show();
}

+ Here is the call graph for this function:

ilMemberExportGUI::deliverData ( )

Deliver Data.

public

Parameters

Definition at line 213 of file class.ilMemberExportGUI.php.

References $_SESSION, and $file.

Referenced by downloadExportFile().

{
foreach($this->fss_export->getMemberExportFiles() as $file)
{
if($file['name'] == $_SESSION['member_export_filename'])
{
$content = $this->fss_export->getMemberExportFile($_SESSION['member_export_filename']);
ilUtil::deliverData($content,date('Y_m_d_H-i',$file['timest']).
'_member_export_'.
$this->obj_id.
'.csv','text/csv');
}
}
}

+ Here is the caller graph for this function:

ilMemberExportGUI::downloadExportFile ( )

Download export file.

public

Parameters

Definition at line 325 of file class.ilMemberExportGUI.php.

References $_POST, $file, deliverData(), ilUtil\sendFailure(), and show().

{
if(count($_POST['files']) != 1)
{
ilUtil::sendFailure($this->lng->txt('ps_select_one'));
$this->show();
return true;
}
foreach($this->fss_export->getMemberExportFiles() as $file)
{
if(!in_array($file['timest'],$_POST['files']))
{
continue;
}
$contents = $this->fss_export->getMemberExportFile($file['timest'].'_participant_export_'.
$file['type'].'_'.$this->obj_id.'.'.$file['type']);
switch($file['type'])
{
case 'xls':
$contents,
date('Y_m_d_H-i'.$file['timest']).'_member_export_'.$this->obj_id.'.xls',
'application/vnd.ms-excel'
);
default:
case 'csv':
ilUtil::deliverData($contents,date('Y_m_d_H-i'.$file['timest']).
'_member_export_'.
$this->obj_id.
'.csv','text/csv');
break;
}
return true;
}
}

+ Here is the call graph for this function:

ilMemberExportGUI::executeCommand ( )

Execute Command.

public

Parameters

Definition at line 83 of file class.ilMemberExportGUI.php.

References $cmd, ilPrivacySettings\_getInstance(), and ilUtil\sendFailure().

{
global $ilAccess,$rbacsystem;
include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
if(!ilPrivacySettings::_getInstance()->checkExportAccess($this->ref_id))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$this->ctrl->returnToParent($this);
}
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = 'show';
}
$this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilMemberExportGUI::export ( )

Export Create member export file and store it in data directory.

public

Definition at line 451 of file class.ilMemberExportGUI.php.

References $_POST, $_SESSION, $filename, and show().

Referenced by exportExcel().

{
// Save settings
$this->exportSettings = new ilUserFormSettings('memexp');
$this->exportSettings->set($_POST['export_members']);
$this->exportSettings->store();
$this->export = new ilMemberExport($this->ref_id);
$this->export->create();
$filename = time().'_participant_export_csv_'.$this->obj_id.'.csv';
$this->fss_export->addMemberExportFile($this->export->getCSVString(),$filename);
$_SESSION['member_export_filename'] = $filename;
$this->show(true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberExportGUI::exportExcel ( )

Definition at line 469 of file class.ilMemberExportGUI.php.

References $_POST, $_SESSION, $filename, export(), ilMemberExport\EXPORT_EXCEL, and show().

{
$this->exportSettings = new ilUserFormSettings('memexp');
$this->exportSettings->set($_POST['export_members']);
$this->exportSettings->store();
$filename = time().'_participant_export_xls_'.$this->obj_id.'.xls';
$this->fss_export->initMemberExportDirectory();
$filepath = $this->fss_export->getMemberExportDirectory().DIRECTORY_SEPARATOR.$filename;
$this->export = new ilMemberExport($this->ref_id,ilMemberExport::EXPORT_EXCEL);
$this->export->setFilename($filepath);
$this->export->create();
$_SESSION['member_export_filename'] = $filename;
$this->show(true);
}

+ Here is the call graph for this function:

ilMemberExportGUI::initFileSystemStorage ( )
protected

Init file object.

Returns

Definition at line 494 of file class.ilMemberExportGUI.php.

Referenced by __construct().

{
if($this->type == 'crs')
{
$this->fss_export = new ilFSStorageCourse($this->obj_id);
}
if($this->type == 'grp')
{
$this->fss_export = new ilFSStorageGroup($this->obj_id);
}
}

+ Here is the caller graph for this function:

ilMemberExportGUI::show (   $a_deliver_file = false)

Show list of export files.

public

Definition at line 115 of file class.ilMemberExportGUI.php.

References $GLOBALS, ilCourseDefinedFieldDefinition\_getFields(), ilUserDefinedFields\_getInstance(), ilUtil\formCheckbox(), ilBookingEntry\hasObjectBookingEntries(), and showFileList().

Referenced by confirmDeleteExportFile(), deleteExportFile(), downloadExportFile(), export(), and exportExcel().

{
$this->showFileList();
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.member_export.html','Modules/Course');
$this->tpl->setVariable('FORM_ACTION',$this->ctrl->getFormAction($this));
$this->tpl->setVariable('TXT_EXPORT_SETTINGS',$this->lng->txt('ps_export_settings'));
$this->tpl->setVariable('TXT_USER_SELECTION',$this->lng->txt('ps_user_selection'));
$this->tpl->setVariable('TXT_EXPORT_ADMIN',$this->lng->txt('ps_export_admin'));
$this->tpl->setVariable('TXT_EXPORT_MEMBER',$this->lng->txt('ps_export_member'));
$this->tpl->setVariable('TXT_EXPORT_WAIT',$this->lng->txt('ps_export_wait'));
$this->tpl->setVariable('TXT_EXPORT_SUB',$this->lng->txt('ps_export_sub'));
// Check user selection
$this->exportSettings = new ilUserFormSettings('memexp');
$this->tpl->setVariable('CHECK_EXPORT_ADMIN',ilUtil::formCheckbox($this->exportSettings->enabled('admin'),'export_members[admin]',1));
if($this->type == 'crs')
{
$this->tpl->setVariable('CHECK_EXPORT_TUTOR',ilUtil::formCheckbox($this->exportSettings->enabled('tutor'),'export_members[tutor]',1));
$this->tpl->setVariable('TXT_EXPORT_TUTOR',$this->lng->txt('ps_export_tutor'));
}
$this->tpl->setVariable('CHECK_EXPORT_MEMBER',ilUtil::formCheckbox($this->exportSettings->enabled('member'),'export_members[member]',1));
$this->tpl->setVariable('CHECK_EXPORT_SUB',ilUtil::formCheckbox($this->exportSettings->enabled('subscribers'),'export_members[subscribers]',1));
$this->tpl->setVariable('CHECK_EXPORT_WAIT',ilUtil::formCheckbox($this->exportSettings->enabled('waiting_list'),'export_members[waiting_list]',1));
$this->tpl->setVariable('TXT_EXPORT',$this->lng->txt('ps_perform_export'));
$this->tpl->setVariable('TXT_EXPORT_EXCEL',$this->lng->txt('ps_export_excel'));
// User Data
$this->tpl->setVariable('TXT_USER_DATA_SELECTION',$this->lng->txt('ps_export_data'));
$this->tpl->setVariable('TXT_EXPORT_USER_DATA_HEADER',$this->lng->txt('ps_export_user_data'));
include_once './Services/Booking/classes/class.ilBookingEntry.php';
if(ilBookingEntry::hasObjectBookingEntries($this->obj_id, $GLOBALS['ilUser']->getId()))
{
$this->tpl->setCurrentBlock('consultation');
$this->lng->loadLanguageModule('dateplaner');
$this->tpl->setVariable('TXT_CH',$this->lng->txt('cal_ch_field_ch'));
$this->tpl->setVariable('TXT_EXPORT_CH',$this->lng->txt('cal_ch_export_apps'));
$this->tpl->setVariable('CHECK_EXPORT_CH',ilUtil::formCheckbox($this->exportSettings->enabled('consultation_hour'), 'export_members[consultation_hour]', 1));
$this->tpl->parseCurrentBlock();
}
$fields = $this->fields_info->getFieldsInfo();
foreach($fields as $field => $exportable)
{
if(!$exportable)
{
continue;
}
$this->tpl->setCurrentBlock('user_data_row');
$this->tpl->setVariable('CHECK_EXPORT_USER_DATA',ilUtil::formCheckbox($this->exportSettings->enabled($field),'export_members['.$field.']',1));
$this->tpl->setVariable('TXT_EXPORT_USER_DATA',$this->lng->txt($field));
$this->tpl->parseCurrentBlock();
}
foreach($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data)
{
$this->tpl->setCurrentBlock('user_data_row');
$this->tpl->setVariable('CHECK_EXPORT_USER_DATA',ilUtil::formCheckbox($this->exportSettings->enabled('udf_'.$field_id),
'export_members[udf_'.$field_id.']',1));
$this->tpl->setVariable('TXT_EXPORT_USER_DATA',$udf_data['field_name']);
$this->tpl->parseCurrentBlock();
}
$cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->obj_id);
foreach($cdf_fields as $field_obj)
{
$this->tpl->setCurrentBlock('cdf_row');
$this->tpl->setVariable('CHECK_CDF_DATA',ilUtil::formCheckbox($this->exportSettings->enabled('cdf_'.$field_obj->getId()),
'export_members[cdf_'.$field_obj->getId().']',
1));
$this->tpl->setVariable('TXT_CDF_NAME',$field_obj->getName());
$this->tpl->parseCurrentBlock();
}
if(count($cdf_fields))
{
$this->tpl->setCurrentBlock('cdf_fields');
$this->tpl->setVariable('TXT_CDF_SELECTION',$this->lng->txt('ps_'.$this->type.'_user_fields'));
$this->tpl->parseCurrentBlock();
}
if($a_deliver_file and 0)
{
$this->tpl->setCurrentBlock('iframe');
$this->tpl->setVariable('SOURCE',$this->ctrl->getLinkTarget($this,'deliverData'));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberExportGUI::showFileList ( )

Show file list of available export files.

public

Definition at line 234 of file class.ilMemberExportGUI.php.

References $_GET, $ilUser, ilUtil\getImagePath(), and ilUtil\switchColor().

Referenced by show().

{
global $ilUser;
if(!count($files = $this->fss_export->getMemberExportFiles()))
{
return false;
}
$a_tpl = new ilTemplate('tpl.table.html',true,true);
$a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.member_export_file_row.html", "Modules/Course");
$a_tpl->setVariable('FORMACTION',$this->ctrl->getFormaction($this));
include_once("./Services/Table/classes/class.ilTableGUI.php");
$tbl = new ilTableGUI();
// load template for table content data
$tbl->setTitle($this->lng->txt("ps_export_files"));
$tbl->setHeaderNames(array("", $this->lng->txt("type"),
$this->lng->txt("ps_size"),
$this->lng->txt("date") ));
$cols = array("", "type","size", "date");
$header_params = $this->ctrl->getParameterArray($this,'show');
$tbl->setHeaderVars($cols, $header_params);
$tbl->setColumnWidth(array("1%", "9%", "45%", "45%"));
// control
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setLimit($ilUser->getPref('hits_per_page',9999));
$tbl->setOffset($_GET["offset"]);
$tbl->setMaxCount(count($files));
$tbl->disable("sort");
$a_tpl->setVariable("COLUMN_COUNTS",4);
$files = array_reverse($files);
$files = array_slice($files, $_GET["offset"], $_GET["limit"]);
$num = 0;
$i=0;
foreach($files as $exp_file)
{
$a_tpl->setCurrentBlock("tbl_content");
$a_tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
$css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
$a_tpl->setVariable("CSS_ROW", $css_row);
$a_tpl->setVariable("TXT_SIZE",$exp_file['size']);
$a_tpl->setVariable("TXT_TYPE", strtoupper($exp_file["type"]));
$a_tpl->setVariable("CHECKBOX_ID",$exp_file["timest"]);
$a_tpl->setVariable("TXT_DATE", date("Y-m-d H:i",$exp_file['timest']));
$a_tpl->parseCurrentBlock();
}
// delete button
$a_tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
$a_tpl->setCurrentBlock("tbl_action_btn");
$a_tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
$a_tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("tbl_action_btn");
$a_tpl->setVariable("BTN_NAME", "downloadExportFile");
$a_tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
$a_tpl->parseCurrentBlock();
// footer
$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
//$tbl->disable("footer");
$tbl->setTemplate($a_tpl);
$tbl->render();
#$this->tpl->setCurrentBlock('file_list');
$this->tpl->setVariable('FILE_LIST_TABLE',$a_tpl->get());
#$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMemberExportGUI::$ctrl
private

Definition at line 46 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$fields_info
private

Definition at line 50 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$fss_export = null
private

Definition at line 51 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$lng
private

Definition at line 48 of file class.ilMemberExportGUI.php.

Referenced by __construct().

ilMemberExportGUI::$obj_id
private

Definition at line 44 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$ref_id
private

Definition at line 43 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$tpl
private

Definition at line 47 of file class.ilMemberExportGUI.php.

Referenced by __construct().

ilMemberExportGUI::$type
private

Definition at line 45 of file class.ilMemberExportGUI.php.


The documentation for this class was generated from the following file: