ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_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['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['ilLog']->write('---------------------------- '. print_r($duplicates,TRUE));
64 
65  foreach($duplicates as $a_id => $node)
66  {
67  $GLOBALS['ilLog']->write(__METHOD__.': DUPPSSSSSSSSSSSSSSSSSSS '.print_r($node,TRUE));
68  if($node['tree'] == 1)
69  {
70 
71  include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
72  $childs = ilSCTreeTasks::getChilds($node['tree'],$node['child']);
73 
74  $GLOBALS['ilLog']->write(__METHOD__.': DUPPSSSSSSSSSSSSSSSSSSS CHILDSSSSSSSSSSS'.print_r($childs,TRUE));
75  $start_depth = $node['depth'];
76 
77  $this->fillObjectRow($node['tree'],$node['child'],$start_depth,'');
78 
79  include_once './Services/Tree/classes/class.ilPathGUI.php';
80  $path = new ilPathGUI();
81  $path->enableHideLeaf(TRUE);
82  $path->enableTextOnly(FALSE);
83  $this->tpl->setVariable('PATH',$path->getPath(ROOT_FOLDER_ID, $node['child']));
84 
85 
86  foreach($childs as $child)
87  {
88  $this->fillObjectRow($node['tree'],$child, $start_depth, '');
89  }
90  }
91  if($node['tree'] < 1)
92  {
93  include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
94  $childs = ilSCTreeTasks::getChilds($node['tree'],$node['child']);
95  $GLOBALS['ilLog']->write(__METHOD__.': TRASJH DUPPSSSSSSSSSSSSSSSSSSS CHILDSSSSSSSSSSS'.print_r($childs,TRUE));
96 
97  $start_depth = $node['depth'];
98 
99  $this->fillObjectRow($node['tree'],$node['child'],$start_depth,'b');
100 
101  foreach($childs as $child)
102  {
103  $this->fillObjectRow($node['tree'],$child, $start_depth, 'b');
104  }
105  }
106 
107  }
108  }
109 
116  protected function fillObjectRow($a_tree_id,$a_ref_id, $a_start_depth, $a_prefix)
117  {
118  include_once './Services/Tree/classes/class.ilSCTreeTasks.php';
119  $child_data = ilSCTreeTasks::getNodeInfo($a_tree_id, $a_ref_id);
120  $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($child_data,TRUE));
121 
122  for($i = $a_start_depth; $i <= $child_data['depth']; $i++)
123  {
124  $this->tpl->touchBlock($a_prefix.'padding');
125  $this->tpl->touchBlock($a_prefix.'end_padding');
126  }
127  $this->tpl->setVariable($a_prefix.'OBJ_TITLE', $child_data['title']);
128 
129  if($child_data['description'])
130  {
131  $this->tpl->setVariable($a_prefix.'VAL_DESC',$child_data['description']);
132  }
133  $this->tpl->setVariable($a_prefix.'TYPE_IMG',ilUtil::getTypeIconPath($child_data['type'], $child_data['obj_id']));
134  $this->tpl->setVariable($a_prefix.'TYPE_STR',$this->lng->txt('obj_'.$child_data['type']));
135  }
136 }
137 
138 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Creates a path for a start and endnode.
$path
Definition: aliased.php:25
setExternalSorting($a_val)
Set external sorting.
static findDuplicates($a_duplicate_id)
find duplicates type $ilDB
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getChilds($a_tree_id, $a_childs)
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...
getParentObject()
Get parent object.
setId($a_val)
Set id.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
Class ilTable2GUI.
fillObjectRow($a_tree_id, $a_ref_id, $a_start_depth, $a_prefix)
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
getFormAction()
Get Form action parameter.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
static getNodeInfo($a_tree_id, $a_child)