ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMemberExportFileTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
14  public function __construct($a_parent_obj, $a_parent_cmd, $a_fss_export)
15  {
16  global $DIC;
17 
18  $ilCtrl = $DIC['ilCtrl'];
19 
20  $this->setId('memexp');
21 
22  parent::__construct($a_parent_obj, $a_parent_cmd);
23 
24  $this->setTitle($this->lng->txt('ps_export_files'));
25 
26  $this->addColumn('', '', 1);
27  $this->addColumn($this->lng->txt('type'), 'type');
28  $this->addColumn($this->lng->txt('ps_size'), 'size');
29  $this->addColumn($this->lng->txt('date'), 'date');
30  $this->addColumn($this->lng->txt('action'), '');
31 
32  $this->setDefaultOrderField('date');
33  $this->setDefaultOrderDirection('desc');
34 
35  $this->setRowTemplate('tpl.mem_export_file_row.html', 'Services/Membership');
36  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
37  $this->addMultiCommand('confirmDeleteExportFile', $this->lng->txt('delete'));
38 
39  $this->setSelectAllCheckbox('id[]');
40 
41  $this->getFiles($a_fss_export);
42  }
43 
44  public function numericOrdering($a_field)
45  {
46  return in_array($a_field, array('size', 'date'));
47  }
48 
49  protected function getFiles($a_fss_export)
50  {
51  $data = array();
52 
53  foreach ($a_fss_export->getMemberExportFiles() as $exp_file) {
54  $data[] = array(
55  'id' => md5($exp_file['name']),
56  'type' => strtoupper($exp_file["type"]),
57  'date' => $exp_file['timest'],
58  'size' => $exp_file['size']
59  );
60  }
61 
62  $this->setData($data);
63  }
64 
65  public function fillRow($a_set)
66  {
67  global $DIC;
68 
69  $ilCtrl = $DIC['ilCtrl'];
70 
71  $this->tpl->setVariable('VAL_ID', $a_set['id']);
72  $this->tpl->setVariable('VAL_TYPE', $a_set['type']);
73  $this->tpl->setVariable('VAL_SIZE', ilUtil::formatSize($a_set['size']));
74  $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['date'], IL_CAL_UNIX)));
75 
76  $ilCtrl->setParameter($this->getParentObject(), 'fl', $a_set['id']);
77  $url = $ilCtrl->getLinkTarget($this->getParentObject(), 'downloadExportFile');
78  $ilCtrl->setParameter($this->getParentObject(), 'fl', '');
79 
80  $this->tpl->setVariable('URL_DOWNLOAD', $url);
81  $this->tpl->setVariable('TXT_DOWNLOAD', $this->lng->txt('download'));
82  }
83 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
getParentCmd()
Get parent command.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, $a_fss_export)
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
addMultiCommand($a_cmd, $a_text)
Add Command button.
Date and time handling
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Table presentation of membership export files.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
$url
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.