ILIAS  release_8 Revision v8.24
class.ilBadgeImageTemplateTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
25 protected bool $has_write;
26
27 public function __construct(
28 object $a_parent_obj,
29 string $a_parent_cmd = "",
30 bool $a_has_write = false
31 ) {
32 global $DIC;
33
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 $ilCtrl = $DIC->ctrl();
37 $lng = $DIC->language();
38
39 $this->setId("bdgtmpl");
40 $this->has_write = $a_has_write;
41
42 parent::__construct($a_parent_obj, $a_parent_cmd);
43
44 $this->setLimit(9999);
45
46 $this->setTitle($lng->txt("badge_image_templates"));
47
48 if ($this->has_write) {
49 $this->addColumn("", "", 1);
50 }
51
52 $this->addColumn($lng->txt("title"), "title");
53 $this->addColumn($lng->txt("image"), "image");
54
55 if ($this->has_write) {
56 $this->addColumn($lng->txt("action"), "");
57 $this->addMultiCommand("confirmDeleteImageTemplates", $lng->txt("delete"));
58 }
59
60 $this->setSelectAllCheckbox("id");
61
62 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
63 $this->setRowTemplate("tpl.template_row.html", "Services/Badge");
64 $this->setDefaultOrderField("title");
65
66 $this->getItems();
67 }
68
69 public function getItems(): void
70 {
71 $data = array();
72
73 foreach (ilBadgeImageTemplate::getInstances() as $template) {
74 $data[] = array(
75 "id" => $template->getId(),
76 "title" => $template->getTitle(),
77 "path" => $template->getImagePath(),
78 "file" => $template->getImage()
79 );
80 }
81
82 $this->setData($data);
83 }
84
85 protected function fillRow(array $a_set): void
86 {
88 $ilCtrl = $this->ctrl;
89
90 if ($this->has_write) {
91 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
92 }
93
94 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
95 $this->tpl->setVariable("VAL_IMG", ilWACSignedPath::signFile($a_set["path"]));
96 $this->tpl->setVariable("TXT_IMG", $a_set["file"]);
97
98 if ($this->has_write) {
99 $ilCtrl->setParameter($this->getParentObject(), "tid", $a_set["id"]);
100 $url = $ilCtrl->getLinkTarget($this->getParentObject(), "editImageTemplate");
101 $ilCtrl->setParameter($this->getParentObject(), "tid", "");
102
103 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
104 $this->tpl->setVariable("URL_EDIT", $url);
105 }
106 }
107}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd="", bool $a_has_write=false)
fillRow(array $a_set)
Standard Version of Fill Row.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
static signFile(string $path_to_file)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url