ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.assFileUploadFileTableGUI.php
Go to the documentation of this file.
1<?php
2
29{
30 // hey: prevPassSolutions - support file reuse with table
31 protected $postVar = '';
32 // hey.
33
34 public function __construct($a_parent_obj, $a_parent_cmd, $formname = 'test_output')
35 {
36 global $DIC;
37 $lng = $DIC['lng'];
38 $ilCtrl = $DIC['ilCtrl'];
39
40 $this->lng = $lng;
41 $this->ctrl = $ilCtrl;
42
43 parent::__construct($a_parent_obj, $a_parent_cmd);
44
45 $this->setFormName($formname);
46 $this->setStyle('table', 'std');
47 $this->addColumn('', 'f', '1%');
48 $this->addColumn($this->lng->txt('filename'), 'filename', '70%');
49 $this->addColumn($this->lng->txt('date'), 'date', '29%');
50 $this->setDisplayAsBlock(true);
51
52 // hey: prevPassSolutions - configure table with initCommand()
53 $this->setPrefix('deletefiles');
54 $this->setSelectAllCheckbox('deletefiles');
55 // hey.
56
57 $this->setRowTemplate("tpl.il_as_qpl_fileupload_file_row.html", "Modules/TestQuestionPool");
58
59 $this->disable('sort');
60 $this->disable('linkbar');
61 $this->enable('header');
62 // hey: prevPassSolutions - configure table with initCommand()
63 #$this->enable('select_all');
64 // hey.
65 }
66
67 // hey: prevPassSolutions - support file reuse with table
71 protected function hasPostVar(): bool
72 {
73 return (bool) strlen($this->getPostVar());
74 }
75
79 public function getPostVar(): string
80 {
81 return $this->postVar;
82 }
83
87 public function setPostVar($postVar): void
88 {
89 $this->postVar = $postVar;
90 }
91 // hey.
92
93 // hey: prevPassSolutions - support file reuse with table
94 public function initCommand(ilAssFileUploadFileTableCommandButton $commandButton, $postVar): void
95 {
96 if (count($this->getData())) {
97 $this->enable('select_all');
98
100 $this->setPrefix($postVar);
101 $this->setPostVar($postVar);
102
103 $commandButton->setCommand($this->parent_cmd);
104 $this->addCommandButtonInstance($commandButton);
105 }
106 }
107 // hey.
108
115 public function fillRow(array $a_set): void
116 {
117 global $DIC;
118 $ilUser = $DIC['ilUser'];
119 $ilAccess = $DIC['ilAccess'];
120
121 $this->tpl->setVariable('VAL_ID', $a_set['solution_id']);
122 // hey: prevPassSolutions - support file reuse with table
123 $this->tpl->setVariable('VAL_FILE', $this->buildFileItemContent($a_set));
124
125 if ($this->hasPostVar()) {
126 $this->tpl->setVariable('VAL_POSTVAR', $this->getPostVar());
127 }
128 // hey.
130 $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set["tstamp"], IL_CAL_UNIX)));
131 }
132
133 // hey: prevPassSolutions - support file reuse with table
137 protected function buildFileItemContent($a_set): string
138 {
139 if (!isset($a_set['webpath']) || !strlen($a_set['webpath'])) {
140 return ilLegacyFormElementsUtil::prepareFormOutput($a_set['value2']);
141 }
142
143 $link = "<a href='{$a_set['webpath']}{$a_set['value1']}' download target='_blank'>";
144 $link .= ilLegacyFormElementsUtil::prepareFormOutput($a_set['value2']) . '</a>';
145
146 return $link;
147 }
148 // hey.
149}
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($a_parent_obj, $a_parent_cmd, $formname='test_output')
initCommand(ilAssFileUploadFileTableCommandButton $commandButton, $postVar)
fillRow(array $a_set)
fill row @access public
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static prepareFormOutput($a_str, bool $a_strip=false)
setCommand(string $a_value)
Set submit command.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormName(string $a_name="")
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
addCommandButtonInstance(ilButtonBase $a_button)
setDisplayAsBlock(bool $a_val)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
ilLanguage $lng
enable(string $a_module_name)
setStyle(string $a_element, string $a_style)
disable(string $a_module_name)
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc