ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 require_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 }