ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilBadgeImageTemplateTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
12{
16 protected $ctrl;
17
18 protected $has_write; // [bool]
19
20 public function __construct($a_parent_obj, $a_parent_cmd = "", $a_has_write = false)
21 {
22 global $DIC;
23
24 $this->ctrl = $DIC->ctrl();
25 $this->lng = $DIC->language();
26 $ilCtrl = $DIC->ctrl();
27 $lng = $DIC->language();
28
29 $this->setId("bdgtmpl");
30 $this->has_write = (bool) $a_has_write;
31
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33
34 $this->setLimit(9999);
35
36 $this->setTitle($lng->txt("badge_image_templates"));
37
38 if ($this->has_write) {
39 $this->addColumn("", "", 1);
40 }
41
42 $this->addColumn($lng->txt("title"), "title");
43 $this->addColumn($lng->txt("image"), "image");
44
45 if ($this->has_write) {
46 $this->addColumn($lng->txt("action"), "");
47 $this->addMultiCommand("confirmDeleteImageTemplates", $lng->txt("delete"));
48 }
49
50 $this->setSelectAllCheckbox("id");
51
52 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
53 $this->setRowTemplate("tpl.template_row.html", "Services/Badge");
54 $this->setDefaultOrderField("title");
55
56 $this->getItems();
57 }
58
59 public function getItems()
60 {
61 $data = array();
62
63 foreach (ilBadgeImageTemplate::getInstances() as $template) {
64 $data[] = array(
65 "id" => $template->getId(),
66 "title" => $template->getTitle(),
67 "path" => $template->getImagePath(),
68 "file" => $template->getImage()
69 );
70 }
71
72 $this->setData($data);
73 }
74
75 protected function fillRow($a_set)
76 {
78 $ilCtrl = $this->ctrl;
79
80 if ($this->has_write) {
81 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
82 }
83
84 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
85 $this->tpl->setVariable("VAL_IMG", $a_set["path"]);
86 $this->tpl->setVariable("TXT_IMG", $a_set["file"]);
87
88 if ($this->has_write) {
89 $ilCtrl->setParameter($this->getParentObject(), "tid", $a_set["id"]);
90 $url = $ilCtrl->getLinkTarget($this->getParentObject(), "editImageTemplate");
91 $ilCtrl->setParameter($this->getParentObject(), "tid", "");
92
93 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
94 $this->tpl->setVariable("URL_EDIT", $url);
95 }
96 }
97}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for badge template listing.
__construct($a_parent_obj, $a_parent_cmd="", $a_has_write=false)
ilTable2GUI constructor.
fillRow($a_set)
Standard Version of Fill Row.
Class ilTable2GUI.
getParentObject()
Get parent object.
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.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url