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