ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assFileUploadFileTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 // hey: prevPassSolutions - support file reuse with table
27 private \ILIAS\ResourceStorage\Services $irss;
28 protected $postVar = '';
29 // hey.
30
31 public function __construct($a_parent_obj, $a_parent_cmd, $formname = 'test_output')
32 {
33 global $DIC;
34 $lng = $DIC['lng'];
35 $ilCtrl = $DIC['ilCtrl'];
36
37 $this->lng = $lng;
38 $this->ctrl = $ilCtrl;
39 $this->irss = $DIC->resourceStorage();
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42
43 $this->setFormName($formname);
44 $this->setStyle('table', 'std');
45 $this->addColumn('', 'f', '1%');
46 $this->addColumn($this->lng->txt('filename'), 'filename', '70%');
47 $this->addColumn($this->lng->txt('date'), 'date', '29%');
48 $this->setDisplayAsBlock(true);
49 $this->setPrefix('deletefiles');
50 $this->setSelectAllCheckbox('deletefiles');
51
52 $this->setRowTemplate("tpl.il_as_qpl_fileupload_file_row.html", "components/ILIAS/TestQuestionPool");
53
54 $this->disable('sort');
55 $this->disable('linkbar');
56 $this->enable('header');
57 }
58
59 protected function hasPostVar(): bool
60 {
61 return (bool) strlen($this->getPostVar());
62 }
63
64 public function getPostVar(): string
65 {
66 return $this->postVar;
67 }
68
69 public function setPostVar(string $postVar): void
70 {
71 $this->postVar = $postVar;
72 }
73
74 public function initCommand(string $lang_var, string $cmd, string $post_var): void
75 {
76 if (count($this->getData())) {
77 $this->enable('select_all');
78
79 $this->setSelectAllCheckbox($post_var);
80 $this->setPrefix($post_var);
81 $this->setPostVar($post_var);
82
83 $on_click = "return (function(e){ e.name += '[{$cmd}]';})(this);";
84 $this->addCommandButton($this->parent_cmd, $this->lng->txt($lang_var), $on_click);
85 }
86 }
87
88 public function fillRow(array $a_set): void
89 {
90 $this->tpl->setVariable('VAL_ID', $a_set['solution_id']);
91 $this->tpl->setVariable('VAL_FILE', $this->buildFileItemContent($a_set));
92
93 if ($this->hasPostVar()) {
94 $this->tpl->setVariable('VAL_POSTVAR', $this->getPostVar());
95 }
96
98 $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set["tstamp"], IL_CAL_UNIX)));
99 }
100
101 protected function buildFileItemContent(array $a_set): string
102 {
103 $value = $a_set['value2'];
104 if($value === 'rid') {
105 $rid = $this->irss->manage()->find($a_set['value1']);
106 if($rid === null) {
108 }
109 $value = $this->irss->manage()->getCurrentRevision($rid)->getTitle();
110 }
111
112 if (!isset($a_set['webpath']) || !strlen($a_set['webpath'])) {
114 }
115
116 $link = "<a href='{$a_set['webpath']}{$a_set['value1']}' download target='_blank'>";
117 $link .= ilLegacyFormElementsUtil::prepareFormOutput($value) . '</a>';
118
119 return $link;
120 }
121}
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(string $lang_var, string $cmd, string $post_var)
fillRow(array $a_set)
Standard Version of Fill Row.
ILIAS ResourceStorage Services $irss
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, ?ilObjUser $user=null,)
@classDescription Date and time handling
static prepareFormOutput($a_str, bool $a_strip=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
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)
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)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26