ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.assFileUploadFileTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('./Services/Table/classes/class.ilTable2GUI.php');
5 
16 {
17  // hey: prevPassSolutions - support file reuse with table
18  protected $postVar = '';
19  // hey.
20 
28  public function __construct($a_parent_obj, $a_parent_cmd, $formname = 'test_output')
29  {
30  global $DIC;
31  $lng = $DIC['lng'];
32  $ilCtrl = $DIC['ilCtrl'];
33 
34  $this->lng = $lng;
35  $this->ctrl = $ilCtrl;
36 
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38 
39  $this->setFormName($formname);
40  $this->setStyle('table', 'std');
41  $this->addColumn('', 'f', '1%');
42  $this->addColumn($this->lng->txt('filename'), 'filename', '70%');
43  $this->addColumn($this->lng->txt('date'), 'date', '29%');
44  $this->setDisplayAsBlock(true);
45 
46  // hey: prevPassSolutions - configure table with initCommand()
47  $this->setPrefix('deletefiles');
48  $this->setSelectAllCheckbox('deletefiles');
49  // hey.
50 
51  $this->setRowTemplate("tpl.il_as_qpl_fileupload_file_row.html", "Modules/TestQuestionPool");
52 
53  $this->disable('sort');
54  $this->disable('linkbar');
55  $this->enable('header');
56  // hey: prevPassSolutions - configure table with initCommand()
57  #$this->enable('select_all');
58  // hey.
59  }
60 
61  // hey: prevPassSolutions - support file reuse with table
65  protected function hasPostVar()
66  {
67  return (bool) strlen($this->getPostVar());
68  }
69 
73  public function getPostVar()
74  {
75  return $this->postVar;
76  }
77 
81  public function setPostVar($postVar)
82  {
83  $this->postVar = $postVar;
84  }
85  // hey.
86 
87  // hey: prevPassSolutions - support file reuse with table
89  {
90  if (count($this->getData())) {
91  $this->enable('select_all');
92 
94  $this->setPrefix($postVar);
95  $this->setPostVar($postVar);
96 
97  $commandButton->setCommand($this->parent_cmd);
98  $this->addCommandButtonInstance($commandButton);
99  }
100  }
101  // hey.
102 
110  public function fillRow($a_set)
111  {
112  global $DIC;
113  $ilUser = $DIC['ilUser'];
114  $ilAccess = $DIC['ilAccess'];
115 
116  $this->tpl->setVariable('VAL_ID', $a_set['solution_id']);
117  // hey: prevPassSolutions - support file reuse with table
118  $this->tpl->setVariable('VAL_FILE', $this->buildFileItemContent($a_set));
119 
120  if ($this->hasPostVar()) {
121  $this->tpl->setVariable('VAL_POSTVAR', $this->getPostVar());
122  }
123  // hey.
125  $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set["tstamp"], IL_CAL_UNIX)));
126  }
127 
128  // hey: prevPassSolutions - support file reuse with table
132  protected function buildFileItemContent($a_set)
133  {
134  if (!isset($a_set['webpath']) || !strlen($a_set['webpath'])) {
135  return ilUtil::prepareFormOutput($a_set['value2']);
136  }
137 
138  $link = "<a href='{$a_set['webpath']}{$a_set['value1']}' download target='_blank'>";
139  $link .= ilUtil::prepareFormOutput($a_set['value2']) . '</a>';
140 
141  return $link;
142  }
143  // hey.
144 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
addCommandButtonInstance(ilButtonBase $a_button)
Add Command button instance.
initCommand(ilAssFileUploadFileTableCommandButton $commandButton, $postVar)
setStyle($a_element, $a_style)
setDisplayAsBlock($a_val)
Set display as block.
__construct($a_parent_obj, $a_parent_cmd, $formname='test_output')
Constructor.
global $DIC
Definition: saml.php:7
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $ilCtrl
Definition: ilias.php:18
setCommand($a_value)
Set submit command.
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.
enable($a_module_name)
enables particular modules of table
setPrefix($a_prefix)
Date and time handling
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
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.