ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilBadgeImageTemplateTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("Services/Table/classes/class.ilTable2GUI.php");
5
15{
16 protected $has_write; // [bool]
17
18 function __construct($a_parent_obj, $a_parent_cmd = "", $a_has_write = false)
19 {
20 global $ilCtrl, $lng;
21
22 $this->setId("bdgtmpl");
23 $this->has_write = (bool)$a_has_write;
24
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26
27 $this->setLimit(9999);
28
29 $this->setTitle($lng->txt("badge_image_templates"));
30
31 if($this->has_write)
32 {
33 $this->addColumn("", "", 1);
34 }
35
36 $this->addColumn($lng->txt("title"), "title");
37 $this->addColumn($lng->txt("image"), "image");
38
39 if($this->has_write)
40 {
41 $this->addColumn($lng->txt("action"), "");
42 $this->addMultiCommand("confirmDeleteImageTemplates", $lng->txt("delete"));
43 }
44
45 $this->setSelectAllCheckbox("id");
46
47 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
48 $this->setRowTemplate("tpl.template_row.html", "Services/Badge");
49 $this->setDefaultOrderField("title");
50
51 $this->getItems();
52 }
53
54 function getItems()
55 {
56 $data = array();
57
58 include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
59 foreach(ilBadgeImageTemplate::getInstances() as $template)
60 {
61 $data[] = array(
62 "id" => $template->getId(),
63 "title" => $template->getTitle(),
64 "path" => $template->getImagePath(),
65 "file" => $template->getImage()
66 );
67 }
68
69 $this->setData($data);
70 }
71
72 protected function fillRow($a_set)
73 {
74 global $lng, $ilCtrl;
75
76 if($this->has_write)
77 {
78 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
79 }
80
81 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
82 $this->tpl->setVariable("VAL_IMG", $a_set["path"]);
83 $this->tpl->setVariable("TXT_IMG", $a_set["file"]);
84
85 if($this->has_write)
86 {
87 $ilCtrl->setParameter($this->getParentObject(), "tid", $a_set["id"]);
88 $url = $ilCtrl->getLinkTarget($this->getParentObject(), "editImageTemplate");
89 $ilCtrl->setParameter($this->getParentObject(), "tid", "");
90
91 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
92 $this->tpl->setVariable("URL_EDIT", $url);
93 }
94 }
95}
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)
Constructor.
fillRow($a_set)
Standard Version of Fill Row.
Class ilTable2GUI.
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.
getParentObject()
Get parent object.
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.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
$url
Definition: shib_logout.php:72