ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSCTreeDuplicatesTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
25{
26 public function __construct(object $a_parent_obj, string $a_parent_cmd = '')
27 {
28 $this->setId('sysc_tree_duplicates');
29 parent::__construct($a_parent_obj, $a_parent_cmd);
30 }
31
32 public function init(): void
33 {
34 $this->setExternalSorting(true);
35 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
36
37 $this->setDisableFilterHiding(true);
38 $this->setRowTemplate('tpl.sc_tree_duplicates_row.html', 'components/ILIAS/Tree');
39
40 $this->addColumn($this->lng->txt('sysc_duplicates_repository'), '');
41 $this->addColumn($this->lng->txt('sysc_duplicates_trash'), '');
42
43 $this->addCommandButton(
44 'deleteDuplicatesFromRepository',
45 $this->lng->txt('sysc_delete_duplicates_from_repository')
46 );
47 $this->addCommandButton('deleteDuplicatesFromTrash', $this->lng->txt('sysc_delete_duplicates_from_trash'));
48 }
49
50 public function parse(int $a_duplicate_id): void
51 {
52 $this->setData(array(array('id' => $a_duplicate_id)));
53 }
54
55 protected function fillRow(array $a_set): void
56 {
57 $id = (int) ($a_set['id'] ?? 0);
59
60 $this->tpl->setVariable('DUP_ID', $id);
61
62 foreach ($duplicates as $a_id => $node) {
63 $child_id = (int) ($node['child'] ?? 0);
64 if (isset($node['tree']) && $node['tree'] == 1) {
65 $childs = ilSCTreeTasks::getChilds($node['tree'], $child_id);
66
67 $start_depth = (int) ($node['depth'] ?? 0);
68
69 $this->fillObjectRow($node['tree'], $child_id, $start_depth, '');
70
71 $path = new ilPathGUI();
72 $path->enableHideLeaf(true);
73 $path->enableTextOnly(false);
74 $this->tpl->setVariable('PATH', $path->getPath(ROOT_FOLDER_ID, $child_id));
75
76 foreach ($childs as $child) {
77 $this->fillObjectRow($node['tree'], $child, $start_depth, '');
78 }
79 }
80 if (isset($node['tree']) && $node['tree'] < 1) {
81 $childs = ilSCTreeTasks::getChilds($node['tree'], $child_id);
82
83 $start_depth = (int) ($node['depth'] ?? 0);
84
85 $this->fillObjectRow($node['tree'], $child_id, $start_depth, 'b');
86
87 foreach ($childs as $child) {
88 $this->fillObjectRow($node['tree'], $child, $start_depth, 'b');
89 }
90 }
91 }
92 }
93
94 protected function fillObjectRow(int $a_tree_id, int $a_ref_id, int $a_start_depth, string $a_prefix): void
95 {
96 $child_data = ilSCTreeTasks::getNodeInfo($a_tree_id, $a_ref_id);
97
98 $depth = (int) ($child_data['depth'] ?? 0);
99 for ($i = $a_start_depth; $i <= $depth; $i++) {
100 $this->tpl->touchBlock($a_prefix . 'padding');
101 $this->tpl->touchBlock($a_prefix . 'end_padding');
102 }
103 $this->tpl->setVariable($a_prefix . 'OBJ_TITLE', (string) ($child_data['title'] ?? ''));
104
105 if (isset($child_data['description']) && $child_data['description']) {
106 $this->tpl->setVariable($a_prefix . 'VAL_DESC', $child_data['description']);
107 }
108 $this->tpl->setVariable(
109 $a_prefix . 'TYPE_IMG',
110 ilObject::_getIcon((int) ($child_data['obj_id'] ?? 0), "small", (string) ($child_data['type'] ?? ''))
111 );
112 $this->tpl->setVariable($a_prefix . 'TYPE_STR', $this->lng->txt('obj_' . ($child_data['type'] ?? '')));
113 }
114}
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
fillRow(array $a_set)
Standard Version of Fill Row.
fillObjectRow(int $a_tree_id, int $a_ref_id, int $a_start_depth, string $a_prefix)
__construct(object $a_parent_obj, string $a_parent_cmd='')
static findDuplicates(int $a_duplicate_id)
static getNodeInfo(int $a_tree_id, int $a_child)
static getChilds(int $a_tree_id, int $a_childs)
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)
setDisableFilterHiding(bool $a_val=true)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
const ROOT_FOLDER_ID
Definition: constants.php:32
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc