ILIAS  release_8 Revision v8.24
class.ilRatingCategoryTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 public function __construct(
27 object $a_parent_obj,
28 string $a_parent_cmd,
29 int $a_parent_id
30 ) {
31 global $DIC;
32
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35 $ilCtrl = $DIC->ctrl();
36 $lng = $DIC->language();
37
38 $this->setId("rtgcat");
39
40 parent::__construct($a_parent_obj, $a_parent_cmd);
41
42 $this->addColumn($this->lng->txt("position"));
43 $this->addColumn($this->lng->txt("title"), "title");
44 $this->addColumn($this->lng->txt("description"), "description");
45 $this->addColumn($this->lng->txt("actions"));
46
47 $this->setEnableHeader(true);
48 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
49 $this->setRowTemplate("tpl.rating_category_row.html", "Services/Rating");
50
51 $this->addCommandButton("updateorder", $lng->txt("rating_update_positions"));
52
53 $this->getItems($a_parent_id);
54 }
55
56 // Build item rows for given object and filter(s)
57 public function getItems(int $a_parent_obj_id)
58 {
59 $data = ilRatingCategory::getAllForObject($a_parent_obj_id);
60
61 $this->setMaxCount(sizeof($data));
62 $this->setData($data);
63 }
64
68 protected function fillRow(array $a_set): void
69 {
71 $ilCtrl = $this->ctrl;
72
73 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
74 $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
75 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
76 $this->tpl->setVariable("TXT_DESCRIPTION", nl2br($a_set["description"]));
77
78 $ilCtrl->setParameter($this->parent_obj, "cat_id", $a_set["id"]);
79
80 $items = array();
81 $items["edit"] = array($lng->txt("edit"), $ilCtrl->getLinkTarget($this->parent_obj, "edit"));
82 $items["delete"] = array($lng->txt("delete"), $ilCtrl->getLinkTarget($this->parent_obj, "confirmDelete"));
83
84 $this->tpl->setCurrentBlock("actions");
85 foreach ($items as $item) {
86 $this->tpl->setVariable("ACTION_CAPTION", $item[0]);
87 $this->tpl->setVariable("ACTION_LINK", $item[1]);
88 $this->tpl->parseCurrentBlock();
89 }
90 }
91}
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...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_parent_id)
static getAllForObject(int $a_parent_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
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)
setEnableHeader(bool $a_enableheader)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
setMaxCount(int $a_max_count)
set max.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc