ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilUserExportFileTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14{
15 private const USER_EXPORT_TABLE_ID = 'usr_export_table';
16 private const USER_EXPORT_FORM_NAME = 'usr_export_form';
17
21 private $logger = null;
22
23 public function __construct($a_parent_obj, $a_parent_cmd = "", $a_template_context = "")
24 {
25 global $DIC;
26
27 $this->setId(self::USER_EXPORT_TABLE_ID);
28 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
29
30 $this->logger = $DIC->logger()->user();
31
32 }
33
37 public function init()
38 {
39 $this->lng->loadLanguageModule('usr');
40 $this->setFormName(self::USER_EXPORT_FORM_NAME);
41 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(),$this->getParentCmd()));
42
43 $this->addColumn('','');
44 $this->addColumn($this->lng->txt('userfolder_export_file'),'file', '50%');
45 $this->addColumn($this->lng->txt('userfolder_export_file_size'),'size_sort','25%');
46 $this->addColumn($this->lng->txt('date'),'dt_sort','25%');
47
48
49 $this->setDefaultOrderField('dt');
50 $this->setDefaultOrderDirection('desc');
51
52 $this->setRowTemplate('tpl.usr_export_file_row.html','Services/User');
54
55 $this->addMultiCommand(
56 'downloadExportFile',
57 $this->lng->txt('download')
58 );
59
60 $this->addMultiCommand(
61 'confirmDeleteExportFile',
62 $this->lng->txt('delete')
63 );
64 $this->setSelectAllCheckbox('file');
65 $this->enable('num_info');
66 }
67
72 public function numericOrdering($a_field)
73 {
74 switch ($a_field) {
75 case 'size_sort':
76 case 'dt_sort':
77 return true;
78 }
79 return false;
80 }
81
85 protected function fillRow($row)
86 {
87 $this->tpl->setVariable('CHECKBOX_ID', $row['file']);
88 $this->tpl->setVariable('TXT_FILENAME', $row['file']);
89 $this->tpl->setVariable('TXT_SIZE', $row['size']);
90 $this->tpl->setVariable('TXT_DATE', $row['date']);
91 }
92
96 public function parse(array $export_files)
97 {
98 $files = [];
99 $counter = 0;
100 foreach ($export_files as $num => $file_info) {
101
102 $this->logger->dump($file_info, \ilLogLevel::NOTICE);
103
104 $file_info_parts = explode('_', $file_info['filename']);
105 $dt = $file_info_parts[0];
106
107 $dt_obj = new \ilDateTime($dt,IL_CAL_UNIX);
108
109 $files[$counter]['file'] = $file_info['filename'];
110 $files[$counter]['size'] = $file_info['filesize'];
111 $files[$counter]['size_sort'] = $file_info['filesize'];
112 $files[$counter]['date'] = \ilDatePresentation::formatDate($dt_obj);
113 $files[$counter]['dt_sort'] = $dt;
114 ++$counter;
115 }
116
117 $this->logger->dump($files, \ilLogLevel::NOTICE);
118 $this->setData($files);
119 }
120
121}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
Class ilTable2GUI.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
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.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
enable($a_module_name)
enables particular modules of table
User export file table Should be replaced in the future by standard export file handling.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc