ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
19  protected $ctrl;
20 
21  protected $has_write; // [bool]
22 
23  public function __construct($a_parent_obj, $a_parent_cmd = "", $a_has_write = false)
24  {
25  global $DIC;
26 
27  $this->ctrl = $DIC->ctrl();
28  $this->lng = $DIC->language();
29  $ilCtrl = $DIC->ctrl();
30  $lng = $DIC->language();
31 
32  $this->setId("bdgtmpl");
33  $this->has_write = (bool) $a_has_write;
34 
35  parent::__construct($a_parent_obj, $a_parent_cmd);
36 
37  $this->setLimit(9999);
38 
39  $this->setTitle($lng->txt("badge_image_templates"));
40 
41  if ($this->has_write) {
42  $this->addColumn("", "", 1);
43  }
44 
45  $this->addColumn($lng->txt("title"), "title");
46  $this->addColumn($lng->txt("image"), "image");
47 
48  if ($this->has_write) {
49  $this->addColumn($lng->txt("action"), "");
50  $this->addMultiCommand("confirmDeleteImageTemplates", $lng->txt("delete"));
51  }
52 
53  $this->setSelectAllCheckbox("id");
54 
55  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56  $this->setRowTemplate("tpl.template_row.html", "Services/Badge");
57  $this->setDefaultOrderField("title");
58 
59  $this->getItems();
60  }
61 
62  public function getItems()
63  {
64  $data = array();
65 
66  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
68  $data[] = array(
69  "id" => $template->getId(),
70  "title" => $template->getTitle(),
71  "path" => $template->getImagePath(),
72  "file" => $template->getImage()
73  );
74  }
75 
76  $this->setData($data);
77  }
78 
79  protected function fillRow($a_set)
80  {
81  $lng = $this->lng;
83 
84  if ($this->has_write) {
85  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
86  }
87 
88  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
89  $this->tpl->setVariable("VAL_IMG", $a_set["path"]);
90  $this->tpl->setVariable("TXT_IMG", $a_set["file"]);
91 
92  if ($this->has_write) {
93  $ilCtrl->setParameter($this->getParentObject(), "tid", $a_set["id"]);
94  $url = $ilCtrl->getLinkTarget($this->getParentObject(), "editImageTemplate");
95  $ilCtrl->setParameter($this->getParentObject(), "tid", "");
96 
97  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
98  $this->tpl->setVariable("URL_EDIT", $url);
99  }
100  }
101 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$template
global $DIC
Definition: saml.php:7
__construct($a_parent_obj, $a_parent_cmd="", $a_has_write=false)
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
TableGUI class for badge template listing.
$url
setLimit($a_limit=0, $a_default_limit=0)