ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSCategoryMappingTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
29
30 public function __construct($a_parent_obj, $a_parent_cmd)
31 {
32 global $DIC;
33 parent::__construct($a_parent_obj, $a_parent_cmd);
34 $this->logger = $DIC->logger()->wsrv();
35
36 $this->addColumn('', 'f', '1px');
37 $this->addColumn($this->lng->txt('obj_cat'), 'category', '40%');
38 $this->addColumn($this->lng->txt('ecs_cat_mapping_type'), 'kind', '50%');
39 $this->addColumn('', 'edit', '10%');
40 $this->setRowTemplate('tpl.rule_row.html', 'components/ILIAS/WebServices/ECS');
41 $this->setDefaultOrderField('title');
42 $this->setDefaultOrderDirection('asc');
43 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
44 $this->setSelectAllCheckbox('rules');
45 $this->setTitle($this->lng->txt('ecs_tbl_active_rules'));
46 $this->addMultiCommand('deleteCategoryMappings', $this->lng->txt('delete'));
47 }
48
49 protected function fillRow(array $a_set): void
50 {
51 $this->tpl->setVariable('VAL_ID', $a_set['id']);
52 $this->tpl->setVariable('TXT_ID', $this->lng->txt('ecs_import_id'));
53 $this->tpl->setVariable('VAL_CAT_ID', $a_set['category_id']);
54 $this->tpl->setVariable('TXT_TITLE', $this->lng->txt('title'));
55 $this->tpl->setVariable('VAL_CAT_TITLE', $a_set['category']);
56 $this->tpl->setVariable('VAL_CONDITION', $a_set['kind']);
57 $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
58 $this->tpl->setVariable('PATH', $this->buildPath($a_set['category_id']));
59 if ($this->getParentObject()) {
60 $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'rule_id', $a_set['id']);
61 $this->tpl->setVariable(
62 'EDIT_LINK',
63 $this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()), 'editCategoryMapping')
64 );
65 $this->ctrl->clearParametersByClass(get_class($this->getParentObject()));
66 } else {
67 $this->logger->error("Cannot fill Category Mapping Table due to parent object being null");
68 }
69 }
70
75 public function parse(array $a_rules): void
76 {
77 $content = [];
78 foreach ($a_rules as $rule) {
79 $tmp_arr['id'] = $rule->getMappingId();
80 $tmp_arr['category_id'] = $rule->getContainerId();
81 $tmp_arr['category'] = ilObject::_lookupTitle(ilObject::_lookupObjId($rule->getContainerId()));
82 $tmp_arr['kind'] = $rule->conditionToString();
83
84 $content[] = $tmp_arr;
85 }
86 $this->setData($content);
87 }
88
89 private function buildPath(int $a_ref_id): string
90 {
91 $loc = new ilLocatorGUI();
92 $loc->setTextOnly(false);
93 $loc->addContextItems($a_ref_id);
94
95 return $loc->getHTML();
96 }
97}
fillRow(array $a_set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Component logger with individual log levels by component id.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
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.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26