ILIAS  release_8 Revision v8.24
class.ilSCTreeDuplicatesTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
5
11{
12 public function __construct(object $a_parent_obj, string $a_parent_cmd = '')
13 {
14 $this->setId('sysc_tree_duplicates');
15 parent::__construct($a_parent_obj, $a_parent_cmd);
16 }
17
18 public function init(): void
19 {
20 $this->setExternalSorting(true);
21 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
22
23 $this->setDisableFilterHiding(true);
24 $this->setRowTemplate('tpl.sc_tree_duplicates_row.html', 'Services/Tree');
25
26 $this->addColumn($this->lng->txt('sysc_duplicates_repository'), '');
27 $this->addColumn($this->lng->txt('sysc_duplicates_trash'), '');
28
29 $this->addCommandButton(
30 'deleteDuplicatesFromRepository',
31 $this->lng->txt('sysc_delete_duplicates_from_repository')
32 );
33 $this->addCommandButton('deleteDuplicatesFromTrash', $this->lng->txt('sysc_delete_duplicates_from_trash'));
34 }
35
36 public function parse(int $a_duplicate_id): void
37 {
38 $this->setData(array(array('id' => $a_duplicate_id)));
39 }
40
41 protected function fillRow(array $a_set): void
42 {
43 $id = (int) ($a_set['id'] ?? 0);
45
46 $this->tpl->setVariable('DUP_ID', $id);
47
48 foreach ($duplicates as $a_id => $node) {
49 $child_id = (int) ($node['child'] ?? 0);
50 if (isset($node['tree']) && $node['tree'] == 1) {
51 $childs = ilSCTreeTasks::getChilds($node['tree'], $child_id);
52
53 $start_depth = (int) ($node['depth'] ?? 0);
54
55 $this->fillObjectRow($node['tree'], $child_id, $start_depth, '');
56
57 $path = new ilPathGUI();
58 $path->enableHideLeaf(true);
59 $path->enableTextOnly(false);
60 $this->tpl->setVariable('PATH', $path->getPath(ROOT_FOLDER_ID, $child_id));
61
62 foreach ($childs as $child) {
63 $this->fillObjectRow($node['tree'], $child, $start_depth, '');
64 }
65 }
66 if (isset($node['tree']) && $node['tree'] < 1) {
67 $childs = ilSCTreeTasks::getChilds($node['tree'], $child_id);
68
69 $start_depth = (int) ($node['depth'] ?? 0);
70
71 $this->fillObjectRow($node['tree'], $child_id, $start_depth, 'b');
72
73 foreach ($childs as $child) {
74 $this->fillObjectRow($node['tree'], $child, $start_depth, 'b');
75 }
76 }
77 }
78 }
79
80 protected function fillObjectRow(int $a_tree_id, int $a_ref_id, int $a_start_depth, string $a_prefix): void
81 {
82 $child_data = ilSCTreeTasks::getNodeInfo($a_tree_id, $a_ref_id);
83
84 $depth = (int) ($child_data['depth'] ?? 0);
85 for ($i = $a_start_depth; $i <= $depth; $i++) {
86 $this->tpl->touchBlock($a_prefix . 'padding');
87 $this->tpl->touchBlock($a_prefix . 'end_padding');
88 }
89 $this->tpl->setVariable($a_prefix . 'OBJ_TITLE', (string) ($child_data['title'] ?? ''));
90
91 if (isset($child_data['description']) && $child_data['description']) {
92 $this->tpl->setVariable($a_prefix . 'VAL_DESC', $child_data['description']);
93 }
94 $this->tpl->setVariable(
95 $a_prefix . 'TYPE_IMG',
96 ilObject::_getIcon((int) ($child_data['obj_id'] ?? 0), "small", (string) ($child_data['type'] ?? ''))
97 );
98 $this->tpl->setVariable($a_prefix . 'TYPE_STR', $this->lng->txt('obj_' . ($child_data['type'] ?? '')));
99 }
100}
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
Creates a path for a start and endnode.
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:32
$i
Definition: metadata.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc