ILIAS  Release_3_10_x_branch Revision 61812
 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.

Private Attributes

 $ref_id
 $obj_id
 $ctrl
 $tpl
 $lng
 $fields_info

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
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 58 of file class.ilMemberExportGUI.php.

References $ilCtrl, $lng, $tpl, and ilExportFieldsInfo\_getInstance().

{
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->fields_info = ilExportFieldsInfo::_getInstance();
}

+ Here is the call graph for this function:

Member Function Documentation

ilMemberExportGUI::confirmDeleteExportFile ( )

Confirm deletion of export files.

public

Parameters

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

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

{
if(!count($_POST['files']))
{
ilUtil::sendInfo($this->lng->txt('ps_select_one'));
$this->show();
return false;
}
$_SESSION['il_del_member_export'] = $_POST['files'];
ilUtil::sendInfo($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'));
$this->fss_export = new ilFSStorageCourse($this->obj_id);
$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 400 of file class.ilMemberExportGUI.php.

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

{
if(!is_array($_SESSION['il_del_member_export']))
{
$this->show();
return false;
}
$this->fss_export = new ilFSStorageCourse($this->obj_id);
$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::sendInfo($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 201 of file class.ilMemberExportGUI.php.

References $_SESSION, and $file.

Referenced by downloadExportFile().

{
$this->fss_export = new ilFSStorageCourse($this->obj_id);
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 316 of file class.ilMemberExportGUI.php.

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

{
if(count($_POST['files']) != 1)
{
ilUtil::sendInfo($this->lng->txt('ps_select_one'));
$this->show();
return true;
}
$this->fss_export = new ilFSStorageCourse($this->obj_id);
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']);
ilUtil::deliverData($contents,date('Y_m_d_H-i'.$file['timest']).
'_member_export_'.
$this->obj_id.
'.csv','text/csv');
return true;
}
}

+ Here is the call graph for this function:

ilMemberExportGUI::executeCommand ( )

Execute Command.

public

Parameters

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

References $cmd, and ilPrivacySettings\_getInstance().

{
global $ilAccess,$rbacsystem;
include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!$ilAccess->checkAccess('write','',$this->ref_id)
or !$privacy->enabledExport()
or !$rbacsystem->checkAccess('export_member_data',$privacy->getPrivacySettingsRefId()))
{
$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 430 of file class.ilMemberExportGUI.php.

References $_SESSION, $filename, $obj_id, ilExportUserSettings\set(), and show().

{
global $ilUser;
// Save settings
$this->exportSettings = new ilExportUserSettings($ilUser->getId(),$this->obj_id);
$this->exportSettings->set($_POST['export_members']);
$this->exportSettings->store();
$this->export = new ilMemberExport($this->ref_id);
$this->export->create();
$this->fss_export = new ilFSStorageCourse($this->obj_id);
$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:

ilMemberExportGUI::show (   $a_deliver_file = false)

Show list of export files.

public

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

References $obj_id, ilCourseDefinedFieldDefinition\_getFields(), ilUserDefinedFields\_getInstance(), ilUtil\formCheckbox(), and showFileList().

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

{
global $ilUser;
$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_TUTOR',$this->lng->txt('ps_export_tutor'));
$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 ilExportUserSettings($ilUser->getId(),$this->obj_id);
$this->tpl->setVariable('CHECK_EXPORT_ADMIN',ilUtil::formCheckbox($this->exportSettings->enabled('admin'),'export_members[admin]',1));
$this->tpl->setVariable('CHECK_EXPORT_TUTOR',ilUtil::formCheckbox($this->exportSettings->enabled('tutor'),'export_members[tutor]',1));
$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'));
// 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'));
$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($course_exp = $udf->getCourseExportableFields() 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_crs_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 224 of file class.ilMemberExportGUI.php.

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

Referenced by show().

{
global $ilUser;
$this->fss_export = new ilFSStorageCourse($this->obj_id);
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.gif"));
$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 45 of file class.ilMemberExportGUI.php.

ilMemberExportGUI::$fields_info
private

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

ilMemberExportGUI::$lng
private

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

Referenced by __construct().

ilMemberExportGUI::$obj_id
private

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

Referenced by export(), and show().

ilMemberExportGUI::$ref_id
private

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

ilMemberExportGUI::$tpl
private

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

Referenced by __construct().


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