ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $DIC;
54
55 $lng = $DIC['lng'];
56 $ilCtrl = $DIC['ilCtrl'];
57 $ilAccess = $DIC['ilAccess'];
58
59 $this->lng = $lng;
60 $this->ctrl = $ilCtrl;
61
62 // TODO: set id
63 $this->setId($set->getServerId() . '_' . $cid . '_' . 'community_table');
64
65 parent::__construct($a_parent_obj, $a_parent_cmd);
66 $this->addColumn($this->lng->txt('ecs_participants'), 'participants', "35%");
67 $this->addColumn($this->lng->txt('ecs_participants_infos'), 'infos', "35%");
68 $this->addColumn($this->lng->txt('ecs_tbl_export'), 'export', '5%');
69 $this->addColumn($this->lng->txt('ecs_tbl_import'), 'import', '5%');
70 $this->addColumn($this->lng->txt('ecs_tbl_import_type'), 'type', '10%');
71
72 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
73 $this->addColumn('', 'actions', '10%');
74 }
75
76 $this->disable('form');
77 $this->setRowTemplate("tpl.participant_row.html", "Services/WebServices/ECS");
78 $this->setDefaultOrderField('participants');
79 $this->setDefaultOrderDirection("desc");
80
81 $this->cid = $cid;
82 $this->server = $set;
83 }
84
89 public function getServer()
90 {
91 return $this->server;
92 }
93
101 public function fillRow($a_set)
102 {
103 global $DIC;
104
105 $ilCtrl = $DIC['ilCtrl'];
106 $ilAccess = $DIC['ilAccess'];
107
108 $this->tpl->setVariable('S_ID', $this->getServer()->getServerId());
109 $this->tpl->setVariable('M_ID', $a_set['mid']);
110 $this->tpl->setVariable('VAL_ID', $this->getServer()->getServerId() . '_' . $a_set['mid']);
111 $this->tpl->setVariable('VAL_ORG', (string) $a_set['org']);
112 $this->tpl->setVariable('VAL_CHECKED', $a_set['checked'] ? 'checked="checked"' : '');
113 $this->tpl->setVariable('VAL_TITLE', $a_set['participants']);
114 $this->tpl->setVariable('VAL_DESC', $a_set['description']);
115 $this->tpl->setVariable('VAL_EMAIL', $a_set['email']);
116 $this->tpl->setVariable('VAL_DNS', $a_set['dns']);
117 $this->tpl->setVariable('VAL_ABR', $a_set['abr']);
118 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
119 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
120 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
121 $this->tpl->setVariable('TXT_ID', $this->lng->txt('ecs_unique_id'));
122 $this->tpl->setVariable('TXT_ORG', $this->lng->txt('organization'));
123
124 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
125 $part = new ilECSParticipantSetting($this->getServer()->getServerId(), $a_set['mid']);
126
127
128 if ($part->isExportEnabled()) {
129 foreach ($part->getExportTypes() as $obj_type) {
130 $this->tpl->setCurrentBlock('obj_erow');
131 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('objs_' . $obj_type));
132 $this->tpl->parseCurrentBlock();
133 }
134 } else {
135 $this->lng->loadLanguageModule('administration');
136 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('disabled'));
137 }
138
139 if ($part->isImportEnabled()) {
140 foreach ($part->getImportTypes() as $obj_type) {
141 $this->tpl->setCurrentBlock('obj_irow');
142 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('objs_' . $obj_type));
143 $this->tpl->parseCurrentBlock();
144 }
145 } else {
146 $this->lng->loadLanguageModule('administration');
147 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('disabled'));
148 }
149 // :TODO: what types are to be supported?
150 $sel = ilUtil::formSelect(
151 $part->getImportType(),
152 'import_type[' . $this->getServer()->getServerId() . '][' . $a_set['mid'] . ']',
153 array(
154 ilECSParticipantSetting::IMPORT_RCRS => $this->lng->txt('obj_rcrs'),
155 ilECSParticipantSetting::IMPORT_CRS => $this->lng->txt('obj_crs'),
156 ilECSParticipantSetting::IMPORT_CMS => $this->lng->txt('ecs_import_cms')
157 ),
158 false,
159 true
160 );
161 $this->tpl->setVariable('IMPORT_SEL', $sel);
162
163 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
164 $list = new ilAdvancedSelectionListGUI();
165 $list->setItemLinkClass('small');
166 $list->setSelectionHeaderClass('small');
167 $list->setId('actl_' . $a_set['server_id'] . '_' . $a_set['mid']);
168 $list->setListTitle($this->lng->txt('actions'));
169
170 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
171 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
172 $list->addItem(
173 $this->lng->txt('edit'),
174 '',
175 $ilCtrl->getLinkTargetByClass('ilecsparticipantsettingsgui', 'settings')
176 );
177
178 switch ($part->getImportType()) {
180 // Do nothing
181 break;
182
184 // Possible action => Edit course allocation
185 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
186 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
187 $list->addItem(
188 $this->lng->txt('ecs_crs_alloc_set'),
189 '',
190 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
191 );
192 break;
193
195
196 $ilCtrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
197 $ilCtrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
198 // Possible action => Edit course allocation, edit node mapping
199 $list->addItem(
200 $this->lng->txt('ecs_dir_alloc_set'),
201 '',
202 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'dStart')
203 );
204 $list->addItem(
205 $this->lng->txt('ecs_crs_alloc_set'),
206 '',
207 $ilCtrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
208 );
209 break;
210 }
211
212 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
213 $this->tpl->setCurrentBlock("actions");
214 $this->tpl->setVariable('ACTIONS', $list->getHTML());
215 $this->tpl->parseCurrentBlock();
216 }
217 }
218
226 public function parse($a_participants)
227 {
228 foreach ($a_participants as $participant) {
229 $tmp_arr['mid'] = $participant->getMID();
230 $tmp_arr['participants'] = $participant->getParticipantName();
231 $tmp_arr['description'] = $participant->getDescription();
232 $tmp_arr['email'] = $participant->getEmail();
233 $tmp_arr['dns'] = $participant->getDNS();
234
235 if ($participant->getOrganisation() instanceof ilECSOrganisation) {
236 $tmp_arr['abr'] = $participant->getOrganisation()->getAbbreviation();
237 $tmp_arr['org'] = $participant->getOrganisation()->getName();
238 }
239 $def[] = $tmp_arr;
240 }
241
242 $this->setData($def ? $def : array());
243 }
244}
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.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc