ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilECSSettingsGUI.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/WebServices/ECS/classes/class.ilECSServerSettings.php';
25
36{
37 const MAPPING_EXPORT = 1;
38 const MAPPING_IMPORT = 2;
39
43 protected $log = null;
44
45 protected $tpl;
46 protected $lng;
47 protected $ctrl;
48 protected $tabs_gui;
49
50
56 public function __construct()
57 {
58 global $lng,$tpl,$ilCtrl,$ilTabs;
59
60 $this->tpl = $tpl;
61 $this->lng = $lng;
62 $this->lng->loadLanguageModule('ecs');
63 $this->ctrl = $ilCtrl;
64 $this->tabs_gui = $ilTabs;
65
66 $this->log = $GLOBALS['DIC']->logger()->wsrv();
67
68 $this->initSettings();
69 }
70
78 public function executeCommand()
79 {
80 global $ilAccess;
81 $next_class = $this->ctrl->getNextClass($this);
82 $cmd = $this->ctrl->getCmd();
83
84 $this->setSubTabs();
85 switch ($next_class) {
86 case 'ilecsmappingsettingsgui':
87 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingSettingsGUI.php';
88 $mapset = new ilECSMappingSettingsGUI($this, (int) $_REQUEST['server_id'], (int) $_REQUEST['mid']);
89 $this->ctrl->setReturn($this, 'communities');
90 $this->ctrl->forwardCommand($mapset);
91 break;
92
93 case 'ilecsparticipantsettingsgui':
94 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettingsGUI.php';
96 (int) $_REQUEST['server_id'],
97 (int) $_REQUEST['mid']
98 );
99 $this->ctrl->setReturn($this, 'communities');
100 $this->ctrl->forwardCommand($part);
101 break;
102
103 default:
104
105 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"]) && $cmd != "overview" && $cmd != "communities") {
106 $this->ctrl->redirect($this, "overview");
107 }
108
109 if (!$cmd || $cmd == 'view') {
110 $cmd = "overview";
111 }
112 $this->$cmd();
113 break;
114 }
115 return true;
116 }
117
124 public function overview()
125 {
126 global $ilToolbar,$ilTabs, $ilAccess;
127
128 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
129
130 $ilTabs->setSubTabActive('overview');
131 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
132 $ilToolbar->addButton(
133 $this->lng->txt('ecs_add_new_ecs'),
134 $this->ctrl->getLinkTarget($this, 'create')
135 );
136 }
137
139 $servers->readInactiveServers();
140
141 include_once './Services/WebServices/ECS/classes/class.ilECSServerTableGUI.php';
142 $table = new ilECSServerTableGUI($this, 'overview');
143 $table->initTable();
144 $table->parse($servers);
145 $this->tpl->setContent($table->getHTML());
146 return;
147 }
148
152 protected function activate()
153 {
154 $this->initSettings($_REQUEST['server_id']);
155 $this->settings->setEnabledStatus(true);
156 $this->settings->update();
157 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
158 $this->ctrl->redirect($this, 'overview');
159 }
160
164 protected function deactivate()
165 {
166 $this->initSettings($_REQUEST['server_id']);
167 $this->settings->setEnabledStatus(false);
168 $this->settings->update();
169 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
170 $this->ctrl->redirect($this, 'overview');
171 }
172
178 protected function readAll()
179 {
180 include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
181 include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
182 include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
183 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
184
185 try {
186 foreach (ilECSServerSettings::getInstance()->getServers() as $server) {
189
190 include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
191 ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
192
193 ilUtil::sendInfo($this->lng->txt('ecs_remote_imported'));
194 $this->imported();
195 return true;
196 }
197 } catch (ilECSConnectorException $e1) {
198 ilUtil::sendInfo('Cannot connect to ECS server: ' . $e1->getMessage());
199 $this->imported();
200 return false;
201 } catch (ilException $e2) {
202 ilUtil::sendInfo('Update failed: ' . $e1->getMessage());
203 $this->imported();
204 return false;
205 }
206 }
207
212 protected function create()
213 {
214 global $ilTabs;
215
216 $this->initSettings(0);
217
218 $ilTabs->clearTargets();
219 $ilTabs->clearSubTabs();
220 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
221
222 $this->initSettingsForm('create');
223 $this->tabs_gui->setSubTabActive('ecs_settings');
224
225 $this->tpl->setContent($this->form->getHTML());
226 }
227
231 protected function edit()
232 {
233 global $ilTabs;
234
235 $this->initSettings((int) $_REQUEST['server_id']);
236 $this->ctrl->saveParameter($this, 'server_id', (int) $_REQUEST['server_id']);
237
238 $ilTabs->clearTargets();
239 $ilTabs->clearSubTabs();
240 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
241
242 $this->initSettingsForm();
243 $this->tabs_gui->setSubTabActive('ecs_settings');
244
245 $this->tpl->setContent($this->form->getHTML());
246 }
247
248 protected function cp()
249 {
250 $this->initSettings((int) $_REQUEST['server_id']);
251
252 $copy = clone $this->settings;
253 $copy->save();
254
255 $this->ctrl->setParameter($this, 'server_id', $copy->getServerId());
256 ilUtil::sendSuccess($this->lng->txt('ecs_settings_cloned'), true);
257 $this->ctrl->redirect($this, 'edit');
258 }
259
263 protected function delete()
264 {
265 global $ilTabs;
266
267 $this->initSettings((int) $_REQUEST['server_id']);
268
269 $ilTabs->clearTargets();
270 $ilTabs->clearSubTabs();
271 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
272
273 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
274 $confirm = new ilConfirmationGUI();
275 $confirm->setFormAction($this->ctrl->getFormAction($this));
276 $confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
277 $confirm->setCancel($this->lng->txt('cancel'), 'overview');
278 $confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
279
280 $confirm->addItem('', '', $this->settings->getServer());
281 $confirm->addHiddenItem('server_id', $this->settings->getServerId());
282
283 $this->tpl->setContent($confirm->getHTML());
284 }
285
289 protected function doDelete()
290 {
291 $this->initSettings($_REQUEST['server_id']);
292 $this->settings->delete();
293
294 // Delete communities
295 include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
296 ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']);
297
298 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
299 ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']);
300
301 include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
302 ilECSEventQueueReader::deleteServer((int) $_REQUEST['server_id']);
303
304 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
305 ilECSExport::deleteByServer((int) $_REQUEST['server_id']);
306
307 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
308 ilECSImport::deleteByServer((int) $_REQUEST['server_id']);
309
310 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
311 ilECSParticipantSettings::deleteByServer((int) $_REQUEST['server_id']);
312
313 ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'), true);
314 $this->ctrl->redirect($this, 'overview');
315 }
316
317
323 protected function settings()
324 {
325 $this->initSettingsForm();
326 $this->tabs_gui->setSubTabActive('ecs_settings');
327
328 $this->tpl->setContent($this->form->getHTML());
329 }
330
336 protected function initSettingsForm($a_mode = 'update')
337 {
338 if (is_object($this->form)) {
339 return true;
340 }
341 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
342
343 $this->form = new ilPropertyFormGUI();
344 $this->form->setFormAction($this->ctrl->getFormAction($this, 'settings'));
345 $this->form->setTitle($this->lng->txt('ecs_connection_settings'));
346
347 $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'), 'active');
348 $ena->setChecked($this->settings->isEnabled());
349 $ena->setValue(1);
350 $this->form->addItem($ena);
351
352 $server_title = new ilTextInputGUI($this->lng->txt('ecs_server_title'), 'title');
353 $server_title->setValue($this->settings->getTitle());
354 $server_title->setSize(80);
355 $server_title->setMaxLength(128);
356 $server_title->setRequired(true);
357 $this->form->addItem($server_title);
358
359 $ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'), 'server');
360 $ser->setValue((string) $this->settings->getServer());
361 $ser->setRequired(true);
362 $this->form->addItem($ser);
363
364 $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'), 'protocol');
365 // fixed to https
366 #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
367 # ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
368 $pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS'));
369 $pro->setValue($this->settings->getProtocol());
370 $pro->setRequired(true);
371 $this->form->addItem($pro);
372
373 $por = new ilTextInputGUI($this->lng->txt('ecs_port'), 'port');
374 $por->setSize(5);
375 $por->setMaxLength(5);
376 $por->setValue((string) $this->settings->getPort());
377 $por->setRequired(true);
378 $this->form->addItem($por);
379
380 $tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'), 'auth_type');
381 $tcer->setValue($this->settings->getAuthType());
382 $this->form->addItem($tcer);
383
384 // Certificate based authentication
385 $cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), ilECSSetting::AUTH_CERTIFICATE);
386 $tcer->addOption($cert_based);
387
388 $cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'), 'client_cert');
389 $cli->setSize(60);
390 $cli->setValue((string) $this->settings->getClientCertPath());
391 $cli->setRequired(true);
392 $cert_based->addSubItem($cli);
393
394 $key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'), 'key_path');
395 $key->setSize(60);
396 $key->setValue((string) $this->settings->getKeyPath());
397 $key->setRequired(true);
398 $cert_based->addSubItem($key);
399
400 $cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'), 'key_password');
401 $cerp->setSize(12);
402 $cerp->setValue((string) $this->settings->getKeyPassword());
403 $cerp->setInputType('password');
404 $cerp->setRequired(true);
405 $cert_based->addSubItem($cerp);
406
407 $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'), 'ca_cert');
408 $cer->setSize(60);
409 $cer->setValue((string) $this->settings->getCACertPath());
410 $cer->setRequired(true);
411 $cert_based->addSubItem($cer);
412
413 // Apache auth
414 $apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), ilECSSetting::AUTH_APACHE);
415 $tcer->addOption($apa_based);
416
417 $user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'), 'auth_user');
418 $user->setSize(32);
419 $user->setValue((string) $this->settings->getAuthUser());
420 $user->setRequired(true);
421 $apa_based->addSubItem($user);
422
423 $pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass');
424 $pass->setRetype(false);
425 $pass->setSize(32);
426 $pass->setMaxLength(128);
427 $pass->setValue((string) $this->settings->getAuthPass());
428 $pass->setRequired(true);
429 $pass->setSkipSyntaxCheck(true);
430 $apa_based->addSubItem($pass);
431
432
433 $ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
434 $ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value'));
435 $cert_based->addSubItem($ser);
436
437 $loc = new ilFormSectionHeaderGUI();
438 $loc->setTitle($this->lng->txt('ecs_local_settings'));
439 $this->form->addItem($loc);
440
441 $pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'), 'polling');
442 $pol->setShowDays(false);
443 $pol->setShowHours(false);
444 $pol->setShowMinutes(true);
445 $pol->setShowSeconds(true);
446 $pol->setSeconds($this->settings->getPollingTimeSeconds());
447 $pol->setMinutes($this->settings->getPollingTimeMinutes());
448 $pol->setRequired(true);
449 $pol->setInfo($this->lng->txt('ecs_polling_info'));
450 $this->form->addItem($pol);
451
452 $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'));
453 $imp->setRequired(true);
454
455 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
456 $tpl->setVariable('SIZE', 5);
457 $tpl->setVariable('MAXLENGTH', 11);
458 $tpl->setVariable('POST_VAR', 'import_id');
459 $tpl->setVariable('PROPERTY_VALUE', $this->settings->getImportId());
460
461 if ($this->settings->getImportId()) {
462 $path = $this->buildPath($this->settings->getImportId());
463 if ($path == '') {
464 $imp->setAlert($this->lng->txt('err_check_input'));
465 } else {
466 $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->settings->getImportId()));
467 }
468 }
469
470 $imp->setHTML($tpl->get());
471 $imp->setInfo($this->lng->txt('ecs_import_id_info'));
472 $this->form->addItem($imp);
473
474 $loc = new ilFormSectionHeaderGUI();
475 $loc->setTitle($this->lng->txt('ecs_remote_user_settings'));
476 $this->form->addItem($loc);
477
478 $role = new ilSelectInputGUI($this->lng->txt('ecs_role'), 'global_role');
479 $role->setOptions($this->prepareRoleSelect());
480 $role->setValue($this->settings->getGlobalRole());
481 $role->setInfo($this->lng->txt('ecs_global_role_info'));
482 $role->setRequired(true);
483 $this->form->addItem($role);
484
485 $duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'), 'duration');
486 $duration->setInfo($this->lng->txt('ecs_account_duration_info'));
487 $duration->setMonths($this->settings->getDuration());
488 $duration->setShowSeconds(false);
489 $duration->setShowMinutes(false);
490 $duration->setShowHours(false);
491 $duration->setShowDays(false);
492 $duration->setShowMonths(true);
493 $duration->setRequired(true);
494 $this->form->addItem($duration);
495
496 // Email recipients
497 $loc = new ilFormSectionHeaderGUI();
498 $loc->setTitle($this->lng->txt('ecs_notifications'));
499 $this->form->addItem($loc);
500
501 $rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'), 'user_recipients');
502 $rcp_user->setValue((string) $this->settings->getUserRecipientsAsString());
503 $rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info'));
504 $this->form->addItem($rcp_user);
505
506 $rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'), 'econtent_recipients');
507 $rcp_econ->setValue((string) $this->settings->getEContentRecipientsAsString());
508 $rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info'));
509 $this->form->addItem($rcp_econ);
510
511 $rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'), 'approval_recipients');
512 $rcp_app->setValue((string) $this->settings->getApprovalRecipientsAsString());
513 $rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
514 $this->form->addItem($rcp_app);
515
516 if ($a_mode == 'update') {
517 $this->form->addCommandButton('update', $this->lng->txt('save'));
518 } else {
519 $this->form->addCommandButton('save', $this->lng->txt('save'));
520 }
521 $this->form->addCommandButton('overview', $this->lng->txt('cancel'));
522 }
523
529 protected function update()
530 {
531 $this->initSettings((int) $_REQUEST['server_id']);
532 $this->loadFromPost();
533
534 if (!$error = $this->settings->validate()) {
535 $this->settings->update();
536 $this->initTaskScheduler();
537 #$this->updateTitle();
538 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
539 } else {
540 ilUtil::sendInfo($this->lng->txt($error));
541 $this->edit();
542 }
543
544 $this->overview();
545 return true;
546 }
547
552 protected function save()
553 {
554 $this->initSettings(0);
555 $this->loadFromPost();
556
557 if (!$error = $this->settings->validate()) {
558 $this->settings->save();
559 $this->initTaskScheduler();
560
561 #$this->updateTitle();
562 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
563 } else {
564 ilUtil::sendInfo($this->lng->txt($error));
565 return $this->create();
566 }
567 $GLOBALS['ilCtrl']->redirect($this, 'overview');
568 return true;
569 }
570
574 protected function updateTitle()
575 {
576 try {
577 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
579
580 foreach ($reader->getCommunities() as $community) {
581 foreach ($community->getParticipants() as $part) {
582 $this->log->dump($community);
583 if ($part->isSelf()) {
584 $this->settings->setTitle($part->getParticipantName());
585 $this->settings->update();
586 return true;
587 }
588 }
589 }
590 } catch (ilECSConnectorException $exc) {
591 ilUtil::sendFailure($exc->getMessage());
592 }
593 $this->settings->setTitle('');
594 $this->settings->update();
595 }
596
600 protected function loadFromPost()
601 {
602 $this->settings->setEnabledStatus((int) $_POST['active']);
603 $this->settings->setTitle(ilUtil::stripSlashes($_POST['title']));
604 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
605 $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
606 $this->settings->setProtocol(ilUtil::stripSlashes($_POST['protocol']));
607 $this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
608 $this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
609 $this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
610 $this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
611 $this->settings->setImportId(ilUtil::stripSlashes($_POST['import_id']));
612 $this->settings->setPollingTimeMS((int) $_POST['polling']['mm'], (int) $_POST['polling']['ss']);
613 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
614 $this->settings->setGlobalRole((int) $_POST['global_role']);
615 $this->settings->setDuration((int) $_POST['duration']['MM']);
616
617 $this->settings->setUserRecipients(ilUtil::stripSlashes($_POST['user_recipients']));
618 $this->settings->setEContentRecipients(ilUtil::stripSlashes($_POST['econtent_recipients']));
619 $this->settings->setApprovalRecipients(ilUtil::stripSlashes($_POST['approval_recipients']));
620
621 $this->settings->setAuthType((int) $_POST['auth_type']);
622 $this->settings->setAuthPass(ilUtil::stripSlashes($_POST['auth_pass']));
623 $this->settings->setAuthUser(ilUtil::stripSlashes($_POST['auth_user']));
624 }
625
629 protected function refreshParticipants()
630 {
631 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
632 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
633 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
634 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
635
637 $servers->readInactiveServers();
638 foreach ($servers->getServers() as $server) {
639
640 // read community
641 try {
642 $creader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
643 foreach (ilECSParticipantSettings::getAvailabeMids($server->getServerId()) as $mid) {
644 if (!$creader->getParticipantByMID($mid)) {
645 $this->log->notice('Deleting deprecated participant: ' . $server->getServerId() . ' ' . $mid);
646 $part = new ilECSParticipantSetting($server->getServerId(), $mid);
647 $part->delete();
648 }
649 }
650 } catch (ilECSConnectorException $e) {
651 ilUtil::sendFailure($server->getServer() . ': ' . $e->getMessage(), true);
652 }
653 }
654 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
655 $this->ctrl->redirect($this, 'communities');
656 }
657
664 public function communities()
665 {
666 global $ilAccess;
667 // add toolbar to refresh communities
668 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
669 $GLOBALS['ilToolbar']->addButton(
670 $this->lng->txt('ecs_refresh_participants'),
671 $this->ctrl->getLinkTarget($this, 'refreshParticipants')
672 );
673 }
674
675
676 $this->tabs_gui->setSubTabActive('ecs_communities');
677
678 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ecs_communities.html', 'Services/WebServices/ECS');
679
680 $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'updateCommunities'));
681
682 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
683 $this->tpl->setCurrentBlock("submit_buttons");
684 $this->tpl->setVariable('TXT_SAVE', $this->lng->txt('save'));
685 $this->tpl->setVariable('TXT_CANCEL', $this->lng->txt('cancel'));
686 $this->tpl->parseCurrentBlock();
687 }
688
689 include_once('Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
690 include_once('Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
691
692 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
694 #$settings->readInactiveServers();
695
696 foreach ($settings->getServers() as $server) {
697 // Try to read communities
698 try {
700 foreach ($reader->getCommunities() as $community) {
701 $this->tpl->setCurrentBlock('table_community');
702 $table_gui = new ilECSCommunityTableGUI($server, $this, 'communities', $community->getId());
703 $table_gui->setTitle($community->getTitle() . ' (' . $community->getDescription() . ')');
704 $table_gui->parse($community->getParticipants());
705 $this->tpl->setVariable('TABLE_COMM', $table_gui->getHTML());
706 $this->tpl->parseCurrentBlock();
707 }
708 } catch (ilECSConnectorException $exc) {
709 // Maybe server is not fully configured
710 continue;
711 }
712
713 // Show section for each server
714 $this->tpl->setCurrentBlock('server');
715 $this->tpl->setVariable('TXT_SERVER_NAME', $server->getTitle());
716 $this->tpl->parseCurrentBlock();
717 }
718 }
719
725 protected function validateImportTypes(&$import_types)
726 {
727 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
728
729 $num_cms = 0;
730 foreach ((array) $import_types as $sid => $server) {
731 foreach ((array) $server as $mid => $import_type) {
732 if ($import_type == ilECSParticipantSetting::IMPORT_CMS) {
733 ++$num_cms;
734 }
735 }
736 }
737
738 if ($num_cms <= 1) {
739 return true;
740 }
741 // Change to import type "UNCHANGED"
742 $new_types = array();
743 foreach ((array) $import_types as $sid => $server) {
744 foreach ((array) $server as $mid => $import_type) {
745 if ($import_type == ilECSParticipantSetting::IMPORT_CMS) {
746 $new_types[$sid][$mid] = ilECSParticipantSetting::IMPORT_UNCHANGED;
747 } else {
748 $new_types[$sid][$mid] = $import_type;
749 }
750 }
751 }
752 $import_types = $new_types;
753 return false;
754 }
755
762 protected function updateCommunities()
763 {
764 global $ilLog;
765
766 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
767 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
768
769 // @TODO: Delete deprecated communities
770 $invalidImportTypes = false;
771 if (!$this->validateImportTypes($_POST['import_type'])) {
772 $invalidImportTypes = true;
773 }
774
776 foreach ($servers->getServers() as $server) {
777 try {
778 // Read communities
779 $cReader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
780
781 // Update community cache
782 foreach ($cReader->getCommunities() as $community) {
783 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
784 $cCache = ilECSCommunityCache::getInstance($server->getServerId(), $community->getId());
785 $cCache->setCommunityName($community->getTitle());
786 $cCache->setMids($community->getMids());
787 $cCache->setOwnId($community->getOwnId());
788 $cCache->update();
789 }
790 } catch (Exception $e) {
791 $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
792 }
793 }
794
795 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
796 foreach ((array) $_POST['sci_mid'] as $sid => $tmp) {
797 foreach ((array) $_POST['sci_mid'][$sid] as $mid => $tmp) {
798 $set = new ilECSParticipantSetting($sid, $mid);
799 #$set->enableExport(array_key_exists($mid, (array) $_POST['export'][$sid]) ? true : false);
800 #$set->enableImport(array_key_exists($mid, (array) $_POST['import'][$sid]) ? true : false);
801 $set->setImportType($_POST['import_type'][$sid][$mid]);
802
803 // update title/cname
804 try {
805 $part = ilECSCommunityReader::getInstanceByServerId($sid)->getParticipantByMID($mid);
806 if ($part instanceof ilECSParticipant) {
807 $set->setTitle($part->getParticipantName());
808 }
809 $com = ilECSCommunityReader::getInstanceByServerId($sid)->getCommunityByMID($mid);
810 if ($com instanceof ilECSCommunity) {
811 $set->setCommunityName($com->getTitle());
812 }
813 } catch (Exception $e) {
814 $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
815 }
816
817 $set->update();
818 }
819 }
820 if ($invalidImportTypes) {
821 ilUtil::sendFailure($this->lng->txt('ecs_invalid_import_type_cms'), true);
822 } else {
823 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
824 }
825 $GLOBALS['ilCtrl']->redirect($this, 'communities');
826
827 // TODO: Do update of remote courses and ...
828
829 return true;
830 }
831
832
838 protected function setMappingTabs($a_active)
839 {
840 global $ilTabs, $ilAccess;
841
842 $ilTabs->clearTargets();
843 $ilTabs->clearSubTabs();
844
845 $ilTabs->setBackTarget(
846 $this->lng->txt('ecs_settings'),
847 $this->ctrl->getLinkTarget($this, 'overview')
848 );
849 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
850 $ilTabs->addTab(
851 'import',
852 $this->lng->txt('ecs_tab_import'),
853 $this->ctrl->getLinkTarget($this, 'importMappings')
854 );
855 }
856 $ilTabs->addTab(
857 'export',
858 $this->lng->txt('ecs_tab_export'),
859 $this->ctrl->getLinkTarget($this, 'exportMappings')
860 );
861
862
863 switch ($a_active) {
865 $ilTabs->activateTab('import');
866 break;
867
869 $ilTabs->activateTab('export');
870 break;
871 }
872 return true;
873 }
874
880 public function importMappings()
881 {
882 global $ilToolbar;
883
884 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
885
886 $this->setMappingTabs(self::MAPPING_IMPORT);
887
889 if (!count($fields)) {
890 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
891 return true;
892 }
893
894 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
896 $settings->readInactiveServers();
897
898 $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
899 if (!$sel_srv) {
900 $sel_srv = $_SESSION["ecs_sel_srv"];
901 } else {
902 $_SESSION["ecs_sel_srv"] = $sel_srv;
903 }
904
905 // Iterate all servers
906 $options = array(0 => $this->lng->txt("please_choose"));
907 foreach ($settings->getServers() as $server) {
908 $title = $server->getTitle();
909 if (!$title) {
910 $title = "ECS (" . $server->getServerId() . ")";
911 }
912 $options[$server->getServerId()] = $title;
913 }
914
915 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
916 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
917 $sel->setOptions($options);
918 $sel->setValue($sel_srv);
919 $ilToolbar->addInputItem($sel);
920
921 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "importMappings"));
922 $ilToolbar->addFormButton($this->lng->txt("submit"), "importMappings");
923
924 if ($sel_srv) {
925 $form = $this->initMappingsForm($sel_srv, self::MAPPING_IMPORT);
926 $this->tpl->setContent($form->getHTML());
927 }
928
929 return true;
930 }
931
937 protected function exportMappings()
938 {
939 global $ilToolbar;
940
941 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
942
943 $this->setMappingTabs(self::MAPPING_EXPORT);
944
946 if (!count($fields)) {
947 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
948 return true;
949 }
950
951 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
953 $settings->readInactiveServers();
954
955 $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
956 if (!$sel_srv) {
957 $sel_srv = $_SESSION["ecs_sel_srv"];
958 } else {
959 $_SESSION["ecs_sel_srv"] = $sel_srv;
960 }
961
962 // Iterate all servers
963 $options = array(0 => $this->lng->txt("please_choose"));
964 foreach ($settings->getServers() as $server) {
965 $title = $server->getTitle();
966 if (!$title) {
967 $title = "ECS (" . $server->getServerId() . ")";
968 }
969 $options[$server->getServerId()] = $title;
970 }
971
972 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
973 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
974 $sel->setOptions($options);
975 $sel->setValue($sel_srv);
976 $ilToolbar->addInputItem($sel);
977
978 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "exportMappings"));
979 $ilToolbar->addFormButton($this->lng->txt("submit"), "exportMappings");
980
981 if ($sel_srv) {
982 $form = $this->initMappingsForm($sel_srv, self::MAPPING_EXPORT);
983 $this->tpl->setContent($form->getHTML());
984 }
985
986 return true;
987 }
988
995 protected function saveImportMappings()
996 {
997 foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
998 foreach ((array) $mappings as $ecs_field => $advmd_id) {
999 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1000 $map = new ilECSDataMappingSetting(
1001 (int) $_REQUEST['ecs_mapping_server'],
1002 (int) $mtype,
1003 $ecs_field
1004 );
1005 $map->setAdvMDId($advmd_id);
1006 $map->save();
1007 }
1008 }
1009
1010 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1011 $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
1012 $this->ctrl->redirect($this, 'importMappings');
1013 return true;
1014 }
1015
1022 protected function saveExportMappings()
1023 {
1024 foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
1025 foreach ((array) $mappings as $ecs_field => $advmd_id) {
1026 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1027 $map = new ilECSDataMappingSetting(
1028 (int) $_POST['ecs_mapping_server'],
1029 (int) $mtype,
1030 $ecs_field
1031 );
1032 $map->setAdvMDId($advmd_id);
1033 $map->save();
1034 }
1035 }
1036
1037 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1038 $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
1039 $this->ctrl->redirect($this, 'exportMappings');
1040 return true;
1041 }
1042
1051 protected function initMappingsForm($a_server_id, $mapping_type)
1052 {
1053 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1054
1055 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1056 $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
1057
1058 $form = new ilPropertyFormGUI();
1059
1060 if ($mapping_type == self::MAPPING_IMPORT) {
1061 $form->setTitle($this->lng->txt('ecs_mapping_tbl'));
1062 $form->addCommandButton('saveImportMappings', $this->lng->txt('save'));
1063 $form->addCommandButton('importMappings', $this->lng->txt('cancel'));
1064 } else {
1065 $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
1066 $form->addCommandButton('saveExportMappings', $this->lng->txt('save'));
1067 $form->addCommandButton('exportMappings', $this->lng->txt('cancel'));
1068 }
1069
1070 $form->setFormAction($this->ctrl->getFormAction($this, 'saveMappings'));
1071
1072 if ($mapping_type == self::MAPPING_IMPORT) {
1073 $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs'));
1074 $form->addItem($assignments);
1075 }
1076
1077 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1079 $options = $this->prepareFieldSelection($fields);
1080
1081 // get all optional ecourse fields
1082 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1084 foreach ($optional as $field_name) {
1085 if ($mapping_type == self::MAPPING_IMPORT) {
1086 $select = new ilSelectInputGUI(
1087 $this->lng->txt('ecs_field_' . $field_name),
1088 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_IMPORT_CRS . '][' . $field_name . ']'
1089 );
1090
1091 $select->setValue(
1092 $mapping_settings->getMappingByECSName(
1094 $field_name
1095 )
1096 );
1097 $select->setOptions($options);
1098 $assignments->addSubItem($select);
1099 } else {
1100 $select = new ilSelectInputGUI(
1101 $this->lng->txt('ecs_field_' . $field_name),
1102 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_EXPORT . '][' . $field_name . ']'
1103 );
1104 $select->setValue(
1105 $mapping_settings->getMappingByECSName(
1107 $field_name
1108 )
1109 );
1110 $select->setOptions($options);
1111 $form->addItem($select);
1112 }
1113 }
1114
1115 $server = new ilHiddenInputGUI('ecs_mapping_server');
1116 $server->setValue($a_server_id);
1117 $form->addItem($server);
1118
1119 // Remote courses
1120 // no remote course settings for export
1121 if ($mapping_type == self::MAPPING_EXPORT) {
1122 return $form;
1123 }
1124
1125 $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs'));
1126 $form->addItem($rcrs);
1127
1128 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1130 $options = $this->prepareFieldSelection($fields);
1131
1132 // get all optional econtent fields
1133 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1135 foreach ($optional as $field_name) {
1136 $select = new ilSelectInputGUI(
1137 $this->lng->txt('ecs_field_' . $field_name),
1138 'mapping[' . ilECSDataMappingSetting::MAPPING_IMPORT_RCRS . '][' . $field_name . ']'
1139 );
1140 $select->setValue(
1141 $mapping_settings->getMappingByECSName(
1143 $field_name
1144 )
1145 );
1146 $select->setOptions($options);
1147 $rcrs->addSubItem($select);
1148 }
1149 return $form;
1150 }
1151
1156 protected function categoryMapping()
1157 {
1158 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1159 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.category_mapping.html', 'Services/WebServices/ECS');
1160
1161 $this->initRule();
1162 $this->initCategoryMappingForm();
1163
1164
1165 $this->tpl->setVariable('NEW_RULE_TABLE', $this->form->getHTML());
1166 if ($html = $this->showRulesTable()) {
1167 $this->tpl->setVariable('RULES_TABLE', $html);
1168 }
1169 }
1170
1175 protected function addCategoryMapping()
1176 {
1177 $this->initRule();
1178
1179 $this->initCategoryMappingForm('add');
1180 if ($this->form->checkInput()) {
1181 $this->rule->setContainerId($this->form->getInput('import_id'));
1182 $this->rule->setFieldName($this->form->getInput('field'));
1183 $this->rule->setMappingType($this->form->getInput('type'));
1184
1185 switch ($this->form->getInput('type')) {
1187 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1188 break;
1189
1191 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1192 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1193 break;
1194
1196 $this->rule->setByType($this->form->getInput('by_type'));
1197 break;
1198 }
1199
1200 if ($err = $this->rule->validate()) {
1201 ilUtil::sendInfo($this->lng->txt($err));
1202 $this->form->setValuesByPost();
1203 $this->categoryMapping();
1204 return false;
1205 }
1206
1207 $this->rule->save();
1208 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1209 unset($this->rule);
1210 $this->categoryMapping();
1211 return true;
1212 }
1213 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1214 $this->form->setValuesByPost();
1215 $this->categoryMapping();
1216 return false;
1217 }
1218
1223 protected function editCategoryMapping()
1224 {
1225 if (!$_REQUEST['rule_id']) {
1226 ilUtil::sendInfo($this->lng->txt('select_one'));
1227 $this->categoryMapping();
1228 return false;
1229 }
1230
1231 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1232 $this->ctrl->saveParameter($this, 'rule_id');
1233 $this->initRule((int) $_REQUEST['rule_id']);
1234
1235 $this->initCategoryMappingForm('edit');
1236 $this->tpl->setContent($this->form->getHTML());
1237 return true;
1238 }
1239
1244 protected function updateCategoryMapping()
1245 {
1246 if (!$_REQUEST['rule_id']) {
1247 ilUtil::sendInfo($this->lng->txt('select_one'));
1248 $this->categoryMapping();
1249 return false;
1250 }
1251 $this->ctrl->saveParameter($this, 'rule_id');
1252 $this->initRule((int) $_REQUEST['rule_id']);
1253 $this->initCategoryMappingForm('edit');
1254 if ($this->form->checkInput()) {
1255 $this->rule->setContainerId($this->form->getInput('import_id'));
1256 $this->rule->setFieldName($this->form->getInput('field'));
1257 $this->rule->setMappingType($this->form->getInput('type'));
1258
1259
1260 switch ($this->form->getInput('type')) {
1262 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1263 break;
1264
1266 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1267 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1268 break;
1269
1271 $this->rule->setByType($this->form->getInput('by_type'));
1272 break;
1273 }
1274
1275 if ($err = $this->rule->validate()) {
1276 ilUtil::sendInfo($this->lng->txt($err));
1277 $this->form->setValuesByPost();
1278 $this->editCategoryMapping();
1279 return false;
1280 }
1281
1282 $this->rule->update();
1283 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1284 $this->ctrl->redirect($this, 'categoryMapping');
1285 return true;
1286 }
1287 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1288 $this->form->setValuesByPost();
1289 $this->editCategoryMapping();
1290 return false;
1291 }
1292
1296 protected function deleteCategoryMappings()
1297 {
1298 if (!is_array($_POST['rules']) or !$_POST['rules']) {
1299 ilUtil::sendInfo($this->lng->txt('no_checkbox'));
1300 $this->categoryMapping();
1301 return false;
1302 }
1303 foreach ($_POST['rules'] as $rule_id) {
1304 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1305 $rule = new ilECSCategoryMappingRule($rule_id);
1306 $rule->delete();
1307 }
1308 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1309 $this->categoryMapping();
1310 return true;
1311 }
1312
1317 protected function showRulesTable()
1318 {
1319 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
1320
1321 if (!$rules = ilECSCategoryMapping::getActiveRules()) {
1322 return false;
1323 }
1324 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingTableGUI.php';
1325 $rule_table = new ilECSCategoryMappingTableGUI($this, 'categoryMapping');
1326 $rule_table->parse($rules);
1327 return $rule_table->getHTML();
1328 }
1329
1335 protected function initRule($a_rule_id = 0)
1336 {
1337 if (is_object($this->rule)) {
1338 return $this->rule;
1339 }
1340
1341 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1342 $this->rule = new ilECSCategoryMappingRule($a_rule_id);
1343 }
1344
1349 protected function initCategoryMappingForm($a_mode = 'add')
1350 {
1351 global $ilDB;
1352
1353 if (is_object($this->form)) {
1354 return true;
1355 }
1356
1357 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1358 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1359
1360 $this->form = new ilPropertyFormGUI();
1361
1362 if ($a_mode == 'add') {
1363 $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
1364 $this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping'));
1365 $this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save'));
1366 $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
1367 } else {
1368 $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
1369 $this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping'));
1370 $this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save'));
1371 $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
1372 }
1373
1374 $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id');
1375 $imp->setRequired(true);
1376
1377 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
1378 $tpl->setVariable('SIZE', 5);
1379 $tpl->setVariable('MAXLENGTH', 11);
1380 $tpl->setVariable('POST_VAR', 'import_id');
1381 $tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId());
1382
1383 if ($this->settings->getImportId()) {
1384 $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId()));
1385 }
1386
1387 $imp->setHTML($tpl->get());
1388 $imp->setInfo($this->lng->txt('ecs_import_id_info'));
1389 $this->form->addItem($imp);
1390
1391 include_once('./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php');
1392 $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field');
1393 $select->setValue($this->rule->getFieldName());
1394 $select->setRequired(true);
1395 $select->setOptions(ilECSCategoryMapping::getPossibleFields());
1396 $this->form->addItem($select);
1397
1398 // Value
1399 $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type');
1400 $value->setValue($this->rule->getMappingType());
1401 $value->setRequired(true);
1402
1403 $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), ilECSCategoryMappingRule::TYPE_FIXED);
1404 $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
1405
1406 $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value');
1407 $fixed_val->setValue($this->rule->getMappingValue());
1408 $fixed_val->setMaxLength(255);
1409 $fixed_val->setSize(40);
1410 $fixed_val->setRequired(true);
1411 $fixed->addSubItem($fixed_val);
1412
1413 $value->addOption($fixed);
1414
1415 $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), ilECSCategoryMappingRule::TYPE_DURATION);
1416 $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
1417
1418 $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin');
1419 $dur_start->setRequired(true);
1420 $dur_start->setDate($this->rule->getDateRangeStart());
1421 $duration->addSubItem($dur_start);
1422
1423 $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end');
1424 $dur_end->setRequired(true);
1425 $dur_end->setDate($this->rule->getDateRangeEnd());
1426 $duration->addSubItem($dur_end);
1427
1428 $value->addOption($duration);
1429
1430 $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), ilECSCategoryMappingRule::TYPE_BY_TYPE);
1431 $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
1432
1434
1435 $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
1436 $types->setOptions($options);
1437 $types->setValue($this->rule->getByType());
1438 $types->setRequired(true);
1439 $type->addSubitem($types);
1440
1441 $value->addOption($type);
1442
1443 $this->form->addItem($value);
1444 }
1445
1446
1452 protected function imported()
1453 {
1454 global $ilUser, $ilToolbar;
1455
1456 $this->tabs_gui->setSubTabActive('ecs_import');
1457
1458 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1459 if (ilECSServerSettings::getInstance()->activeServerExists()) {
1460 $ilToolbar->addButton(
1461 $this->lng->txt('ecs_read_remote_links'),
1462 $this->ctrl->getLinkTarget($this, 'readAll')
1463 );
1464
1465 $ilToolbar->addSeparator();
1466 }
1467
1468
1469 $sel_type = $_REQUEST["otype"];
1470 if (!$sel_type) {
1471 $sel_type = "rcrs";
1472 }
1473
1474 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
1476
1477 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1478 $sel = new ilSelectInputGUI("", "otype");
1479 $sel->setOptions($options);
1480 $sel->setValue($sel_type);
1481 $ilToolbar->addInputItem($sel);
1482
1483 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "imported"));
1484 $ilToolbar->addFormButton($this->lng->txt("submit"), "imported");
1485
1486 $robjs = ilUtil::_getObjectsByOperations($sel_type, 'visible', $ilUser->getId(), -1);
1487 if (count($robjs)) {
1488 $ilToolbar->addSeparator();
1489
1490 $ilToolbar->addButton(
1491 $this->lng->txt('csv_export'),
1492 $this->ctrl->getLinkTarget($this, 'exportImported')
1493 );
1494 }
1495
1496 include_once('Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
1497 $table_gui = new ilECSImportedContentTableGUI($this, 'imported');
1498 $table_gui->setTitle($this->lng->txt('ecs_imported_content'));
1499 $table_gui->parse($robjs);
1500 $this->tpl->setContent($table_gui->getHTML());
1501
1502 return true;
1503 }
1504
1511 protected function exportImported()
1512 {
1513 global $ilObjDataCache,$ilUser;
1514
1515 // :TODO: mind resource type and move to ilRemoteObjectBase...
1516
1517 $rcourses = ilUtil::_getObjectsByOperations('rcrs', 'visible', $ilUser->getId(), -1);
1518
1519 // Read participants
1520 include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
1521 include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
1522 try {
1524 } catch (ilECSConnectorException $e) {
1525 $reader = null;
1526 }
1527
1528 // read obj_ids
1529 $ilObjDataCache->preloadReferenceCache($rcourses);
1530 $obj_ids = array();
1531 foreach ($rcourses as $rcrs_ref_id) {
1532 $obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
1533 $obj_ids[$obj_id] = $obj_id;
1534 }
1535
1536 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1537 $writer = new ilCSVWriter();
1538
1539 $writer->addColumn($this->lng->txt('title'));
1540 $writer->addColumn($this->lng->txt('description'));
1541 $writer->addColumn($this->lng->txt('ecs_imported_from'));
1542 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1543 $writer->addColumn($this->lng->txt('ecs_field_term'));
1544 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1545 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1546 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1547 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1548 $writer->addColumn($this->lng->txt('ecs_field_room'));
1549 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1550 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1551 $writer->addColumn($this->lng->txt('ecs_field_end'));
1552 $writer->addColumn($this->lng->txt('last_update'));
1553
1554 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1556
1557 foreach ($obj_ids as $obj_id) {
1558 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1559 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1560
1561 $writer->addRow();
1562 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1563 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1564
1565 $mid = ilObjRemoteCourse::_lookupMID($obj_id);
1566 if ($reader and ($participant = $reader->getParticipantByMID($mid))) {
1567 $writer->addColumn($participant->getParticipantName());
1568 }
1569 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseID');
1570 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1571
1572 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'term');
1573 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1574
1575 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'lecturer');
1576 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1577
1578 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseType');
1579 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1580
1581 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'semester_hours');
1582 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1583
1584 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'credits');
1585 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1586
1587 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room');
1588 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1589
1590 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle');
1591 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1592
1593 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin');
1594 $dt = '';
1595 if (isset($values[$field])) {
1596 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1597 $dt = $dt->get(IL_CAL_DATETIME);
1598 }
1599 $writer->addColumn($dt);
1600
1601 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end');
1602 $dt = '';
1603 if (isset($values[$field])) {
1604 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1605 $dt = $dt->get(IL_CAL_DATETIME);
1606 }
1607 $writer->addColumn($dt);
1608
1609 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1610 }
1611 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_import.csv", "text/csv");
1612 }
1613
1620 protected function released()
1621 {
1622 global $ilUser, $ilToolbar;
1623
1624 $this->tabs_gui->setSubTabActive('ecs_released');
1625
1626 if ($this->settings->isEnabled()) {
1627 $ilToolbar->addButton(
1628 $this->lng->txt('ecs_read_remote_links'),
1629 $this->ctrl->getLinkTarget($this, 'readAll')
1630 );
1631
1632 $ilToolbar->addSeparator();
1633 }
1634
1635 $sel_type = $_REQUEST["otype"];
1636 if (!$sel_type) {
1637 $sel_type = "rcrs";
1638 }
1639
1640 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1642
1643 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1644 $sel = new ilSelectInputGUI("", "otype");
1645 $sel->setOptions($options);
1646 $sel->setValue($sel_type);
1647 $ilToolbar->addInputItem($sel);
1648
1649 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "released"));
1650 $ilToolbar->addFormButton($this->lng->txt("submit"), "released");
1651
1652 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1653 $exported = ilECSExport::getExportedIdsByType($sel_type);
1654 if (count($exported)) {
1655 $ilToolbar->addSeparator();
1656
1657 $ilToolbar->addButton(
1658 $this->lng->txt('csv_export'),
1659 $this->ctrl->getLinkTarget($this, 'exportReleased')
1660 );
1661 }
1662
1663 include_once('Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
1664 $table_gui = new ilECSReleasedContentTableGUI($this, 'released');
1665 $table_gui->setTitle($this->lng->txt('ecs_released_content'));
1666 $table_gui->parse($exported);
1667 $this->tpl->setContent($table_gui->getHTML());
1668
1669 return true;
1670 }
1671
1678 protected function exportReleased()
1679 {
1680 global $ilObjDataCache;
1681
1682 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1683 $exported = ilECSExport::getExportedIds();
1684 $ilObjDataCache->preloadObjectCache($exported);
1685
1686 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1687 $writer = new ilCSVWriter();
1688
1689 $writer->addColumn($this->lng->txt('title'));
1690 $writer->addColumn($this->lng->txt('description'));
1691 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1692 $writer->addColumn($this->lng->txt('ecs_field_term'));
1693 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1694 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1695 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1696 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1697 $writer->addColumn($this->lng->txt('ecs_field_room'));
1698 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1699 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1700 $writer->addColumn($this->lng->txt('ecs_field_end'));
1701 $writer->addColumn($this->lng->txt('last_update'));
1702
1703 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1705
1706 foreach ($exported as $obj_id) {
1707 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1708 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1709
1710 $writer->addRow();
1711 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1712 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1713
1714 $field = $settings->getMappingByECSName(0, 'courseID');
1715 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1716
1717 $field = $settings->getMappingByECSName(0, 'term');
1718 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1719
1720 $field = $settings->getMappingByECSName(0, 'lecturer');
1721 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1722
1723 $field = $settings->getMappingByECSName(0, 'courseType');
1724 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1725
1726 $field = $settings->getMappingByECSName(0, 'semester_hours');
1727 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1728
1729 $field = $settings->getMappingByECSName(0, 'credits');
1730 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1731
1732 $field = $settings->getMappingByECSName(0, 'room');
1733 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1734
1735 $field = $settings->getMappingByECSName(0, 'cycle');
1736 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1737
1738 $field = $settings->getMappingByECSName(0, 'begin');
1739 $dt = '';
1740 if (isset($values[$field])) {
1741 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1742 $dt = $dt->get(IL_CAL_DATETIME);
1743 }
1744 $writer->addColumn($dt);
1745
1746 $field = $settings->getMappingByECSName(0, 'end');
1747 $dt = '';
1748 if (isset($values[$field])) {
1749 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1750 $dt = $dt->get(IL_CAL_DATETIME);
1751 }
1752 $writer->addColumn($dt);
1753
1754 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1755 }
1756
1757 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv");
1758 }
1759
1760
1766 protected function prepareFieldSelection($fields)
1767 {
1768 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1769
1770 $options[0] = $this->lng->txt('ecs_ignore_field');
1771 foreach ($fields as $field) {
1772 $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
1773 $options[$field->getFieldId()] = $title . ': ' . $field->getTitle();
1774 }
1775 return $options;
1776 }
1777
1778
1779
1785 protected function initSettings($a_server_id = 1)
1786 {
1787 include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
1788 $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1789 }
1790
1796 protected function setSubTabs()
1797 {
1798 global $ilAccess;
1799 $this->tabs_gui->clearSubTabs();
1800
1801 $this->tabs_gui->addSubTabTarget(
1802 "overview",
1803 $this->ctrl->getLinkTarget($this, 'overview'),
1804 "overview",
1805 get_class($this)
1806 );
1807
1808 // Disable all other tabs, if server hasn't been configured.
1809 #ilECSServerSettings::getInstance()->readInactiveServers();
1810 if (!ilECSServerSettings::getInstance()->serverExists()) {
1811 return true;
1812 }
1813
1814 $this->tabs_gui->addSubTabTarget(
1815 "ecs_communities",
1816 $this->ctrl->getLinkTarget($this, 'communities'),
1817 "communities",
1818 get_class($this)
1819 );
1820
1821 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
1822 return true;
1823 }
1824
1825 $this->tabs_gui->addSubTabTarget(
1826 'ecs_mappings',
1827 $this->ctrl->getLinkTarget($this, 'importMappings'),
1828 'importMappings',
1829 get_class($this)
1830 );
1831
1832 $this->tabs_gui->addSubTabTarget(
1833 'ecs_category_mapping',
1834 $this->ctrl->getLinkTarget($this, 'categoryMapping')
1835 );
1836
1837 $this->tabs_gui->addSubTabTarget(
1838 'ecs_import',
1839 $this->ctrl->getLinkTarget($this, 'imported')
1840 );
1841
1842 $this->tabs_gui->addSubTabTarget(
1843 'ecs_released',
1844 $this->ctrl->getLinkTarget($this, 'released')
1845 );
1846 }
1847
1853 private function prepareRoleSelect()
1854 {
1855 global $rbacreview,$ilObjDataCache;
1856
1857 $global_roles = ilUtil::_sortIds(
1858 $rbacreview->getGlobalRoles(),
1859 'object_data',
1860 'title',
1861 'obj_id'
1862 );
1863
1864 $select[0] = $this->lng->txt('links_select_one');
1865 foreach ($global_roles as $role_id) {
1866 $select[$role_id] = ilObject::_lookupTitle($role_id);
1867 }
1868 return $select;
1869 }
1870
1875 private function buildPath($a_ref_id)
1876 {
1877 global $DIC;
1878
1879 $tree = $DIC->repositoryTree();
1880
1881 if (!$tree->isInTree($a_ref_id) || $tree->isDeleted($a_ref_id)) {
1882 return '';
1883 }
1884 $loc = new ilLocatorGUI();
1885 $loc->setTextOnly(false);
1886 $loc->addContextItems($a_ref_id);
1887
1888 return $loc->getHTML();
1889 }
1890
1896 protected function initTaskScheduler()
1897 {
1898 global $ilDB,$ilSetting;
1899
1900 $setting = new ilSetting('ecs');
1901 $setting->set(
1902 'next_execution_' . $this->settings->getServerId(),
1903 time() + (int) $this->settings->getPollingTime()
1904 );
1905 }
1906}
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
const IL_CAL_DATETIME
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _lookupTitle($a_record_id)
Lookup title.
Helper class to generate CSV files.
This class represents a checkbox property in a property form.
Confirmation screen class.
This class represents a custom property in a property form.
This class represents a date/time property in a property form.
@classDescription Date and time handling
This class represents a duration (typical hh:mm:ss) property in a property form.
Defines a rule for the assignment of ECS remote courses to categories.
static getActiveRules()
get active rules
static delete($a_server_id)
Delete comunities by server id.
static getInstance($a_sid, $a_cid)
Get instance.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static _getInstance()
get singleton instance
static _getInstance()
Get Singleton instance.
static delete($a_server_id)
Delete server @global ilDB $ilDB.
static getInstanceByServerId($a_server_id)
Get singleton instance.
static deleteServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static handleExportReset(ilECSSetting $server)
Handle export reset.
static handleImportReset(ilECSSetting $server)
Reread all imported econtent.
static deleteByServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static getExportedIds()
Get exported ids @global ilDB $ilDB.
static getExportedIdsByType($a_type)
Get exported ids by type @global ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static getAvailabeMids($a_server_id)
Get all available mids @global $ilDB.
static deleteByServer($a_server_id)
Delete by server @global $ilDB.
static getInstance()
Get singleton instance.
Description of ilECSServerTableGUI.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
updateCategoryMapping()
update category mapping
validateImportTypes(&$import_types)
Validate import types.
edit()
Edit server setting.
executeCommand()
Execute command.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
editCategoryMapping()
Edit category mapping.
refreshParticipants()
Refresh participants.
create()
Create new settings @global ilTabs $ilTabs.
overview()
List available servers.
released()
Show released materials.
saveExportMappings()
Save mappings.
updateTitle()
Update configuration title.
initTaskScheduler()
Init next task execution @global <type> $ilDB @global <type> $ilSetting.
prepareFieldSelection($fields)
get options for field selection
activate()
activate server
communities()
show communities
exportMappings()
Show mapping settings (EContent-Data <-> (Remote)Course.
loadFromPost()
Load from post.
readAll()
Read all importable econtent.
initRule($a_rule_id=0)
Init rule.
prepareRoleSelect()
get global role array
updateCommunities()
update whitelist
showRulesTable()
Show rules table.
initMappingsForm($a_server_id, $mapping_type)
init mapping form
exportImported()
csv export of imported remote courses
initSettingsForm($a_mode='update')
init settings form
setMappingTabs($a_active)
Handle tabs for ECS data mapping.
addCategoryMapping()
save category mapping
deactivate()
activate server
imported()
Show imported materials.
importMappings()
Show mapping settings (EContent-Data <-> (Remote)Course.
saveImportMappings()
Save mappings.
initSettings($a_server_id=1)
Init settings.
exportReleased()
export released
deleteCategoryMappings()
Delete selected category mappings.
categoryMapping()
Category mappings.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
static getPossibleReleaseTypes($a_with_captions=false)
Get all possible release object types.
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
static _getOptionalEContentFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
Base class for ILIAS Exception handling.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
locator handling class
This class represents a non editable value in a property form.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
This class represents a password property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
static _lookupMID($a_obj_id)
lookup owner mid
This class represents a selection list property in a property form.
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$key
Definition: croninfo.php:18
$html
Definition: example_001.php:87
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$server
Definition: getUserInfo.php:12
global $ilCtrl
Definition: ilias.php:18
$error
Definition: Error.php:17
global $ilSetting
Definition: privfeed.php:17
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
$rule
Definition: showstats.php:43
global $ilDB
$ilUser
Definition: imgupload.php:18