ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilMailAttachmentTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5require_once 'Services/Calendar/classes/class.ilDatePresentation.php';
6
12{
16 protected $ctrl;
17
22 public function __construct($a_parent_obj, $a_parent_cmd)
23 {
27 global $ilCtrl;
28
29 $this->ctrl = $ilCtrl;
30
31 // Call this immediately in constructor
32 $this->setId('mail_attachments');
33
34 $this->setDefaultOrderDirection('ASC');
35 $this->setDefaultOrderField('filename');
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38
39 $this->setTitle($this->lng->txt('attachment'));
40 $this->setNoEntriesText($this->lng->txt('marked_entries'));
41
42 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyFilter'));
43
44 $this->setSelectAllCheckbox('filename[]');
45
46 $this->setRowTemplate('tpl.mail_attachment_row.html', 'Services/Mail');
47
48 $this->addMultiCommand('saveAttachments', $this->lng->txt('adopt'));
49 $this->addMultiCommand('deleteAttachments', $this->lng->txt('delete'));
50
51 $this->addCommandButton('cancelSaveAttachments', $this->lng->txt('cancel'));
52
53 $this->addColumn($this->lng->txt(''), '', '1px', true);
54 $this->addColumn($this->lng->txt('mail_file_name'), 'filename');
55 $this->addColumn($this->lng->txt('mail_file_size'), 'filesize');
56 $this->addColumn($this->lng->txt('create_date'), 'filecreatedate');
57 // Show all attachments on one page
58 $this->setLimit(PHP_INT_MAX);
59 }
60
64 protected function fillRow(Array $file_data)
65 {
69 $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox($file_data['checked'], 'filename[]', urlencode($file_data['filename'])));
70 $this->tpl->setVariable('VAL_FILENAME', $this->formatValue('filename', $file_data['filename']));
71 $this->tpl->setVariable('VAL_FILESIZE', $this->formatValue('filesize', $file_data['filesize']));
72 $this->tpl->setVariable('VAL_FILECREATEDATE', $this->formatValue('filecreatedate', $file_data['filecreatedate']));
73 }
74
79 public function numericOrdering($column)
80 {
81 if($column == 'filesize' || $column == 'filecreatedate') return true;
82
83 return false;
84 }
85
91 protected function formatValue($column, $value)
92 {
93 switch($column)
94 {
95 case 'filecreatedate':
97
98 case 'filesize':
99 return ilFormat::formatSize($value);
100
101 default:
102 return $value;
103 }
104 }
105}
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setNoEntriesText($a_text)
Set text for an empty table.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
global $ilCtrl
Definition: ilias.php:18