ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExcCriteriaTableGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 protected int $cat_id;
28
29 public function __construct(
30 object $a_parent_obj,
31 string $a_parent_cmd,
32 int $a_cat_id
33 ) {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->lng = $DIC->language();
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
40
41 $this->cat_id = $a_cat_id;
42 $this->setId("exccrit" . $this->cat_id);
43
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45
46 $this->setLimit(9999); // because of manual order
47
48 $this->setTitle($lng->txt("exc_criterias"));
49
50 $this->addColumn("", "", "1", true);
51 $this->addColumn($this->lng->txt("position"), "pos", "10%");
52 $this->addColumn($this->lng->txt("title"), "title");
53 $this->addColumn($this->lng->txt("type"), "type");
54 $this->addColumn($this->lng->txt("actions"));
55
56 $this->setDefaultOrderField("pos");
57 $this->setDefaultOrderDirection("asc");
58
59 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
60 $this->setRowTemplate("tpl.exc_crit_row.html", "components/ILIAS/Exercise");
61 $this->setSelectAllCheckbox("id");
62
63 $this->addMultiCommand("confirmDeletion", $lng->txt("delete"));
64
65 if ($this->getItems()) {
66 $this->addCommandButton("saveOrder", $lng->txt("exc_save_order"));
67 }
68 }
69
70 protected function getItems(): bool
71 {
72 $data = array();
73
74 $pos = 0;
75 foreach (ilExcCriteria::getInstancesByParentId($this->cat_id) as $item) {
76 $pos += 10;
77
78 $data[] = array(
79 "id" => $item->getId()
80 ,"type" => $item->getTranslatedType()
81 ,"pos" => $pos
82 ,"title" => $item->getTitle()
83 );
84 }
85
86 $this->setData($data);
87
88 return (bool) count($data);
89 }
90
91 public function numericOrdering(string $a_field): bool
92 {
93 return $a_field === "pos";
94 }
95
96 protected function fillRow(array $a_set): void
97 {
99 $ilCtrl = $this->ctrl;
100
101 $this->tpl->setVariable("ID", $a_set["id"]);
102 $this->tpl->setVariable("POS", $a_set["pos"]);
103 $this->tpl->setVariable("TYPE", $a_set["type"]);
104 $this->tpl->setVariable("TITLE", $a_set["title"]);
105
106 $ilCtrl->setParameter($this->getParentObject(), "crit_id", $a_set["id"]);
107 $url = $ilCtrl->getLinkTarget($this->getParentObject(), "edit");
108 $ilCtrl->setParameter($this->getParentObject(), "crit_id", "");
109
110 $this->tpl->setCurrentBlock("action_bl");
111 $this->tpl->setVariable("ACTION_URL", $url);
112 $this->tpl->setVariable("ACTION_TXT", $lng->txt("edit"));
113 $this->tpl->parseCurrentBlock();
114 }
115}
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
numericOrdering(string $a_field)
Should this field be sorted numeric?
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_cat_id)
static getInstancesByParentId(int $a_parent_id)
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...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68