ILIAS  release_8 Revision v8.24
class.ilECSCommunityTableGUI.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
24{
26
27
29
30 public function __construct(ilECSSetting $set, ?object $a_parent_obj, string $a_parent_cmd, int $cid)
31 {
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33
34 global $DIC;
35
36 $this->access = $DIC->access();
37
38 // TODO: set id
39 $this->setId($set->getServerId() . '_' . $cid . '_' . 'community_table');
40
41 $this->addColumn($this->lng->txt('ecs_participants'), 'participants', "35%");
42 $this->addColumn($this->lng->txt('ecs_participants_infos'), 'infos', "35%");
43 $this->addColumn($this->lng->txt('ecs_tbl_export'), 'export', '5%');
44 $this->addColumn($this->lng->txt('ecs_tbl_import'), 'import', '5%');
45 $this->addColumn($this->lng->txt('ecs_tbl_import_type'), 'type', '10%');
46
47 if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
48 $this->addColumn('', 'actions', '10%');
49 }
50
51 $this->disable('form');
52 $this->setRowTemplate("tpl.participant_row.html", "Services/WebServices/ECS");
53 $this->setDefaultOrderField('participants');
54 $this->setDefaultOrderDirection("desc");
55
56 $this->server = $set;
57 }
58
62 public function getServer(): ilECSSetting
63 {
64 return $this->server;
65 }
66
72 protected function fillRow(array $a_set): void
73 {
74 $this->tpl->setVariable('S_ID', $this->getServer()->getServerId());
75 $this->tpl->setVariable('M_ID', $a_set['mid']);
76 $this->tpl->setVariable('VAL_ID', $this->getServer()->getServerId() . '_' . $a_set['mid']);
77 $this->tpl->setVariable('VAL_ORG', (string) $a_set['org']);
78 $this->tpl->setVariable('VAL_TITLE', $a_set['participants']);
79 $this->tpl->setVariable('VAL_DESC', $a_set['description']);
80 $this->tpl->setVariable('VAL_EMAIL', $a_set['email']);
81 $this->tpl->setVariable('VAL_DNS', $a_set['dns']);
82 $this->tpl->setVariable('VAL_ABR', $a_set['abr']);
83 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
84 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
85 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
86 $this->tpl->setVariable('TXT_ID', $this->lng->txt('ecs_unique_id'));
87 $this->tpl->setVariable('TXT_ORG', $this->lng->txt('organization'));
88
89 $part = new ilECSParticipantSetting($this->getServer()->getServerId(), $a_set['mid']);
90
91
92 if ($part->isExportEnabled()) {
93 foreach ($part->getExportTypes() as $obj_type) {
94 $this->tpl->setCurrentBlock('obj_erow');
95 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('objs_' . $obj_type));
96 $this->tpl->parseCurrentBlock();
97 }
98 } else {
99 $this->lng->loadLanguageModule('administration');
100 $this->tpl->setVariable('TXT_OBJ_EINFO', $this->lng->txt('disabled'));
101 }
102
103 if ($part->isImportEnabled()) {
104 foreach ($part->getImportTypes() as $obj_type) {
105 $this->tpl->setCurrentBlock('obj_irow');
106 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('objs_' . $obj_type));
107 $this->tpl->parseCurrentBlock();
108 }
109 } else {
110 $this->lng->loadLanguageModule('administration');
111 $this->tpl->setVariable('TXT_OBJ_IINFO', $this->lng->txt('disabled'));
112 }
113 // :TODO: what types are to be supported?
115 $part->getImportType(),
116 'import_type[' . $this->getServer()->getServerId() . '][' . $a_set['mid'] . ']',
117 array(
118 ilECSParticipantSetting::IMPORT_RCRS => $this->lng->txt('obj_rcrs'),
119 ilECSParticipantSetting::IMPORT_CRS => $this->lng->txt('obj_crs'),
120 ilECSParticipantSetting::IMPORT_CMS => $this->lng->txt('ecs_import_cms')
121 ),
122 false,
123 true
124 );
125 $this->tpl->setVariable('IMPORT_SEL', $sel);
126
127 $list = new ilAdvancedSelectionListGUI();
128 $list->setItemLinkClass('small');
129 $list->setSelectionHeaderClass('small');
130 $list->setId('actl_' . $this->getServer()->getServerId() . '_' . $a_set['mid']);
131 $list->setListTitle($this->lng->txt('actions'));
132
133 $this->ctrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
134 $this->ctrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
135 $list->addItem(
136 $this->lng->txt('edit'),
137 '',
138 $this->ctrl->getLinkTargetByClass('ilecsparticipantsettingsgui', 'settings')
139 );
140
141 switch ($part->getImportType()) {
143 // Do nothing
144 break;
145
147 // Possible action => Edit course allocation
148 $this->ctrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
149 $this->ctrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
150 $list->addItem(
151 $this->lng->txt('ecs_crs_alloc_set'),
152 '',
153 $this->ctrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
154 );
155 break;
156
158
159 $this->ctrl->setParameter($this->getParentObject(), 'server_id', $this->getServer()->getServerId());
160 $this->ctrl->setParameter($this->getParentObject(), 'mid', $a_set['mid']);
161 // Possible action => Edit course allocation, edit node mapping
162 $list->addItem(
163 $this->lng->txt('ecs_dir_alloc_set'),
164 '',
165 $this->ctrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'dStart')
166 );
167 $list->addItem(
168 $this->lng->txt('ecs_crs_alloc_set'),
169 '',
170 $this->ctrl->getLinkTargetByClass('ilecsmappingsettingsgui', 'cStart')
171 );
172 break;
173 }
174
175 if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
176 $this->tpl->setCurrentBlock("actions");
177 $this->tpl->setVariable('ACTIONS', $list->getHTML());
178 $this->tpl->parseCurrentBlock();
179 }
180 }
181
185 public function parse(array $participants): void
186 {
187 foreach ($participants as $participant) {
188 $tmp_arr['mid'] = $participant->getMID();
189 $tmp_arr['participants'] = $participant->getParticipantName();
190 $tmp_arr['description'] = $participant->getDescription();
191 $tmp_arr['email'] = $participant->getEmail();
192 $tmp_arr['dns'] = $participant->getDNS();
193
194 if ($participant->getOrganisation() instanceof ilECSOrganisation) {
195 $tmp_arr['abr'] = $participant->getOrganisation()->getAbbreviation();
196 $tmp_arr['org'] = $participant->getOrganisation()->getName();
197 }
198 $def[] = $tmp_arr;
199 }
200
201 $this->setData($def ?? []);
202 }
203}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilECSSetting $set, ?object $a_parent_obj, string $a_parent_cmd, int $cid)
getServerId()
Get current server id.
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
disable(string $a_module_name)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc