ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
26  global $ilCtrl;
27 
28  $this->ctrl = $ilCtrl;
29 
30  // Call this immediately in constructor
31  $this->setId('mail_attachments');
32 
33  $this->setDefaultOrderDirection('ASC');
34  $this->setDefaultOrderField('filename');
35 
36  parent::__construct($a_parent_obj, $a_parent_cmd);
37 
38  $this->setTitle($this->lng->txt('attachment'));
39  $this->setNoEntriesText($this->lng->txt('marked_entries'));
40 
41  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyFilter'));
42 
43  $this->setSelectAllCheckbox('filename[]');
44 
45  $this->setRowTemplate('tpl.mail_attachment_row.html', 'Services/Mail');
46 
47  $this->addMultiCommand('saveAttachments', $this->lng->txt('adopt'));
48  $this->addMultiCommand('deleteAttachments', $this->lng->txt('delete'));
49 
50  $this->addCommandButton('cancelSaveAttachments', $this->lng->txt('cancel'));
51 
52  $this->addColumn($this->lng->txt(''), '', '1px', true);
53  $this->addColumn($this->lng->txt('mail_file_name'), 'filename');
54  $this->addColumn($this->lng->txt('mail_file_size'), 'filesize');
55  $this->addColumn($this->lng->txt('create_date'), 'filecreatedate');
56  // Show all attachments on one page
57  $this->setLimit(PHP_INT_MAX);
58  }
59 
63  protected function fillRow($a_set)
64  {
68  $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox($a_set['checked'], 'filename[]', urlencode($a_set['filename'])));
69  $this->tpl->setVariable('VAL_FILENAME', $this->formatValue('filename', $a_set['filename']));
70  $this->tpl->setVariable('VAL_FILESIZE', $this->formatValue('filesize', $a_set['filesize']));
71  $this->tpl->setVariable('VAL_FILECREATEDATE', $this->formatValue('filecreatedate', $a_set['filecreatedate']));
72  }
73 
78  public function numericOrdering($column)
79  {
80  if($column == 'filesize' || $column == 'filecreatedate') return true;
81 
82  return false;
83  }
84 
90  protected function formatValue($column, $value)
91  {
92  switch($column)
93  {
94  case 'filecreatedate':
96 
97  case 'filesize':
98  return ilUtil::formatSize($value);
99 
100  default:
101  return $value;
102  }
103  }
104 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
const IL_CAL_UNIX
setNoEntriesText($a_text)
Set text for an empty table.
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.
$column
Definition: 39dropdown.php:62
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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 formCheckbox($checked, $varname, $value, $disabled=false)
??? public
setLimit($a_limit=0, $a_default_limit=0)