ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilECSCommunityTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once('Services/Table/classes/class.ilTable2GUI.php');
25include_once('Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
26
36{
37 protected $lng;
38 protected $ctrl;
39
40
41 protected $server = null;
42 protected $cid = 0;
43
51 public function __construct(ilECSSetting $set, $a_parent_obj, $a_parent_cmd, $cid)
52 {
53 global $lng,$ilCtrl, $ilAccess;
54
55 $this->lng = $lng;
56 $this->ctrl = $ilCtrl;
57
58 // TODO: set id
59 $this->setId($set->getServerId() . '_' . $cid . '_' . 'community_table');
60
61 parent::__construct($a_parent_obj, $a_parent_cmd);
62 $this->addColumn($this->lng->txt('ecs_participants'), 'participants', "35%");
63 $this->addColumn($this->lng->txt('ecs_participants_infos'), 'infos', "35%");
64 $this->addColumn($this->lng->txt('ecs_tbl_export'), 'export', '5%');
65 $this->addColumn($this->lng->txt('ecs_tbl_import'), 'import', '5%');
66 $this->addColumn($this->lng->txt('ecs_tbl_import_type'), 'type', '10%');
67
68 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
69 $this->addColumn('', 'actions', '10%');
70 }
71
72 $this->disable('form');
73 $this->setRowTemplate("tpl.participant_row.html", "Services/WebServices/ECS");
74 $this->setDefaultOrderField('participants');
75 $this->setDefaultOrderDirection("desc");
76
77 $this->cid = $cid;
78 $this->server = $set;
79 }
80
85 public function getServer()
86 {
87 return $this->server;
88 }
89
97 public function fillRow($a_set)
98 {
99 global $ilCtrl, $ilAccess;
100
101 $this->tpl->setVariable('S_ID', $this->getServer()->getServerId());
102 $this->tpl->setVariable('M_ID', $a_set['mid']);
103 $this->tpl->setVariable('VAL_ID', $this->getServer()->getServerId() . '_' . $a_set['mid']);
104 $this->tpl->setVariable('VAL_ORG', (string) $a_set['org']);
105 $this->tpl->setVariable('VAL_CHECKED', $a_set['checked'] ? 'checked="checked"' : '');
106 $this->tpl->setVariable('VAL_TITLE', $a_set['participants']);
107 $this->tpl->setVariable('VAL_DESC', $a_set['description']);
108 $this->tpl->setVariable('VAL_EMAIL', $a_set['email']);
109 $this->tpl->setVariable('VAL_DNS', $a_set['dns']);
110 $this->tpl->setVariable('VAL_ABR', $a_set['abr']);
111 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
112 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
113 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
114 $this->tpl->setVariable('TXT_ID', $this->lng->txt('ecs_unique_id'));
115 $this->tpl->setVariable('TXT_ORG', $this->lng->txt('organization'));
116
117 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
118 $part = new ilECSParticipantSetting($this->getServer()->getServerId(), $a_set['mid']);
119
120
121 if ($part->isExportEnabled()) {
122 foreach ($part->getExportTypes() as $obj_type) {
123 $this->tpl->setCurrentBlock('obj_erow');
124 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('objs_' . $obj_type));
125 $this->tpl->parseCurrentBlock();
126 }
127 } else {
128 $this->lng->loadLanguageModule('administration');
129 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('disabled'));
130 }
131
132 if ($part->isImportEnabled()) {
133 foreach ($part->getImportTypes() as $obj_type) {
134 $this->tpl->setCurrentBlock('obj_irow');
135 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('objs_' . $obj_type));
136 $this->tpl->parseCurrentBlock();
137 }
138 } else {
139 $this->lng->loadLanguageModule('administration');
140 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('disabled'));
141 }
142 // :TODO: what types are to be supported?
143 $sel = ilUtil::formSelect(
144 $part->getImportType(),
145 'import_type[' . $this->getServer()->getServerId() . '][' . $a_set['mid'] . ']',
146 array(
147 ilECSParticipantSetting::IMPORT_RCRS => $this->lng->txt('obj_rcrs'),
148 ilECSParticipantSetting::IMPORT_CRS => $this->lng->txt('obj_crs'),
149 ilECSParticipantSetting::IMPORT_CMS => $this->lng->txt('ecs_import_cms')
150 ),
151 false,
152 true
153 );
154 $this->tpl->setVariable('IMPORT_SEL', $sel);
155
156 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
158 $list->setItemLinkClass('small');
159 $list->setSelectionHeaderClass('small');
160 $list->setId('actl_' . $a_set['server_id'] . '_' . $a_set['mid']);
161 $list->setListTitle($this->lng->txt('actions'));
162
163 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
164 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
165 $list->addItem(
166 $this->lng->txt('edit'),
167 '',
168 $ilCtrl->getLinkTargetByClass('ilecsparticipantsettingsgui', 'settings')
169 );
170
171 switch ($part->getImportType()) {
173 // Do nothing
174 break;
175
177 // Possible action => Edit course allocation
178 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
179 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
180 $list->addItem(
181 $this->lng->txt('ecs_crs_alloc_set'),
182 '',
183 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
184 );
185 break;
186
188
189 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
190 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
191 // Possible action => Edit course allocation, edit node mapping
192 $list->addItem(
193 $this->lng->txt('ecs_dir_alloc_set'),
194 '',
195 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'dStart')
196 );
197 $list->addItem(
198 $this->lng->txt('ecs_crs_alloc_set'),
199 '',
200 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
201 );
202 break;
203 }
204
205 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
206 $this->tpl->setCurrentBlock("actions");
207 $this->tpl->setVariable('ACTIONS', $list->getHTML());
208 $this->tpl->parseCurrentBlock();
209 }
210 }
211
219 public function parse($a_participants)
220 {
221 foreach ($a_participants as $participant) {
222 $tmp_arr['mid'] = $participant->getMID();
223 $tmp_arr['participants'] = $participant->getParticipantName();
224 $tmp_arr['description'] = $participant->getDescription();
225 $tmp_arr['email'] = $participant->getEmail();
226 $tmp_arr['dns'] = $participant->getDNS();
227
228 if ($participant->getOrganisation() instanceof ilECSOrganisation) {
229 $tmp_arr['abr'] = $participant->getOrganisation()->getAbbreviation();
230 $tmp_arr['org'] = $participant->getOrganisation()->getName();
231 }
232 $def[] = $tmp_arr;
233 }
234
235 $this->setData($def ? $def : array());
236 }
237}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
__construct(ilECSSetting $set, $a_parent_obj, $a_parent_cmd, $cid)
constructor
getServerId()
Get current server id.
Class ilTable2GUI.
getParentObject()
Get parent object.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
disable($a_module_name)
diesables particular modules of table
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$def
Definition: croninfo.php:21
global $ilCtrl
Definition: ilias.php:18
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41