ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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;
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 $this->addColumn('', 'actions','10%');
68 $this->disable('form');
69 $this->setRowTemplate("tpl.participant_row.html","Services/WebServices/ECS");
70 $this->setDefaultOrderField('participants');
71 $this->setDefaultOrderDirection("desc");
72
73 $this->cid = $cid;
74 $this->server = $set;
75 }
76
81 public function getServer()
82 {
83 return $this->server;
84 }
85
93 public function fillRow($a_set)
94 {
95 global $ilCtrl;
96
97 $this->tpl->setVariable('S_ID', $this->getServer()->getServerId());
98 $this->tpl->setVariable('M_ID', $a_set['mid']);
99 $this->tpl->setVariable('VAL_ID', $this->getServer()->getServerId().'_'.$a_set['mid']);
100 $this->tpl->setVariable('VAL_ORG', (string) $a_set['org']);
101 $this->tpl->setVariable('VAL_CHECKED',$a_set['checked'] ? 'checked="checked"' : '');
102 $this->tpl->setVariable('VAL_TITLE',$a_set['participants']);
103 $this->tpl->setVariable('VAL_DESC',$a_set['description']);
104 $this->tpl->setVariable('VAL_EMAIL',$a_set['email']);
105 $this->tpl->setVariable('VAL_DNS',$a_set['dns']);
106 $this->tpl->setVariable('VAL_ABR',$a_set['abr']);
107 $this->tpl->setVariable('TXT_EMAIL',$this->lng->txt('ecs_email'));
108 $this->tpl->setVariable('TXT_DNS',$this->lng->txt('ecs_dns'));
109 $this->tpl->setVariable('TXT_ABR',$this->lng->txt('ecs_abr'));
110 $this->tpl->setVariable('TXT_ID',$this->lng->txt('ecs_unique_id'));
111 $this->tpl->setVariable('TXT_ORG', $this->lng->txt('organization'));
112
113 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
114 $part = new ilECSParticipantSetting($this->getServer()->getServerId(), $a_set['mid']);
115
116
117 if($part->isExportEnabled())
118 {
119 foreach($part->getExportTypes() as $obj_type)
120 {
121 $this->tpl->setCurrentBlock('obj_erow');
122 $this->tpl->setVariable('TXT_OBJ_EINFO',$this->lng->txt('objs_'.$obj_type));
123 $this->tpl->parseCurrentBlock();
124 }
125 }
126 else
127 {
128 $this->lng->loadLanguageModule('administration');
129 $this->tpl->setVariable('TXT_OBJ_EINFO',$this->lng->txt('disabled'));
130 }
131
132 if($part->isImportEnabled())
133 {
134 foreach($part->getImportTypes() as $obj_type)
135 {
136 $this->tpl->setCurrentBlock('obj_irow');
137 $this->tpl->setVariable('TXT_OBJ_IINFO',$this->lng->txt('objs_'.$obj_type));
138 $this->tpl->parseCurrentBlock();
139 }
140 }
141 else
142 {
143 $this->lng->loadLanguageModule('administration');
144 $this->tpl->setVariable('TXT_OBJ_IINFO',$this->lng->txt('disabled'));
145 }
146 // :TODO: what types are to be supported?
147 $sel = ilUtil::formSelect(
148 $part->getImportType(),
149 'import_type['.$this->getServer()->getServerId().']['.$a_set['mid'].']',
150 array(
151 ilECSParticipantSetting::IMPORT_RCRS => $this->lng->txt('obj_rcrs'),
152 ilECSParticipantSetting::IMPORT_CRS => $this->lng->txt('obj_crs'),
153 ilECSParticipantSetting::IMPORT_CMS => $this->lng->txt('ecs_import_cms')
154 ),
155 false,
156 true
157 );
158 $this->tpl->setVariable('IMPORT_SEL', $sel);
159
160 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
161 $list = new ilAdvancedSelectionListGUI();
162 $list->setItemLinkClass('small');
163 $list->setSelectionHeaderClass('small');
164 $list->setId('actl_'.$a_set['server_id'].'_'.$a_set['mid']);
165 $list->setListTitle($this->lng->txt('actions'));
166
167 $ilCtrl->setParameter($this->getParentObject(),'server_id',$this->getServer()->getServerId());
168 $ilCtrl->setParameter($this->getParentObject(),'mid',$a_set['mid']);
169 $list->addItem(
170 $this->lng->txt('edit'),
171 '',
172 $ilCtrl->getLinkTargetByClass('ilecsparticipantsettingsgui','settings')
173 );
174
175 switch($part->getImportType())
176 {
178 // Do nothing
179 break;
180
182 // Possible action => Edit course allocation
183 $ilCtrl->setParameter($this->getParentObject(),'server_id',$this->getServer()->getServerId());
184 $ilCtrl->setParameter($this->getParentObject(),'mid',$a_set['mid']);
185 $list->addItem(
186 $this->lng->txt('ecs_crs_alloc_set'),
187 '',
188 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui','cStart')
189 );
190 break;
191
193
194 $ilCtrl->setParameter($this->getParentObject(),'server_id',$this->getServer()->getServerId());
195 $ilCtrl->setParameter($this->getParentObject(),'mid',$a_set['mid']);
196 // Possible action => Edit course allocation, edit node mapping
197 $list->addItem(
198 $this->lng->txt('ecs_dir_alloc_set'),
199 '',
200 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui','dStart')
201 );
202 $list->addItem(
203 $this->lng->txt('ecs_crs_alloc_set'),
204 '',
205 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui','cStart')
206 );
207 break;
208 }
209 $this->tpl->setVariable('ACTIONS',$list->getHTML());
210 }
211
219 public function parse($a_participants)
220 {
221 foreach($a_participants as $participant)
222 {
223 $tmp_arr['mid'] = $participant->getMID();
224 $tmp_arr['participants'] = $participant->getParticipantName();
225 $tmp_arr['description'] = $participant->getDescription();
226 $tmp_arr['email'] = $participant->getEmail();
227 $tmp_arr['dns'] = $participant->getDNS();
228
229 if($participant->getOrganisation() instanceof ilECSOrganisation)
230 {
231 $tmp_arr['abr'] = $participant->getOrganisation()->getAbbreviation();
232 $tmp_arr['org'] = $participant->getOrganisation()->getName();
233 }
234 $def[] = $tmp_arr;
235 }
236
237 $this->setData($def ? $def : array());
238 }
239
240}
241
242
243?>
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.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
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.
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.
global $ilCtrl
Definition: ilias.php:18