ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilRatingCategoryTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5
15{
19 protected $ctrl;
20
27 public function __construct($a_parent_obj, $a_parent_cmd, $a_parent_id)
28 {
29 global $DIC;
30
31 $this->ctrl = $DIC->ctrl();
32 $this->lng = $DIC->language();
33 $ilCtrl = $DIC->ctrl();
34 $lng = $DIC->language();
35
36 $this->setId("rtgcat");
37
38 parent::__construct($a_parent_obj, $a_parent_cmd);
39
40 $this->addColumn($this->lng->txt("position"));
41 $this->addColumn($this->lng->txt("title"), "title");
42 $this->addColumn($this->lng->txt("description"), "description");
43 $this->addColumn($this->lng->txt("actions"));
44
45 $this->setEnableHeader(true);
46 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
47 $this->setRowTemplate("tpl.rating_category_row.html", "Services/Rating");
48
49 $this->addCommandButton("updateorder", $lng->txt("rating_update_positions"));
50
51 $this->getItems($a_parent_id);
52 }
53
59 public function getItems($a_parent_obj_id)
60 {
61 include_once "Services/Rating/classes/class.ilRatingCategory.php";
62 $data = ilRatingCategory::getAllForObject($a_parent_obj_id);
63
64 $this->setMaxCount(sizeof($data));
65 $this->setData($data);
66 }
67
72 protected function fillRow($a_set)
73 {
75 $ilCtrl = $this->ctrl;
76
77 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
78 $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
79 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
80 $this->tpl->setVariable("TXT_DESCRIPTION", nl2br($a_set["description"]));
81
82 $ilCtrl->setParameter($this->parent_obj, "cat_id", $a_set["id"]);
83
84 $items = array();
85 $items["edit"] = array($lng->txt("edit"), $ilCtrl->getLinkTarget($this->parent_obj, "edit"));
86 $items["delete"] = array($lng->txt("delete"), $ilCtrl->getLinkTarget($this->parent_obj, "confirmDelete"));
87
88 $this->tpl->setCurrentBlock("actions");
89 foreach ($items as $item) {
90 $this->tpl->setVariable("ACTION_CAPTION", $item[0]);
91 $this->tpl->setVariable("ACTION_LINK", $item[1]);
92 $this->tpl->parseCurrentBlock();
93 }
94 }
95}
An exception for terminatinating execution or to throw for unit testing.
getItems($a_parent_obj_id)
Build item rows for given object and filter(s)
__construct($a_parent_obj, $a_parent_cmd, $a_parent_id)
Constructor.
static getAllForObject($a_parent_obj_id)
Get all categories for object.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setData($a_data)
set table data @access public
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setMaxCount($a_max_count)
set max.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc