ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLMDownloadTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
15{
19 protected $ctrl;
20
24 protected $tpl;
25
29 protected $lng;
30
34 protected $lm;
35
39 public function __construct($a_parent_obj, $a_parent_cmd, ilObjLearningModule $a_lm)
40 {
41 global $DIC;
42
43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $this->tpl = $DIC["tpl"];
46 $this->lm = $a_lm;
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $this->setData($this->lm->getPublicExportFiles());
50 $this->setTitle($this->lng->txt("download"));
51
52 $this->addColumn($this->lng->txt("cont_format"));
53 $this->addColumn($this->lng->txt("cont_file"));
54 $this->addColumn($this->lng->txt("size"));
55 $this->addColumn($this->lng->txt("date"));
56 $this->addColumn($this->lng->txt("action"));
57 $this->disable("footer");
58 $this->setMaxCount(9999);
59
60 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
61 $this->setRowTemplate("tpl.download_file_row.html", "Modules/LearningModule");
62 }
63
67 public function getDownloadFiles()
68 {
69 $this->setData($this->lm->getPublicExportFiles());
70 }
71
72
76 protected function fillRow($a_set)
77 {
78 $this->tpl->setVariable("TXT_FILENAME", $a_set["file"]);
79
80 $this->tpl->setVariable("TXT_SIZE", ilUtil::formatSize($a_set["size"]));
81 $this->tpl->setVariable("TXT_FORMAT", strtoupper($a_set["type"]));
82 $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["file"]);
83
84 $file_arr = explode("__", $a_set["file"]);
86 $this->tpl->setVariable("TXT_DATE", ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)));
87
88 $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
89 $this->ctrl->setParameter($this->parent_obj, "type", $a_set["dir_type"]);
90 $this->tpl->setVariable(
91 "LINK_DOWNLOAD",
92 $this->ctrl->getLinkTarget($this->parent_obj, "downloadExportFile")
93 );
94
95 $this->tpl->parseCurrentBlock();
96 }
97}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
TableGUI class for lm download files.
__construct($a_parent_obj, $a_parent_cmd, ilObjLearningModule $a_lm)
Constructor.
getDownloadFiles()
Get download files.
fillRow($a_set)
Fill table row.
Class ilObjLearningModule.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setMaxCount($a_max_count)
set max.
disable($a_module_name)
diesables particular modules of table
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46