ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSCORMMediaOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2021 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
11{
15 protected $ctrl;
16
20 protected $lng;
21
25 protected $ui;
26
30 function __construct($a_parent_obj, $a_parent_cmd)
31 {
32 global $DIC;
33
34 $this->id = "sahs_sco_media";
35 $this->lng = $DIC->language();
36 $this->ctrl = $DIC->ctrl();
37 $this->ui = $DIC->ui();
38
39 parent::__construct($a_parent_obj, $a_parent_cmd);
40
41 $this->setTitle($this->lng->txt("cont_files"));
42
43 $this->addColumn($this->lng->txt("cont_format"));
44 $this->addColumn($this->lng->txt("cont_file"));
45 $this->addColumn($this->lng->txt("size"));
46 $this->addColumn($this->lng->txt("date"));
47 $this->addColumn($this->lng->txt("actions"));
48
49 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
50 $this->setRowTemplate("tpl.media_overview_row.html", "Modules/Scorm2004/Editor");
51 }
52
56 protected function fillRow($a_set)
57 {
60 $ui = $this->ui;
62
63 $tpl->setVariable("FILE", $a_set["file"]);
64 $tpl->setVariable("SIZE", $a_set["size"]);
65 $tpl->setVariable("FORMAT", $a_set["type"]);
66
67 $tpl->setVariable("DATE", $a_set["date"]);
68
69 if ($a_set["size"] > 0) {
70 $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
71 $ctrl->setParameter($this->parent_obj, "resource", rawurlencode($a_set["path"]));
72 $ctrl->setParameter($this->parent_obj, "file_id", rawurlencode($a_set["file_id"]));
73 $link = $ui->factory()->link()->standard(
74 $lng->txt("download"),
75 $ctrl->getLinkTarget($this->parent_obj, "downloadResource")
76 );
77 } else {
78 $link = $ui->factory()->link()->standard(
79 $lng->txt("show"),
80 $a_set["path"]
81 )->withOpenInNewViewport(true);
82 }
83 $tpl->setVariable(
84 "DOWNLOAD",
85 $ui->renderer()->render($link)
86 );
87 }
88}
An exception for terminatinating execution or to throw for unit testing.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
ui()
Definition: ui.php:5