ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSCTreeDuplicatesTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
12{
18 public function __construct($a_parent_obj, $a_parent_cmd = "")
19 {
20 $this->setId('sysc_tree_duplicates');
21 parent::__construct($a_parent_obj, $a_parent_cmd);
22 }
23
27 public function init()
28 {
29 $this->setExternalSorting(true);
30 $this->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this->getParentObject()));
31
32 $this->setDisableFilterHiding(true);
33 $this->setRowTemplate('tpl.sc_tree_duplicates_row.html', 'Services/Tree');
34
35 $this->addColumn($this->lng->txt('sysc_duplicates_repository'), '');
36 $this->addColumn($this->lng->txt('sysc_duplicates_trash'), '');
37
38 $this->addCommandButton('deleteDuplicatesFromRepository', $this->lng->txt('sysc_delete_duplicates_from_repository'));
39 $this->addCommandButton('deleteDuplicatesFromTrash', $this->lng->txt('sysc_delete_duplicates_from_trash'));
40 }
41
45 public function parse($a_duplicate_id)
46 {
47 $this->setData(array(array('id' => $a_duplicate_id)));
48 }
49
50
55 public function fillRow($a_set)
56 {
57 include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
58 $duplicates = ilSCTreeTasks::findDuplicates($a_set['id']);
59
60 $this->tpl->setVariable('DUP_ID', $a_set['id']);
61
62
63 $GLOBALS['DIC']['ilLog']->write('---------------------------- ' . print_r($duplicates, true));
64
65 foreach ($duplicates as $a_id => $node) {
66 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': DUPPSSSSSSSSSSSSSSSSSSS ' . print_r($node, true));
67 if ($node['tree'] == 1) {
68 include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
69 $childs = ilSCTreeTasks::getChilds($node['tree'], $node['child']);
70
71 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': DUPPSSSSSSSSSSSSSSSSSSS CHILDSSSSSSSSSSS' . print_r($childs, true));
72 $start_depth = $node['depth'];
73
74 $this->fillObjectRow($node['tree'], $node['child'], $start_depth, '');
75
76 include_once './Services/Tree/classes/class.ilPathGUI.php';
77 $path = new ilPathGUI();
78 $path->enableHideLeaf(true);
79 $path->enableTextOnly(false);
80 $this->tpl->setVariable('PATH', $path->getPath(ROOT_FOLDER_ID, $node['child']));
81
82
83 foreach ($childs as $child) {
84 $this->fillObjectRow($node['tree'], $child, $start_depth, '');
85 }
86 }
87 if ($node['tree'] < 1) {
88 include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
89 $childs = ilSCTreeTasks::getChilds($node['tree'], $node['child']);
90 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': TRASJH DUPPSSSSSSSSSSSSSSSSSSS CHILDSSSSSSSSSSS' . print_r($childs, true));
91
92 $start_depth = $node['depth'];
93
94 $this->fillObjectRow($node['tree'], $node['child'], $start_depth, 'b');
95
96 foreach ($childs as $child) {
97 $this->fillObjectRow($node['tree'], $child, $start_depth, 'b');
98 }
99 }
100 }
101 }
102
109 protected function fillObjectRow($a_tree_id, $a_ref_id, $a_start_depth, $a_prefix)
110 {
111 include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
112 $child_data = ilSCTreeTasks::getNodeInfo($a_tree_id, $a_ref_id);
113 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . print_r($child_data, true));
114
115 for ($i = $a_start_depth; $i <= $child_data['depth']; $i++) {
116 $this->tpl->touchBlock($a_prefix . 'padding');
117 $this->tpl->touchBlock($a_prefix . 'end_padding');
118 }
119 $this->tpl->setVariable($a_prefix . 'OBJ_TITLE', $child_data['title']);
120
121 if ($child_data['description']) {
122 $this->tpl->setVariable($a_prefix . 'VAL_DESC', $child_data['description']);
123 }
124 $this->tpl->setVariable($a_prefix . 'TYPE_IMG', ilUtil::getTypeIconPath($child_data['type'], $child_data['obj_id']));
125 $this->tpl->setVariable($a_prefix . 'TYPE_STR', $this->lng->txt('obj_' . $child_data['type']));
126 }
127}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Creates a path for a start and endnode.
fillObjectRow($a_tree_id, $a_ref_id, $a_start_depth, $a_prefix)
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
static findDuplicates($a_duplicate_id)
find duplicates @global type $ilDB
static getNodeInfo($a_tree_id, $a_child)
static getChilds($a_tree_id, $a_childs)
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
setExternalSorting($a_val)
Set external sorting.
getParentObject()
Get parent object.
getFormAction()
Get Form action parameter.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
const ROOT_FOLDER_ID
Definition: constants.php:30
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc