ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  protected $ctrl;
21 
25  protected $tpl;
26 
30  protected $lng;
31 
35  protected $lm;
36 
40  public function __construct($a_parent_obj, $a_parent_cmd, ilObjLearningModule $a_lm)
41  {
42  global $DIC;
43 
44  $this->ctrl = $DIC->ctrl();
45  $this->lng = $DIC->language();
46  $this->tpl = $DIC["tpl"];
47  $this->lm = $a_lm;
48 
49  parent::__construct($a_parent_obj, $a_parent_cmd);
50  $this->setData($this->lm->getPublicExportFiles());
51  $this->setTitle($this->lng->txt("download"));
52 
53  $this->addColumn($this->lng->txt("cont_format"));
54  $this->addColumn($this->lng->txt("cont_file"));
55  $this->addColumn($this->lng->txt("size"));
56  $this->addColumn($this->lng->txt("date"));
57  $this->addColumn($this->lng->txt("action"));
58  $this->disable("footer");
59  $this->setMaxCount(9999);
60 
61  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
62  $this->setRowTemplate("tpl.download_file_row.html", "Modules/LearningModule");
63  }
64 
68  public function getDownloadFiles()
69  {
70  $this->setData($this->lm->getPublicExportFiles());
71  }
72 
73 
77  protected function fillRow($a_set)
78  {
79  $this->tpl->setVariable("TXT_FILENAME", $a_set["file"]);
80 
81  $this->tpl->setVariable("TXT_SIZE", ilUtil::formatSize($a_set["size"]));
82  $this->tpl->setVariable("TXT_FORMAT", strtoupper($a_set["type"]));
83  $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["file"]);
84 
85  $file_arr = explode("__", $a_set["file"]);
87  $this->tpl->setVariable("TXT_DATE", ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)));
88 
89  $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
90  $this->ctrl->setParameter($this->parent_obj, "type", $a_set["dir_type"]);
91  $this->tpl->setVariable(
92  "LINK_DOWNLOAD",
93  $this->ctrl->getLinkTarget($this->parent_obj, "downloadExportFile")
94  );
95 
96  $this->tpl->parseCurrentBlock();
97  }
98 }
getDownloadFiles()
Get download files.
Class ilObjLearningModule.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
TableGUI class for lm download files.
Date and time handling
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
fillRow($a_set)
Fill table row.
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.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
__construct($a_parent_obj, $a_parent_cmd, ilObjLearningModule $a_lm)
Constructor.
setMaxCount($a_max_count)
set max.