ILIAS  release_4-3 Revision
 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  }
58 
62  protected function fillRow(Array $file_data)
63  {
67  $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox($file_data['checked'], 'filename[]', urlencode($file_data['filename'])));
68  $this->tpl->setVariable('VAL_FILENAME', $this->formatValue('filename', $file_data['filename']));
69  $this->tpl->setVariable('VAL_FILESIZE', $this->formatValue('filesize', $file_data['filesize']));
70  $this->tpl->setVariable('VAL_FILECREATEDATE', $this->formatValue('filecreatedate', $file_data['filecreatedate']));
71  }
72 
77  public function numericOrdering($column)
78  {
79  if($column == 'filesize' || $column == 'filecreatedate') return true;
80 
81  return false;
82  }
83 
89  protected function formatValue($column, $value)
90  {
91  switch($column)
92  {
93  case 'filecreatedate':
95 
96  case 'filesize':
97  return ilFormat::formatSize($value);
98 
99  default:
100  return $value;
101  }
102  }
103 }