ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 require_once 'Services/Table/classes/class.ilTable2GUI.php';
5 
11 {
15  protected $ctrl;
16 
21  public function __construct($a_parent_obj, $a_parent_cmd)
22  {
23  global $DIC;
24 
25  $this->ctrl = $DIC->ctrl();
26 
27  // Call this immediately in constructor
28  $this->setId('mail_attachments');
29 
30  $this->setDefaultOrderDirection('ASC');
31  $this->setDefaultOrderField('filename');
32 
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 
35  $this->setTitle($this->lng->txt('attachment'));
36  $this->setNoEntriesText($this->lng->txt('marked_entries'));
37 
38  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyFilter'));
39 
40  $this->setSelectAllCheckbox('filename[]');
41 
42  $this->setRowTemplate('tpl.mail_attachment_row.html', 'Services/Mail');
43 
44  $this->addMultiCommand('saveAttachments', $this->lng->txt('adopt'));
45  $this->addMultiCommand('deleteAttachments', $this->lng->txt('delete'));
46 
47  $this->addCommandButton('cancelSaveAttachments', $this->lng->txt('cancel'));
48 
49  $this->addColumn($this->lng->txt(''), '', '1px', true);
50  $this->addColumn($this->lng->txt('mail_file_name'), 'filename');
51  $this->addColumn($this->lng->txt('mail_file_size'), 'filesize');
52  $this->addColumn($this->lng->txt('create_date'), 'filecreatedate');
53  // Show all attachments on one page
54  $this->setLimit(PHP_INT_MAX);
55  }
56 
60  protected function fillRow($a_set)
61  {
65  $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox($a_set['checked'], 'filename[]', urlencode($a_set['filename'])));
66  $this->tpl->setVariable('VAL_FILENAME', $this->formatValue('filename', $a_set['filename']));
67  $this->tpl->setVariable('VAL_FILESIZE', $this->formatValue('filesize', $a_set['filesize']));
68  $this->tpl->setVariable('VAL_FILECREATEDATE', $this->formatValue('filecreatedate', $a_set['filecreatedate']));
69  }
70 
75  public function numericOrdering($column)
76  {
77  if ($column == 'filesize' || $column == 'filecreatedate') {
78  return true;
79  }
80 
81  return false;
82  }
83 
89  protected function formatValue($column, $value)
90  {
91  switch ($column) {
92  case 'filecreatedate':
94 
95  case 'filesize':
96  return ilUtil::formatSize($value);
97 
98  default:
99  return $value;
100  }
101  }
102 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct($a_parent_obj, $a_parent_cmd)
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
setNoEntriesText($a_text)
Set text for an empty table.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
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.
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.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
setLimit($a_limit=0, $a_default_limit=0)