ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilECSNodeMappingTreeTableGUI.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
13{
14 private $server_id = 0;
15 private $mid = 0;
16
24 public function __construct($a_server_id, $a_mid, $a_parent_obj, $a_parent_cmd)
25 {
26 global $lng,$ilCtrl;
27
28 $this->lng = $lng;
29 $this->ctrl = $ilCtrl;
30
31 $this->server_id = $a_server_id;
32 $this->mid = $a_mid;
33
34 // TODO: set id
35 $this->setId('ecs_node_mapping_table');
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38
39 $this->setTitle($this->lng->txt('ecs_cms_directory_trees_tbl'));
40 $this->addColumn($this->lng->txt('title'), '', "80%");
41 $this->addColumn($this->lng->txt('actions'), '', "20%");
42 $this->setRowTemplate("tpl.ecs_node_mapping_tree_table_row.html", "Services/WebServices/ECS");
43
44 $this->setEnableHeader(true);
45 }
46
51 public function getServer()
52 {
53 return ilECSSetting::getInstanceByServerId($this->server_id);
54 }
55
60 public function getMid()
61 {
62 return $this->mid;
63 }
64
69 public function fillRow($a_set)
70 {
71 global $ilCtrl;
72
73
74 // show title if available
75 if ($a_set['term']) {
76 $this->tpl->setVariable('VAL_TITLE', $a_set['term']);
77 } else {
78 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
79 }
80 $this->tpl->setVariable('TXT_STATUS', $this->lng->txt('status'));
81 $this->tpl->setVariable('VAL_STATUS', ilECSMappingUtils::mappingStatusToString($a_set['status']));
82
83 // Actions
84 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
86 $list->setSelectionHeaderClass('small');
87 $list->setItemLinkClass('small');
88 $list->setId('actl_' . $a_set['id']);
89 $list->setListTitle($this->lng->txt('actions'));
90
91 $ilCtrl->setParameter($this->getParentObject(), 'tid', $a_set['id']);
92 $this->tpl->setVariable('EDIT_TITLE', $this->ctrl->getLinkTarget($this->getParentObject(), 'dInitEditTree'));
93
94 $list->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'dInitEditTree'));
95
96 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
97 if ($a_set['status'] != ilECSMappingUtils::MAPPED_UNMAPPED &&
98 ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isDirectoryMappingEnabled()) {
99 $list->addItem(
100 $this->lng->txt('ecs_cms_tree_synchronize'),
101 '',
102 $ilCtrl->getLinkTarget($this->getParentObject(), 'dSynchronizeTree')
103 );
104 }
105
106 $list->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'dConfirmDeleteTree'));
107 $this->tpl->setVariable('ACTIONS', $list->getHTML());
108
109 $ilCtrl->clearParameters($this->getParentObject());
110 }
111
115 public function parse()
116 {
117 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
118 include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
119 include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
120
121 $data = array();
122 $counter = 0;
123 foreach (ilECSCmsData::lookupTreeIds($this->getServer()->getServerId(), $this->getMid()) as $tree_id) {
124 $root = new ilECSCmsTree($tree_id);
125 $node = new ilECSCmsData($root->getRootId());
126
127 $data[$counter]['id'] = $tree_id;
129 $this->getServer()->getServerId(),
130 $this->getMid(),
131 $tree_id
132 );
133 $data[$counter]['title'] = $node->getTitle();
135 $this->getServer()->getServerId(),
136 $this->getMid(),
137 $tree_id
138 );
139 $counter++;
140 }
141 $this->setData($data);
142 }
143}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static lookupTopTerm($a_server_id, $a_mid, $a_tree_id)
Lookup term (highest term in cms tree) @global <type> $ilDB.
static lookupTreeIds($a_server_id, $a_mid)
static mappingStatusToString($a_status)
Get mapping status as string.
static lookupMappingStatus($a_server_id, $a_mid, $a_tree_id)
Lookup mapping status.
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
__construct($a_server_id, $a_mid, $a_parent_obj, $a_parent_cmd)
Table gui constructor @global <type> $lng @global <type> $ilCtrl.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
$counter
global $ilCtrl
Definition: ilias.php:18
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41