ILIAS  release_8 Revision v8.24
class.ilECSNodeMappingTreeTableGUI.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
26{
27 private int $server_id;
28 private int $mid;
29
33 public function __construct(int $a_server_id, int $a_mid, ?object $a_parent_obj, string $a_parent_cmd)
34 {
35 $this->server_id = $a_server_id;
36 $this->mid = $a_mid;
37
38 // TODO: set id
39 $this->setId('ecs_node_mapping_table');
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42
43 $this->setTitle($this->lng->txt('ecs_cms_directory_trees_tbl'));
44 $this->addColumn($this->lng->txt('title'), '', "80%");
45 $this->addColumn($this->lng->txt('actions'), '', "20%");
46 $this->setRowTemplate("tpl.ecs_node_mapping_tree_table_row.html", "Services/WebServices/ECS");
47
48 $this->setEnableHeader(true);
49 }
50
54 public function getServer(): \ilECSSetting
55 {
56 return ilECSSetting::getInstanceByServerId($this->server_id);
57 }
58
62 public function getMid(): int
63 {
64 return $this->mid;
65 }
66
71 protected function fillRow(array $a_set): void
72 {
73 // show title if available
74 if ($a_set['term']) {
75 $this->tpl->setVariable('VAL_TITLE', $a_set['term']);
76 } else {
77 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
78 }
79 $this->tpl->setVariable('TXT_STATUS', $this->lng->txt('status'));
80 $this->tpl->setVariable('VAL_STATUS', ilECSMappingUtils::mappingStatusToString($a_set['status']));
81
82 // Actions
83 $list = new ilAdvancedSelectionListGUI();
84 $list->setSelectionHeaderClass('small');
85 $list->setItemLinkClass('small');
86 $list->setId('actl_' . $a_set['id']);
87 $list->setListTitle($this->lng->txt('actions'));
88
89 $this->ctrl->setParameter($this->getParentObject(), 'tid', $a_set['id']);
90 $this->tpl->setVariable('EDIT_TITLE', $this->ctrl->getLinkTarget($this->getParentObject(), 'dInitEditTree'));
91
92 $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'dInitEditTree'));
93
94 if ($a_set['status'] !== ilECSMappingUtils::MAPPED_UNMAPPED &&
95 ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isDirectoryMappingEnabled()) {
96 $list->addItem(
97 $this->lng->txt('ecs_cms_tree_synchronize'),
98 '',
99 $this->ctrl->getLinkTarget($this->getParentObject(), 'dSynchronizeTree')
100 );
101 }
102
103 $list->addItem($this->lng->txt('delete'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'dConfirmDeleteTree'));
104 $this->tpl->setVariable('ACTIONS', $list->getHTML());
105
106 $this->ctrl->clearParameters($this->getParentObject());
107 }
108
112 public function parse(): void
113 {
114 $data = array();
115 $counter = 0;
116 foreach (ilECSCmsData::lookupTreeIds($this->getServer()->getServerId(), $this->getMid()) as $tree_id) {
117 $root = new ilECSCmsTree($tree_id);
118 $node = new ilECSCmsData($root->getRootId());
119
120 $data[$counter]['id'] = $tree_id;
121 $data[$counter]['status'] = ilECSMappingUtils::lookupMappingStatus(
122 $this->getServer()->getServerId(),
123 $this->getMid(),
124 $tree_id
125 );
126 $data[$counter]['title'] = $node->getTitle();
127 $data[$counter]['term'] = ilECSCmsData::lookupTopTerm(
128 $this->getServer()->getServerId(),
129 $this->getMid(),
130 $tree_id
131 );
132 $counter++;
133 }
134 $this->setData($data);
135 }
136}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTreeIds(int $a_server_id, int $a_mid)
static lookupTopTerm(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup term (highest term in cms tree)
static mappingStatusToString(int $a_status)
Get mapping status as string.
static lookupMappingStatus(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup mapping status.
static getInstanceByServerMid(int $a_server_id, int $a_mid)
Get instance.
__construct(int $a_server_id, int $a_mid, ?object $a_parent_obj, string $a_parent_cmd)
Table gui constructor.
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
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="")
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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc