ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAdvancedMDRecordExportFilesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
33 include_once('Services/Table/classes/class.ilTable2GUI.php');
34 
36 {
45  public function __construct($a_parent_obj, $a_parent_cmd = '')
46  {
47  global $DIC;
48 
49  $lng = $DIC['lng'];
50  $ilCtrl = $DIC['ilCtrl'];
51 
52  $this->lng = $lng;
53  $this->ctrl = $ilCtrl;
54 
55  parent::__construct($a_parent_obj, $a_parent_cmd);
56  $this->addColumn('', 'f', 1);
57  $this->addColumn($this->lng->txt('md_adv_records'), 'records', "33%");
58  $this->addColumn($this->lng->txt('date'), 'date', "33%");
59  $this->addColumn($this->lng->txt('filesize'), 'file_size', "33%");
60 
61  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
62  $this->setRowTemplate("tpl.edit_files_row.html", "Services/AdvancedMetaData");
63  $this->setDefaultOrderField("date");
64  $this->setDefaultOrderDirection('desc');
65  }
66 
67 
75  public function fillRow($a_set)
76  {
77  $this->tpl->setVariable('VAL_ID', $a_set['id']);
78  $this->tpl->setVariable('VAL_SIZE', sprintf("%.1f KB", $a_set['file_size'] / 1024));
79  $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['date'], IL_CAL_UNIX)));
80 
81  foreach ($a_set['record_arr'] as $title) {
82  $this->tpl->setCurrentBlock('record_title');
83  $this->tpl->setVariable('REC_TITLE', $title);
84  $this->tpl->parseCurrentBlock();
85  }
86  }
94  public function parseFiles($a_file_data)
95  {
96  foreach ($a_file_data as $id => $data) {
97  $tmp_arr['id'] = $id;
98  $tmp_arr['records'] = implode(', ', $data['name']);
99  $tmp_arr['date'] = $data['date'];
100  $tmp_arr['file_size'] = $data['size'] . ' ' . $this->lng->txt('bytes');
101  $tmp_arr['record_arr'] = $data['name'];
102  $defs_arr[] = $tmp_arr;
103  }
104  $this->setData($defs_arr ? $defs_arr : array());
105  }
106 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
Date and time handling
__construct($a_parent_obj, $a_parent_cmd='')
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.