43 $this->
setId(self::class);
45 $this->file = $calling_gui_class->
getFile();
46 $this->current_version = (int) $this->file->getVersion();
47 $this->max_version = (int) $this->file->getMaxVersion();
48 $this->has_been_migrated = !is_null($calling_gui_class->
getFile()->getResourceId());
52 $this->dic->language()->loadLanguageModule(
'file');
55 $this->
setRowTemplate(
"tpl.file_version_row.html",
"Modules/File");
59 $this->
setTitle($this->dic->language()->txt(
"versions"));
62 if ($this->has_been_migrated) {
63 $this->
setFormAction($this->dic->ctrl()->getFormAction($calling_gui_class));
67 $this->dic->language()->txt(
"file_rollback"));
72 $this->
addColumn($this->dic->language()->txt(
"version"),
"",
"auto");
73 $this->
addColumn($this->dic->language()->txt(
"date"));
74 $this->
addColumn($this->dic->language()->txt(
"file_uploaded_by"));
75 $this->
addColumn($this->dic->language()->txt(
"filename"));
76 $this->
addColumn($this->dic->language()->txt(
"versionname"));
77 $this->
addColumn($this->dic->language()->txt(
"filesize"),
"",
"",
false);
78 $this->
addColumn($this->dic->language()->txt(
"type"));
79 $this->
addColumn($this->dic->language()->txt(
"action"));
88 foreach ($this->file->getVersions() as $version) {
89 $versions[] = $version->getArrayCopy();
91 usort($versions,
static function (array $i1, array $i2) :
bool {
92 return $i1[
'version'] < $i2[
'version'];
96 $this->
setMaxCount(is_array($versions) ? count($versions) : 0);
101 $hist_id = $a_set[
"hist_entry_id"];
105 $version = $a_set[
"version"];
106 $rollback_version = $a_set[
"rollback_version"];
107 $rollback_user_id = $a_set[
"rollback_user_id"];
111 $username = trim(
$name[
"title"] .
" " .
$name[
"firstname"] .
" " .
$name[
"lastname"]);
114 $filesize = $a_set[
"size"];
117 $action = $this->dic->language()->txt(
"file_version_" . $a_set[
"action"]);
118 if ($a_set[
"action"] ==
"rollback") {
120 $rollback_username = trim($name[
"title"] .
" " . $name[
"firstname"] .
" " . $name[
"lastname"]);
121 $action = sprintf($action, $rollback_version, $rollback_username);
130 $actions->setId($hist_id);
131 $actions->setListTitle($this->dic->language()->txt(
"actions"));
132 $actions->addItem($this->dic->language()->txt(
"delete"),
"",
134 if ($this->current_version !== (
int) $version) {
135 $actions->addItem($this->dic->language()->txt(
"file_rollback"),
"",
143 $this->tpl->setVariable(
"TXT_VERSION", $version);
144 $this->tpl->setVariable(
"TXT_DATE",
146 $this->tpl->setVariable(
"TXT_UPLOADED_BY", $username);
147 $this->tpl->setVariable(
"DL_LINK", $link);
148 $this->tpl->setVariable(
"TXT_FILENAME",
$filename);
149 $this->tpl->setVariable(
"TXT_VERSIONNAME", $a_set[
'title']);
154 if (!$this->has_been_migrated) {
155 $this->tpl->setVariable(
"DISABLED",
'disabled');
158 $this->tpl->setCurrentBlock(
"version_selection");
159 $this->tpl->setVariable(
"OBJ_ID", $hist_id);
160 $this->tpl->parseCurrentBlock();
162 $this->tpl->setCurrentBlock(
"version_txt_actions");
163 $this->tpl->setVariable(
"TXT_ACTION", $action);
164 $this->tpl->parseCurrentBlock();
166 $this->tpl->setCurrentBlock(
"version_actions");
167 if ($this->has_been_migrated) {
168 $this->tpl->setVariable(
"ACTIONS", $actions->getHTML());
170 $this->tpl->setVariable(
"ACTIONS",
" ");
172 $this->tpl->parseCurrentBlock();
static _lookupName($a_user_id)
lookup user name
const CMD_DELETE_VERSIONS
__construct(ilFileVersionsGUI $calling_gui_class, $a_parent_cmd=ilFileVersionsGUI::CMD_DEFAULT)
ilFileVersionsTableGUI constructor.
const CMD_DOWNLOAD_VERSION
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
Class ilFileVersionsTableGUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
__construct(Container $dic, ilPlugin $plugin)
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.
setEnableHeader($a_enableheader)
Set Enable Header.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
const CMD_ROLLBACK_VERSION
setMaxCount($a_max_count)
set max.
setLimit($a_limit=0, $a_default_limit=0)