ILIAS  trunk Revision v11.0_alpha-1862-g4e205cb56d4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilECSSettingsGUI Class Reference
+ Collaboration diagram for ilECSSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 Execute command. More...
 
 overview ()
 List available servers. More...
 
 communities ()
 show communities More...
 
 importMappings ()
 Show mapping settings (EContent-Data <-> (Remote)Course. More...
 

Data Fields

const MAPPING_EXPORT = 1
 
const MAPPING_IMPORT = 2
 

Protected Member Functions

 activate ()
 activate server More...
 
 deactivate ()
 activate server More...
 
 readAll ()
 Read all importable econtent. More...
 
 create ()
 Create new settings. More...
 
 edit ()
 Edit server setting. More...
 
 cp ()
 
 delete ()
 Delete confirmation. More...
 
 doDelete ()
 Do delete. More...
 
 settings ()
 show settings More...
 
 initSettingsForm ($a_mode='update')
 init settings form More...
 
 update ()
 save settings More...
 
 save ()
 Save settings. More...
 
 updateTitle ()
 Update configuration title. More...
 
 loadFromPost ()
 Load from post. More...
 
 refreshParticipants ()
 Refresh participants. More...
 
 validateImportTypes (array $import_types)
 Validate import types. More...
 
 updateCommunities ()
 update whitelist More...
 
 setMappingTabs (int $a_active)
 Handle tabs for ECS data mapping. More...
 
 exportMappings ()
 Show mapping settings (EContent-Data <-> (Remote)Course. More...
 
 saveImportMappings ()
 Save mappings. More...
 
 saveExportMappings ()
 Save mappings. More...
 
 initMappingsForm (int $a_server_id, int $mapping_type)
 init mapping form More...
 
 categoryMapping ()
 Category mappings. More...
 
 addCategoryMapping ()
 save category mapping More...
 
 editCategoryMapping ()
 Edit category mapping. More...
 
 updateCategoryMapping ()
 update category mapping More...
 
 deleteCategoryMappings ()
 Delete selected category mappings. More...
 
 showRulesTable ()
 Show rules table. More...
 
 initRule (int $a_rule_id=0)
 Init rule. More...
 
 initCategoryMappingForm ($a_mode='add')
 Init category mapping form. More...
 
 imported ()
 Show imported materials. More...
 
 exportImported ()
 csv export of imported remote courses More...
 
 released ()
 Show released materials. More...
 
 exportReleased ()
 export released More...
 
 prepareFieldSelection ($fields)
 get options for field selection More...
 
 initSettings (int $a_server_id=1)
 Init settings. More...
 
 setSubTabs ()
 set sub tabs More...
 

Private Member Functions

 prepareRoleSelect ()
 get global role array More...
 
 buildPath (int $a_ref_id)
 

Private Attributes

ilLogger $log
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilRbacReview $rbacreview
 
ilTree $tree
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ilObjectDataCache $objDataCache
 
ilObjUser $user
 
ILIAS HTTP Services $http
 
ilECSSetting $settings
 
ilPropertyFormGUI $form = null
 
ilECSCategoryMappingRule $rule
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSSettingsGUI::__construct ( )

Definition at line 49 of file class.ilECSSettingsGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initSettings(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

50  {
51  global $DIC;
52 
53  $this->tpl = $DIC->ui()->mainTemplate();
54  $this->lng = $DIC->language();
55  $this->ctrl = $DIC->ctrl();
56  $this->tabs_gui = $DIC->tabs();
57  $this->rbacreview = $DIC->rbac()->review();
58  $this->log = $DIC->logger()->wsrv();
59  $this->tree = $DIC->repositoryTree();
60  $this->access = $DIC->access();
61  $this->toolbar = $DIC->toolbar();
62  $this->objDataCache = $DIC['ilObjDataCache'];
63  $this->user = $DIC->user();
64  $this->http = $DIC->http();
65 
66  $this->lng->loadLanguageModule('ecs');
67  $this->initSettings();
68  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilECSSettingsGUI::activate ( )
protected

activate server

Definition at line 133 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and settings().

133  : void
134  {
135  $this->initSettings((int) $_REQUEST['server_id']);
136  $this->settings->setEnabledStatus(true);
137  $this->settings->update();
138  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
139  $this->ctrl->redirect($this, 'overview');
140  }
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ addCategoryMapping()

ilECSSettingsGUI::addCategoryMapping ( )
protected

save category mapping

Definition at line 1006 of file class.ilECSSettingsGUI.php.

References categoryMapping(), ILIAS\Repository\form(), initCategoryMappingForm(), initRule(), ILIAS\Repository\lng(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

1006  : bool
1007  {
1008  $this->initRule();
1009 
1010  $this->initCategoryMappingForm('add');
1011  if ($this->form->checkInput()) {
1012  $this->rule->setContainerId((int) $this->form->getInput('import_id'));
1013  $this->rule->setFieldName($this->form->getInput('field'));
1014  $this->rule->setMappingType((int) $this->form->getInput('type'));
1015 
1016  switch ($this->form->getInput('type')) {
1018  $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1019  break;
1020 
1022  if ($this->form->getItemByPostVar('dur_begin')) {
1023  $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1024  }
1025  if ($this->form->getItemByPostVar('dur_end')) {
1026  $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1027  }
1028  break;
1029 
1031  $this->rule->setByType($this->form->getInput('by_type'));
1032  break;
1033  }
1034 
1035  if ($err = $this->rule->validate()) {
1036  $this->tpl->setOnScreenMessage('info', $this->lng->txt($err));
1037  $this->form->setValuesByPost();
1038  $this->categoryMapping();
1039  return false;
1040  }
1041 
1042  $this->rule->save();
1043  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'));
1044  unset($this->rule);
1045  $this->categoryMapping();
1046  return true;
1047  }
1048  $this->tpl->setOnScreenMessage('info', $this->lng->txt('err_check_input'));
1049  $this->form->setValuesByPost();
1050  $this->categoryMapping();
1051  return false;
1052  }
categoryMapping()
Category mappings.
initRule(int $a_rule_id=0)
Init rule.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ buildPath()

ilECSSettingsGUI::buildPath ( int  $a_ref_id)
private

Definition at line 1650 of file class.ilECSSettingsGUI.php.

Referenced by initCategoryMappingForm(), and initSettingsForm().

1650  : string
1651  {
1652  if (!$this->tree->isInTree($a_ref_id) || $this->tree->isDeleted($a_ref_id)) {
1653  return '';
1654  }
1655  $loc = new ilLocatorGUI();
1656  $loc->setTextOnly(false);
1657  $loc->addContextItems($a_ref_id);
1658 
1659  return $loc->getHTML();
1660  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ categoryMapping()

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

Definition at line 988 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\form(), initCategoryMappingForm(), initRule(), and showRulesTable().

Referenced by addCategoryMapping(), deleteCategoryMappings(), editCategoryMapping(), and updateCategoryMapping().

988  : void
989  {
990  $this->tabs_gui->setSubTabActive('ecs_category_mapping');
991  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.category_mapping.html', 'components/ILIAS/WebServices/ECS');
992 
993  $this->initRule();
994  $this->initCategoryMappingForm();
995 
996 
997  $this->tpl->setVariable('NEW_RULE_TABLE', $this->form->getHTML());
998  if ($html = $this->showRulesTable()) {
999  $this->tpl->setVariable('RULES_TABLE', $html);
1000  }
1001  }
initRule(int $a_rule_id=0)
Init rule.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
form( $class_path, string $cmd, string $submit_caption="")
showRulesTable()
Show rules table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ communities()

ilECSSettingsGUI::communities ( )

show communities

Definition at line 571 of file class.ilECSSettingsGUI.php.

References $server, ILIAS\Repository\access(), ilECSServerSettings\ALL_SERVER, ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), ilECSServerSettings\getInstance(), ilECSCommunityReader\getInstanceByServerId(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ilTable2GUI\setTitle(), ILIAS\UICore\GlobalTemplate\setVariable(), and ILIAS\Repository\toolbar().

571  : void
572  {
573  $tpl = new \ilTemplate(
574  'tpl.ecs_communities.html',
575  true,
576  true,
577  'components/ILIAS/WebServices/ECS'
578  );
579 
580  // add toolbar to refresh communities
581  if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
582  $this->toolbar->addButton(
583  $this->lng->txt('ecs_refresh_participants'),
584  $this->ctrl->getLinkTarget($this, 'refreshParticipants')
585  );
586  }
587 
588 
589  $this->tabs_gui->setSubTabActive('ecs_communities');
590 
591  $tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'updateCommunities'));
592 
593  if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
594  $tpl->setCurrentBlock("submit_buttons");
595  $tpl->setVariable('TXT_SAVE', $this->lng->txt('save'));
596  $tpl->setVariable('TXT_CANCEL', $this->lng->txt('cancel'));
598  }
599 
601 
602  foreach ($settings->getServers(ilECSServerSettings::ALL_SERVER) as $server) {
603  // Try to read communities
604  try {
605  $reader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
606  foreach ($reader->getCommunities() as $community) {
607  $tpl->setCurrentBlock('table_community');
608  $table_gui = new ilECSCommunityTableGUI($server, $this, 'communities', $community->getId());
609  $table_gui->setTitle($community->getTitle() . ' (' . $community->getDescription() . ')');
610  $table_gui->parse($community->getParticipants());
611  $tpl->setVariable('TABLE_COMM', $table_gui->getHTML());
613  }
614  } catch (ilECSConnectorException $exc) {
615  // Maybe server is not fully configured
616  continue;
617  }
618 
619  // Show section for each server
620  $tpl->setCurrentBlock('server');
621  $tpl->setVariable('TXT_SERVER_NAME', $server->getTitle());
623  }
624 
625  $this->tpl->setContent($tpl->get());
626  }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
ilGlobalTemplateInterface $tpl
static getInstance()
Get singleton instance.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
$server
Definition: shib_login.php:24
+ Here is the call graph for this function:

◆ cp()

ilECSSettingsGUI::cp ( )
protected

Definition at line 216 of file class.ilECSSettingsGUI.php.

References $settings, ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and ilECSSetting\save().

216  : void
217  {
218  $this->initSettings((int) $_REQUEST['server_id']);
219 
220  $copy = clone $this->settings;
221  $copy->save();
222 
223  $this->ctrl->setParameter($this, 'server_id', $copy->getServerId());
224  $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_settings_cloned'), true);
225  $this->ctrl->redirect($this, 'edit');
226  }
save()
save settings
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ create()

ilECSSettingsGUI::create ( )
protected

Create new settings.

Definition at line 184 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initSettings(), initSettingsForm(), and ILIAS\Repository\lng().

184  : void
185  {
186  $this->initSettings(0);
187 
188  $this->tabs_gui->clearTargets();
189  $this->tabs_gui->clearSubTabs();
190  $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
191 
192  $this->initSettingsForm('create');
193  $this->tabs_gui->setSubTabActive('ecs_settings');
194 
195  $this->tpl->setContent($this->form->getHTML());
196  }
initSettingsForm($a_mode='update')
init settings form
form( $class_path, string $cmd, string $submit_caption="")
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ deactivate()

ilECSSettingsGUI::deactivate ( )
protected

activate server

Definition at line 145 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and settings().

145  : void
146  {
147  $this->initSettings((int) $_REQUEST['server_id']);
148  $this->settings->setEnabledStatus(false);
149  $this->settings->update();
150  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
151  $this->ctrl->redirect($this, 'overview');
152  }
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ delete()

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

Definition at line 231 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and settings().

231  : void
232  {
233  $this->initSettings((int) $_REQUEST['server_id']);
234 
235  $this->tabs_gui->clearTargets();
236  $this->tabs_gui->clearSubTabs();
237  $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
238 
239  $confirm = new ilConfirmationGUI();
240  $confirm->setFormAction($this->ctrl->getFormAction($this));
241  $confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
242  $confirm->setCancel($this->lng->txt('cancel'), 'overview');
243  $confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
244 
245  $confirm->addItem('', '', $this->settings->getServer());
246  $confirm->addHiddenItem('server_id', (string) $this->settings->getServerId());
247 
248  $this->tpl->setContent($confirm->getHTML());
249  }
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ deleteCategoryMappings()

ilECSSettingsGUI::deleteCategoryMappings ( )
protected

Delete selected category mappings.

Definition at line 1133 of file class.ilECSSettingsGUI.php.

References categoryMapping(), ilECSCategoryMappingRule\delete(), and ILIAS\Repository\lng().

1133  : bool
1134  {
1135  if (!is_array($_POST['rules']) || !$_POST['rules']) {
1136  $this->tpl->setOnScreenMessage('info', $this->lng->txt('no_checkbox'));
1137  $this->categoryMapping();
1138  return false;
1139  }
1140  foreach ($_POST['rules'] as $rule_id) {
1141  $rule = new ilECSCategoryMappingRule((int) $rule_id);
1142  $rule->delete();
1143  }
1144  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'));
1145  $this->categoryMapping();
1146  return true;
1147  }
categoryMapping()
Category mappings.
ilECSCategoryMappingRule $rule
Defines a rule for the assignment of ECS remote courses to categories.
+ Here is the call graph for this function:

◆ doDelete()

ilECSSettingsGUI::doDelete ( )
protected

Do delete.

Definition at line 254 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and settings().

254  : void
255  {
256  $this->initSettings((int) $_REQUEST['server_id']);
257  $this->settings->delete();
258  $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_setting_deleted'), true);
259  $this->ctrl->redirect($this, 'overview');
260  }
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ edit()

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

Definition at line 201 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initSettings(), initSettingsForm(), and ILIAS\Repository\lng().

Referenced by update().

201  : void
202  {
203  $this->initSettings((int) $_REQUEST['server_id']);
204  $this->ctrl->saveParameter($this, 'server_id');
205 
206  $this->tabs_gui->clearTargets();
207  $this->tabs_gui->clearSubTabs();
208  $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
209 
210  $this->initSettingsForm();
211  $this->tabs_gui->setSubTabActive('ecs_settings');
212 
213  $this->tpl->setContent($this->form->getHTML());
214  }
initSettingsForm($a_mode='update')
init settings form
form( $class_path, string $cmd, string $submit_caption="")
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCategoryMapping()

ilECSSettingsGUI::editCategoryMapping ( )
protected

Edit category mapping.

Definition at line 1057 of file class.ilECSSettingsGUI.php.

References categoryMapping(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initCategoryMappingForm(), initRule(), and ILIAS\Repository\lng().

Referenced by updateCategoryMapping().

1057  : bool
1058  {
1059  if (!$_REQUEST['rule_id']) {
1060  $this->tpl->setOnScreenMessage('info', $this->lng->txt('select_one'));
1061  $this->categoryMapping();
1062  return false;
1063  }
1064 
1065  $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1066  $this->ctrl->saveParameter($this, 'rule_id');
1067  $this->initRule((int) $_REQUEST['rule_id']);
1068 
1069  $this->initCategoryMappingForm('edit');
1070  $this->tpl->setContent($this->form->getHTML());
1071  return true;
1072  }
categoryMapping()
Category mappings.
initRule(int $a_rule_id=0)
Init rule.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilECSSettingsGUI::executeCommand ( )

Execute command.

Definition at line 73 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and setSubTabs().

73  : void
74  {
75  $next_class = $this->ctrl->getNextClass($this);
76  $cmd = $this->ctrl->getCmd();
77 
78  $this->setSubTabs();
79  switch ($next_class) {
80  case 'ilecsmappingsettingsgui':
81  $mapset = new ilECSMappingSettingsGUI($this, (int) $_REQUEST['server_id'], (int) $_REQUEST['mid']);
82  $this->ctrl->setReturn($this, 'communities');
83  $this->ctrl->forwardCommand($mapset);
84  break;
85 
86  case 'ilecsparticipantsettingsgui':
87  $part = new ilECSParticipantSettingsGUI(
88  (int) $_REQUEST['server_id'],
89  (int) $_REQUEST['mid']
90  );
91  $this->ctrl->setReturn($this, 'communities');
92  $this->ctrl->forwardCommand($part);
93  break;
94 
95  default:
96 
97  if ($cmd !== "overview" && $cmd !== "communities" && !$this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
98  $this->ctrl->redirect($this, "overview");
99  }
100 
101  if (!$cmd || $cmd === 'view') {
102  $cmd = "overview";
103  }
104  $this->$cmd();
105  break;
106  }
107  }
Class for ECS node and directory mapping settings.
+ Here is the call graph for this function:

◆ exportImported()

ilECSSettingsGUI::exportImported ( )
protected

csv export of imported remote courses

Definition at line 1318 of file class.ilECSSettingsGUI.php.

References Vendor\Package\$e, ilUtil\_getObjectsByOperations(), ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilECSUtils\getAdvancedMDValuesForObjId(), ilECSDataMappingSettings\getInstanceByServerId(), ilECSCommunityReader\getInstanceByServerId(), ILIAS\FileDelivery\http(), IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\lng(), ilECSDataMappingSetting\MAPPING_IMPORT_RCRS, null, ILIAS\Filesystem\Stream\Streams\ofString(), settings(), and ILIAS\Repository\user().

1318  : void
1319  {
1320  // :TODO: mind resource type and move to ilRemoteObjectBase...
1321 
1322  $rcourses = ilUtil::_getObjectsByOperations('rcrs', 'visible', $this->user->getId(), -1);
1323 
1324  // Read participants
1325  try {
1326  $reader = ilECSCommunityReader::getInstanceByServerId($this->settings->getServerId());
1327  } catch (ilECSConnectorException $e) {
1328  $reader = null;
1329  }
1330 
1331  // read obj_ids
1332  $this->objDataCache->preloadReferenceCache($rcourses);
1333  $obj_ids = array();
1334  foreach ($rcourses as $rcrs_ref_id) {
1335  $obj_id = $this->objDataCache->lookupObjId((int) $rcrs_ref_id);
1336  $obj_ids[$obj_id] = $obj_id;
1337  }
1338 
1339  $writer = new ilCSVWriter();
1340 
1341  $writer->addColumn($this->lng->txt('title'));
1342  $writer->addColumn($this->lng->txt('description'));
1343  $writer->addColumn($this->lng->txt('ecs_imported_from'));
1344  $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1345  $writer->addColumn($this->lng->txt('ecs_field_term'));
1346  $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1347  $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1348  $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1349  $writer->addColumn($this->lng->txt('ecs_field_credits'));
1350  $writer->addColumn($this->lng->txt('ecs_field_room'));
1351  $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1352  $writer->addColumn($this->lng->txt('ecs_field_begin'));
1353  $writer->addColumn($this->lng->txt('ecs_field_end'));
1354  $writer->addColumn($this->lng->txt('last_update'));
1355 
1356  // TODO fix getting proper datamappingsettings for each server
1358 
1359  foreach ($obj_ids as $obj_id) {
1360  $rcourse = new ilObjRemoteCourse($obj_id, false);
1361  $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1362 
1363  $writer->addRow();
1364  $writer->addColumn(ilObject::_lookupTitle($obj_id));
1365  $writer->addColumn(ilObject::_lookupDescription($obj_id));
1366 
1367  $mid = $rcourse->getMID();
1368  if ($reader && ($participant = $reader->getParticipantByMID($mid))) {
1369  $writer->addColumn($participant->getParticipantName());
1370  }
1371  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseID');
1372  $writer->addColumn($values[$field] ?? '');
1373 
1374  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'term');
1375  $writer->addColumn($values[$field] ?? '');
1376 
1377  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'lecturer');
1378  $writer->addColumn($values[$field] ?? '');
1379 
1380  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseType');
1381  $writer->addColumn($values[$field] ?? '');
1382 
1383  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'semester_hours');
1384  $writer->addColumn($values[$field] ?? '');
1385 
1386  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'credits');
1387  $writer->addColumn($values[$field] ?? '');
1388 
1389  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room');
1390  $writer->addColumn($values[$field] ?? '');
1391 
1392  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle');
1393  $writer->addColumn($values[$field] ?? '');
1394 
1395  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin');
1396  $dt = '';
1397  if (isset($values[$field])) {
1398  $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1399  $dt = $dt->get(IL_CAL_DATETIME);
1400  }
1401  $writer->addColumn($dt);
1402 
1403  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end');
1404  $dt = '';
1405  if (isset($values[$field])) {
1406  $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1407  $dt = $dt->get(IL_CAL_DATETIME);
1408  }
1409  $writer->addColumn($dt);
1410 
1411  $writer->addColumn($this->objDataCache->lookupLastUpdate((int) $obj_id));
1412  }
1413 
1414  $stream = \ILIAS\Filesystem\Stream\Streams::ofString($writer->getCSVString());
1415  $this->http->saveResponse($this->http
1416  ->response()
1417  ->withAddedHeader('Content-Type', 'text/csv')
1418  ->withAddedHeader('Content-Disposition', 'attachment; filename="' . date("Y_m_d") . '_ecs_import.csv' . '"')
1419  ->withBody($stream));
1420  $this->http->sendResponse();
1421  $this->http->close();
1422  }
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id.
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $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.
Remote course app class.
static _lookupDescription(int $obj_id)
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
+ Here is the call graph for this function:

◆ exportMappings()

ilECSSettingsGUI::exportMappings ( )
protected

Show mapping settings (EContent-Data <-> (Remote)Course.

Definition at line 806 of file class.ilECSSettingsGUI.php.

References $server, ilECSServerSettings\ALL_SERVER, ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), ilECSServerSettings\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), initMappingsForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), setMappingTabs(), and ILIAS\Repository\toolbar().

806  : void
807  {
808  $this->setMappingTabs(self::MAPPING_EXPORT);
809 
811  if (!count($fields)) {
812  $this->tpl->setOnScreenMessage('info', $this->lng->txt('ecs_no_adv_md'));
813  return;
814  }
815 
817 
818  $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
819 
820  // Iterate all servers
821  $options = array(0 => $this->lng->txt("please_choose"));
822  foreach ($settings->getServers(ilECSServerSettings::ALL_SERVER) as $server) {
823  $title = $server->getTitle();
824  if (!$title) {
825  $title = "ECS (" . $server->getServerId() . ")";
826  }
827  $options[$server->getServerId()] = $title;
828  }
829 
830  $sel = new ilSelectInputGUI("", "ecs_mapping_server");
831  $sel->setOptions($options);
832  $sel->setValue($sel_srv);
833  $this->toolbar->addInputItem($sel);
834 
835  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "exportMappings"));
836  $this->toolbar->addFormButton($this->lng->txt("submit"), "exportMappings");
837 
838  if ($sel_srv) {
839  $form = $this->initMappingsForm($sel_srv, self::MAPPING_EXPORT);
840  $this->tpl->setContent($form->getHTML());
841  }
842  }
setMappingTabs(int $a_active)
Handle tabs for ECS data mapping.
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
ilPropertyFormGUI $form
static getInstancesByObjType($a_obj_type, $a_active_only=true)
initMappingsForm(int $a_server_id, int $mapping_type)
init mapping form
$server
Definition: shib_login.php:24
+ Here is the call graph for this function:

◆ exportReleased()

ilECSSettingsGUI::exportReleased ( )
protected

export released

Definition at line 1474 of file class.ilECSSettingsGUI.php.

References ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilECSUtils\getAdvancedMDValuesForObjId(), ilECSExportManager\getInstance(), ilECSDataMappingSettings\getInstanceByServerId(), ILIAS\FileDelivery\http(), IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Filesystem\Stream\Streams\ofString(), and settings().

1474  : void
1475  {
1476  $exported = ilECSExportManager::getInstance()->getExportedIds();
1477  $this->objDataCache->preloadObjectCache($exported);
1478 
1479  $writer = new ilCSVWriter();
1480 
1481  $writer->addColumn($this->lng->txt('title'));
1482  $writer->addColumn($this->lng->txt('description'));
1483  $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1484  $writer->addColumn($this->lng->txt('ecs_field_term'));
1485  $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1486  $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1487  $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1488  $writer->addColumn($this->lng->txt('ecs_field_credits'));
1489  $writer->addColumn($this->lng->txt('ecs_field_room'));
1490  $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1491  $writer->addColumn($this->lng->txt('ecs_field_begin'));
1492  $writer->addColumn($this->lng->txt('ecs_field_end'));
1493  $writer->addColumn($this->lng->txt('last_update'));
1494 
1496 
1497  foreach ($exported as $obj_id) {
1498  $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1499 
1500  $writer->addRow();
1501  $writer->addColumn(ilObject::_lookupTitle($obj_id));
1502  $writer->addColumn(ilObject::_lookupDescription($obj_id));
1503 
1504  $field = $settings->getMappingByECSName(0, 'courseID');
1505  $writer->addColumn($values[$field] ?? '');
1506 
1507  $field = $settings->getMappingByECSName(0, 'term');
1508  $writer->addColumn($values[$field] ?? '');
1509 
1510  $field = $settings->getMappingByECSName(0, 'lecturer');
1511  $writer->addColumn($values[$field] ?? '');
1512 
1513  $field = $settings->getMappingByECSName(0, 'courseType');
1514  $writer->addColumn($values[$field] ?? '');
1515 
1516  $field = $settings->getMappingByECSName(0, 'semester_hours');
1517  $writer->addColumn($values[$field] ?? '');
1518 
1519  $field = $settings->getMappingByECSName(0, 'credits');
1520  $writer->addColumn($values[$field] ?? '');
1521 
1522  $field = $settings->getMappingByECSName(0, 'room');
1523  $writer->addColumn($values[$field] ?? '');
1524 
1525  $field = $settings->getMappingByECSName(0, 'cycle');
1526  $writer->addColumn($values[$field] ?? '');
1527 
1528  $field = $settings->getMappingByECSName(0, 'begin');
1529  $dt = '';
1530  if (isset($values[$field])) {
1531  $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1532  $dt = $dt->get(IL_CAL_DATETIME);
1533  }
1534  $writer->addColumn($dt);
1535 
1536  $field = $settings->getMappingByECSName(0, 'end');
1537  $dt = '';
1538  if (isset($values[$field])) {
1539  $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1540  $dt = $dt->get(IL_CAL_DATETIME);
1541  }
1542  $writer->addColumn($dt);
1543 
1544  $writer->addColumn($this->objDataCache->lookupLastUpdate((int) $obj_id));
1545  }
1546 
1547  $stream = \ILIAS\Filesystem\Stream\Streams::ofString($writer->getCSVString());
1548  $this->http->saveResponse($this->http
1549  ->response()
1550  ->withAddedHeader('Content-Type', 'text/csv')
1551  ->withAddedHeader('Content-Disposition', 'attachment; filename="' . date("Y_m_d") . '_ecs_export.csv' . '"')
1552  ->withBody($stream));
1553  $this->http->sendResponse();
1554  $this->http->close();
1555  }
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id.
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
Get the singelton instance of this ilECSExportManager.
const IL_CAL_UNIX
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
+ Here is the call graph for this function:

◆ imported()

ilECSSettingsGUI::imported ( )
protected

Show imported materials.

Definition at line 1269 of file class.ilECSSettingsGUI.php.

References ilUtil\_getObjectsByOperations(), ILIAS\Repository\ctrl(), ilECSServerSettings\getInstance(), ilECSUtils\getPossibleRemoteTypes(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

Referenced by readAll().

1269  : bool
1270  {
1271  $this->tabs_gui->setSubTabActive('ecs_import');
1272 
1273  if (ilECSServerSettings::getInstance()->activeServerExists()) {
1274  $this->toolbar->addButton(
1275  $this->lng->txt('ecs_read_remote_links'),
1276  $this->ctrl->getLinkTarget($this, 'readAll')
1277  );
1278 
1279  $this->toolbar->addSeparator();
1280  }
1281 
1282 
1283  $sel_type = $_REQUEST["otype"];
1284  if (!$sel_type) {
1285  $sel_type = "rcrs";
1286  }
1287 
1288  $options = ilECSUtils::getPossibleRemoteTypes(true);
1289 
1290  $sel = new ilSelectInputGUI("", "otype");
1291  $sel->setOptions($options);
1292  $sel->setValue($sel_type);
1293  $this->toolbar->addInputItem($sel);
1294 
1295  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "imported"));
1296  $this->toolbar->addFormButton($this->lng->txt("submit"), "imported");
1297 
1298  $robjs = ilUtil::_getObjectsByOperations($sel_type, 'visible', $this->user->getId(), -1);
1299  if (count($robjs)) {
1300  $this->toolbar->addSeparator();
1301 
1302  $this->toolbar->addButton(
1303  $this->lng->txt('csv_export'),
1304  $this->ctrl->getLinkTarget($this, 'exportImported')
1305  );
1306  }
1307  $table_gui = new ilECSImportedContentTableGUI($this, 'imported');
1308  $table_gui->setTitle($this->lng->txt('ecs_imported_content'));
1309  $table_gui->parse($robjs);
1310  $this->tpl->setContent($table_gui->getHTML());
1311 
1312  return true;
1313  }
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importMappings()

ilECSSettingsGUI::importMappings ( )

Show mapping settings (EContent-Data <-> (Remote)Course.

Definition at line 765 of file class.ilECSSettingsGUI.php.

References $server, ilECSServerSettings\ALL_SERVER, ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), ilECSServerSettings\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), initMappingsForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), setMappingTabs(), and ILIAS\Repository\toolbar().

765  : void
766  {
767  $this->setMappingTabs(self::MAPPING_IMPORT);
768 
770  if (!count($fields)) {
771  $this->tpl->setOnScreenMessage('info', $this->lng->txt('ecs_no_adv_md'));
772  return;
773  }
774 
776 
777  $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
778 
779  // Iterate all servers
780  $options = array(0 => $this->lng->txt("please_choose"));
781  foreach ($settings->getServers(ilECSServerSettings::ALL_SERVER) as $server) {
782  $title = $server->getTitle();
783  if (!$title) {
784  $title = "ECS (" . $server->getServerId() . ")";
785  }
786  $options[$server->getServerId()] = $title;
787  }
788 
789  $sel = new ilSelectInputGUI("", "ecs_mapping_server");
790  $sel->setOptions($options);
791  $sel->setValue($sel_srv);
792  $this->toolbar->addInputItem($sel);
793 
794  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "importMappings"));
795  $this->toolbar->addFormButton($this->lng->txt("submit"), "importMappings");
796 
797  if ($sel_srv) {
798  $form = $this->initMappingsForm($sel_srv, self::MAPPING_IMPORT);
799  $this->tpl->setContent($form->getHTML());
800  }
801  }
setMappingTabs(int $a_active)
Handle tabs for ECS data mapping.
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
ilPropertyFormGUI $form
static getInstancesByObjType($a_obj_type, $a_active_only=true)
initMappingsForm(int $a_server_id, int $mapping_type)
init mapping form
$server
Definition: shib_login.php:24
+ Here is the call graph for this function:

◆ initCategoryMappingForm()

ilECSSettingsGUI::initCategoryMappingForm (   $a_mode = 'add')
protected

Init category mapping form.

Definition at line 1175 of file class.ilECSSettingsGUI.php.

References $duration, buildPath(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\UICore\GlobalTemplate\get(), ilECSCategoryMapping\getPossibleFields(), ilECSUtils\getPossibleRemoteTypes(), ILIAS\Repository\lng(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilRadioGroupInputGUI\setValue(), ilSelectInputGUI\setValue(), ILIAS\UICore\GlobalTemplate\setVariable(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

Referenced by addCategoryMapping(), categoryMapping(), editCategoryMapping(), and updateCategoryMapping().

1175  : void
1176  {
1177  if (is_object($this->form)) {
1178  return;
1179  }
1180 
1181  $this->form = new ilPropertyFormGUI();
1182 
1183  if ($a_mode === 'add') {
1184  $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
1185  $this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping'));
1186  $this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save'));
1187  } else {
1188  $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
1189  $this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping'));
1190  $this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save'));
1191  }
1192  $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
1193 
1194  $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id');
1195  $imp->setRequired(true);
1196 
1197  $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'components/ILIAS/WebServices/ECS');
1198  $tpl->setVariable('SIZE', 5);
1199  $tpl->setVariable('MAXLENGTH', 11);
1200  $tpl->setVariable('POST_VAR', 'import_id');
1201  $tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId());
1202 
1203  if ($this->rule->getContainerId()) {
1204  $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId()));
1205  }
1206 
1207  $imp->setHTML($tpl->get());
1208  $imp->setInfo($this->lng->txt('ecs_import_id_info'));
1209  $this->form->addItem($imp);
1210 
1211  $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field');
1212  $select->setValue($this->rule->getFieldName());
1213  $select->setRequired(true);
1214  $select->setOptions(ilECSCategoryMapping::getPossibleFields());
1215  $this->form->addItem($select);
1216 
1217  // Value
1218  $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type');
1219  $value->setValue((string) $this->rule->getMappingType());
1220  $value->setRequired(true);
1221 
1222  $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), (string) ilECSCategoryMappingRule::TYPE_FIXED);
1223  $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
1224 
1225  $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value');
1226  $fixed_val->setValue($this->rule->getMappingValue());
1227  $fixed_val->setMaxLength(255);
1228  $fixed_val->setSize(40);
1229  $fixed_val->setRequired(true);
1230  $fixed->addSubItem($fixed_val);
1231 
1232  $value->addOption($fixed);
1233 
1234  $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), (string) ilECSCategoryMappingRule::TYPE_DURATION);
1235  $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
1236 
1237  $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin');
1238  $dur_start->setRequired(true);
1239  $dur_start->setDate($this->rule->getDateRangeStart());
1240  $duration->addSubItem($dur_start);
1241 
1242  $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end');
1243  $dur_end->setRequired(true);
1244  $dur_end->setDate($this->rule->getDateRangeEnd());
1245  $duration->addSubItem($dur_end);
1246 
1247  $value->addOption($duration);
1248 
1249  $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), (string) ilECSCategoryMappingRule::TYPE_BY_TYPE);
1250  $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
1251 
1252  $options = ilECSUtils::getPossibleRemoteTypes(true);
1253 
1254  $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
1255  $types->setOptions($options);
1256  $types->setValue($this->rule->getByType());
1257  $types->setRequired(true);
1258  $type->addSubitem($types);
1259 
1260  $value->addOption($type);
1261 
1262  $this->form->addItem($value);
1263  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
ilGlobalTemplateInterface $tpl
setOptions(array $a_options)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
$duration
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
This class represents a date/time property in a property form.
This class represents a property in a property form.
setValue($a_value)
Set Value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setRequired(bool $a_required)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initMappingsForm()

ilECSSettingsGUI::initMappingsForm ( int  $a_server_id,
int  $mapping_type 
)
protected

init mapping form

Definition at line 891 of file class.ilECSSettingsGUI.php.

References $form, $server, ilECSUtils\_getOptionalEContentFields(), ilECSUtils\_getOptionalECourseFields(), ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ilECSDataMappingSettings\getInstanceByServerId(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), ILIAS\Repository\lng(), ilECSDataMappingSetting\MAPPING_EXPORT, ilECSDataMappingSetting\MAPPING_IMPORT_CRS, ilECSDataMappingSetting\MAPPING_IMPORT_RCRS, prepareFieldSelection(), ilFormGUI\setFormAction(), ilPropertyFormGUI\setTitle(), and ilSelectInputGUI\setValue().

Referenced by exportMappings(), and importMappings().

892  {
893  $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
894 
895  $form = new ilPropertyFormGUI();
896 
897  if ($mapping_type === self::MAPPING_IMPORT) {
898  $form->setTitle($this->lng->txt('ecs_mapping_tbl'));
899  $form->addCommandButton('saveImportMappings', $this->lng->txt('save'));
900  $form->addCommandButton('importMappings', $this->lng->txt('cancel'));
901  } else {
902  $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
903  $form->addCommandButton('saveExportMappings', $this->lng->txt('save'));
904  $form->addCommandButton('exportMappings', $this->lng->txt('cancel'));
905  }
906 
907  $form->setFormAction($this->ctrl->getFormAction($this, 'saveMappings'));
908 
909  if ($mapping_type === self::MAPPING_IMPORT) {
910  $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs'));
911  $form->addItem($assignments);
912  }
913 
915  $options = $this->prepareFieldSelection($fields);
916 
917  // get all optional ecourse fields
919  foreach ($optional as $field_name) {
920  if ($mapping_type === self::MAPPING_IMPORT) {
921  $select = new ilSelectInputGUI(
922  $this->lng->txt('ecs_field_' . $field_name),
923  'mapping' . '[' . ilECSDataMappingSetting::MAPPING_IMPORT_CRS . '][' . $field_name . ']'
924  );
925 
926  $select->setValue(
927  $mapping_settings->getMappingByECSName(
929  $field_name
930  )
931  );
932  $select->setOptions($options);
933  $assignments->addSubItem($select);
934  } else {
935  $select = new ilSelectInputGUI(
936  $this->lng->txt('ecs_field_' . $field_name),
937  'mapping' . '[' . ilECSDataMappingSetting::MAPPING_EXPORT . '][' . $field_name . ']'
938  );
939  $select->setValue(
940  (string) $mapping_settings->getMappingByECSName(
942  $field_name
943  )
944  );
945  $select->setOptions($options);
946  $form->addItem($select);
947  }
948  }
949 
950  $server = new ilHiddenInputGUI('ecs_mapping_server');
951  $server->setValue((string) $a_server_id);
953 
954  // Remote courses
955  // no remote course settings for export
956  if ($mapping_type === self::MAPPING_EXPORT) {
957  return $form;
958  }
959 
960  $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs'));
961  $form->addItem($rcrs);
962 
964  $options = $this->prepareFieldSelection($fields);
965 
966  // get all optional econtent fields
968  foreach ($optional as $field_name) {
969  $select = new ilSelectInputGUI(
970  $this->lng->txt('ecs_field_' . $field_name),
971  'mapping[' . ilECSDataMappingSetting::MAPPING_IMPORT_RCRS . '][' . $field_name . ']'
972  );
973  $select->setValue(
974  $mapping_settings->getMappingByECSName(
976  $field_name
977  )
978  );
979  $select->setOptions($options);
980  $rcrs->addSubItem($select);
981  }
982  return $form;
983  }
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
This class represents a selection list property in a property form.
ilPropertyFormGUI $form
This class represents a hidden form property in a property form.
setFormAction(string $a_formaction)
setValue($a_value)
Set Value.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
static _getOptionalEContentFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...
$server
Definition: shib_login.php:24
prepareFieldSelection($fields)
get options for field selection
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRule()

ilECSSettingsGUI::initRule ( int  $a_rule_id = 0)
protected

Init rule.

Parameters
int$rule_idrule id

Definition at line 1163 of file class.ilECSSettingsGUI.php.

Referenced by addCategoryMapping(), categoryMapping(), editCategoryMapping(), and updateCategoryMapping().

1163  : void
1164  {
1165  if (isset($this->rule) && is_object($this->rule)) {
1166  return;
1167  }
1168 
1169  $this->rule = new ilECSCategoryMappingRule($a_rule_id);
1170  }
Defines a rule for the assignment of ECS remote courses to categories.
+ Here is the caller graph for this function:

◆ initSettings()

ilECSSettingsGUI::initSettings ( int  $a_server_id = 1)
protected

Init settings.

Definition at line 1577 of file class.ilECSSettingsGUI.php.

References ilECSSetting\getInstanceByServerId(), and settings().

Referenced by __construct(), activate(), cp(), create(), deactivate(), delete(), doDelete(), edit(), save(), and update().

1577  : void
1578  {
1579  $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1580  }
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilECSSettingsGUI::initSettingsForm (   $a_mode = 'update')
protected

init settings form

Definition at line 277 of file class.ilECSSettingsGUI.php.

References $duration, $path, ilECSSetting\AUTH_APACHE, ilECSSetting\AUTH_CERTIFICATE, buildPath(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\UICore\GlobalTemplate\get(), ILIAS\Repository\lng(), prepareRoleSelect(), ilECSSetting\PROTOCOL_HTTPS, ilSelectInputGUI\setOptions(), ilPasswordInputGUI\setRetype(), settings(), ilRadioGroupInputGUI\setValue(), and ILIAS\UICore\GlobalTemplate\setVariable().

Referenced by create(), edit(), and settings().

277  : void
278  {
279  if (isset($this->form) && is_object($this->form)) {
280  return;
281  }
282 
283  $this->form = new ilPropertyFormGUI();
284  $this->form->setFormAction($this->ctrl->getFormAction($this, 'settings'));
285  $this->form->setTitle($this->lng->txt('ecs_connection_settings'));
286 
287  $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'), 'active');
288  $ena->setChecked($this->settings->isEnabled());
289  $ena->setValue("1");
290  $this->form->addItem($ena);
291 
292  $server_title = new ilTextInputGUI($this->lng->txt('ecs_server_title'), 'title');
293  $server_title->setValue($this->settings->getTitle());
294  $server_title->setSize(80);
295  $server_title->setMaxLength(128);
296  $server_title->setRequired(true);
297  $this->form->addItem($server_title);
298 
299  $ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'), 'server');
300  $ser->setValue((string) $this->settings->getServer());
301  $ser->setRequired(true);
302  $this->form->addItem($ser);
303 
304  $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'), 'protocol');
305  // fixed to https
306  #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
307  # ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
308  $pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS'));
309  $pro->setValue($this->settings->getProtocol());
310  $pro->setRequired(true);
311  $this->form->addItem($pro);
312 
313  $por = new ilTextInputGUI($this->lng->txt('ecs_port'), 'port');
314  $por->setSize(5);
315  $por->setMaxLength(5);
316  $por->setValue((string) $this->settings->getPort());
317  $por->setRequired(true);
318  $this->form->addItem($por);
319 
320  $tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'), 'auth_type');
321  $tcer->setValue((string) $this->settings->getAuthType());
322  $this->form->addItem($tcer);
323 
324  // Certificate based authentication
325  $cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), (string) ilECSSetting::AUTH_CERTIFICATE);
326  $tcer->addOption($cert_based);
327 
328  $cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'), 'client_cert');
329  $cli->setSize(60);
330  $cli->setValue((string) $this->settings->getClientCertPath());
331  $cli->setRequired(true);
332  $cert_based->addSubItem($cli);
333 
334  $key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'), 'key_path');
335  $key->setSize(60);
336  $key->setValue((string) $this->settings->getKeyPath());
337  $key->setRequired(true);
338  $cert_based->addSubItem($key);
339 
340  $cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'), 'key_password');
341  $cerp->setSize(12);
342  $cerp->setValue((string) $this->settings->getKeyPassword());
343  $cerp->setInputType('password');
344  $cerp->setRequired(true);
345  $cert_based->addSubItem($cerp);
346 
347  $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'), 'ca_cert');
348  $cer->setSize(60);
349  $cer->setValue((string) $this->settings->getCACertPath());
350  $cer->setRequired(true);
351  $cert_based->addSubItem($cer);
352 
353  // Apache auth
354  $apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), (string) ilECSSetting::AUTH_APACHE);
355  $tcer->addOption($apa_based);
356 
357  $user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'), 'auth_user');
358  $user->setSize(32);
359  $user->setValue($this->settings->getAuthUser());
360  $user->setRequired(true);
361  $apa_based->addSubItem($user);
362 
363  $pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass');
364  $pass->setRetype(false);
365  $pass->setSize(32);
366  $pass->setMaxLength(128);
367  $pass->setValue($this->settings->getAuthPass());
368  $pass->setRequired(true);
369  $pass->setSkipSyntaxCheck(true);
370  $apa_based->addSubItem($pass);
371 
372 
373  $ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
374  $ser->setValue($this->settings->getCertSerialNumber() ?: $this->lng->txt('ecs_no_value'));
375  $cert_based->addSubItem($ser);
376 
377  $loc = new ilFormSectionHeaderGUI();
378  $loc->setTitle($this->lng->txt('ecs_local_settings'));
379  $this->form->addItem($loc);
380 
381  $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'));
382  $imp->setRequired(true);
383 
384  $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'components/ILIAS/WebServices/ECS');
385  $tpl->setVariable('SIZE', 5);
386  $tpl->setVariable('MAXLENGTH', 11);
387  $tpl->setVariable('POST_VAR', 'import_id');
388  $tpl->setVariable('PROPERTY_VALUE', $this->settings->getImportId());
389 
390  if ($this->settings->getImportId()) {
391  $path = $this->buildPath($this->settings->getImportId());
392  if ($path === '') {
393  $imp->setAlert($this->lng->txt('err_check_input'));
394  } else {
395  $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->settings->getImportId()));
396  }
397  }
398 
399  $imp->setHTML($tpl->get());
400  $imp->setInfo($this->lng->txt('ecs_import_id_info'));
401  $this->form->addItem($imp);
402 
403  $loc = new ilFormSectionHeaderGUI();
404  $loc->setTitle($this->lng->txt('ecs_remote_user_settings'));
405  $this->form->addItem($loc);
406 
407  $role = new ilSelectInputGUI($this->lng->txt('ecs_role'), 'global_role');
408  $role->setOptions($this->prepareRoleSelect());
409  $role->setValue($this->settings->getGlobalRole());
410  $role->setInfo($this->lng->txt('ecs_global_role_info'));
411  $role->setRequired(true);
412  $this->form->addItem($role);
413 
414  $duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'), 'duration');
415  $duration->setInfo($this->lng->txt('ecs_account_duration_info'));
416  $duration->setMonths($this->settings->getDuration());
417  $duration->setShowSeconds(false);
418  $duration->setShowMinutes(false);
419  $duration->setShowHours(false);
420  $duration->setShowDays(false);
421  $duration->setShowMonths(true);
422  $duration->setRequired(true);
423  $this->form->addItem($duration);
424 
425  // Email recipients
426  $loc = new ilFormSectionHeaderGUI();
427  $loc->setTitle($this->lng->txt('ecs_notifications'));
428  $this->form->addItem($loc);
429 
430  $rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'), 'user_recipients');
431  $rcp_user->setValue($this->settings->getUserRecipientsAsString());
432  $rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info'));
433  $this->form->addItem($rcp_user);
434 
435  $rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'), 'econtent_recipients');
436  $rcp_econ->setValue($this->settings->getEContentRecipientsAsString());
437  $rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info'));
438  $this->form->addItem($rcp_econ);
439 
440  $rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'), 'approval_recipients');
441  $rcp_app->setValue($this->settings->getApprovalRecipientsAsString());
442  $rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
443  $this->form->addItem($rcp_app);
444 
445  if ($a_mode === 'update') {
446  $this->form->addCommandButton('update', $this->lng->txt('save'));
447  } else {
448  $this->form->addCommandButton('save', $this->lng->txt('save'));
449  }
450  $this->form->addCommandButton('overview', $this->lng->txt('cancel'));
451  }
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
ilGlobalTemplateInterface $tpl
setOptions(array $a_options)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
$duration
$path
Definition: ltiservices.php:29
This class represents a property in a property form.
This class represents a password property in a property form.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
form( $class_path, string $cmd, string $submit_caption="")
prepareRoleSelect()
get global role array
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromPost()

ilECSSettingsGUI::loadFromPost ( )
protected

Load from post.

Definition at line 519 of file class.ilECSSettingsGUI.php.

References settings(), and ilUtil\stripSlashes().

Referenced by save(), and update().

519  : void
520  {
521  $this->settings->setEnabledStatus((bool) $_POST['active']);
522  $this->settings->setTitle(ilUtil::stripSlashes($_POST['title']));
523  $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
524  $this->settings->setPort((int) ilUtil::stripSlashes($_POST['port']));
525  $this->settings->setProtocol((int) ilUtil::stripSlashes($_POST['protocol']));
526  $this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
527  $this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
528  $this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
529  $this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
530  $this->settings->setImportId((int) ilUtil::stripSlashes($_POST['import_id']));
531  $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
532  $this->settings->setGlobalRole((int) $_POST['global_role']);
533  $this->settings->setDuration((int) $_POST['duration']['MM']);
534  $this->settings->setUserRecipients(explode(',', ilUtil::stripSlashes($_POST['user_recipients'])));
535  $this->settings->setEContentRecipients(explode(',', ilUtil::stripSlashes($_POST['econtent_recipients'])));
536  $this->settings->setApprovalRecipients(explode(',', ilUtil::stripSlashes($_POST['approval_recipients'])));
537 
538  $this->settings->setAuthType((int) $_POST['auth_type']);
539  $this->settings->setAuthPass(ilUtil::stripSlashes($_POST['auth_pass']));
540  $this->settings->setAuthUser(ilUtil::stripSlashes($_POST['auth_user']));
541  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ overview()

ilECSSettingsGUI::overview ( )

List available servers.

Definition at line 112 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilECSServerSettings\getInstance(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by update().

112  : void
113  {
114  $this->tabs_gui->setSubTabActive('overview');
115  if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
116  $this->toolbar->addButton(
117  $this->lng->txt('ecs_add_new_ecs'),
118  $this->ctrl->getLinkTarget($this, 'create')
119  );
120  }
121 
123 
124  $table = new ilECSServerTableGUI($this, 'overview');
125  $table->initTable();
126  $table->parse($servers);
127  $this->tpl->setContent($table->getHTML());
128  }
static getInstance()
Get singleton instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareFieldSelection()

ilECSSettingsGUI::prepareFieldSelection (   $fields)
protected

get options for field selection

Parameters
arrayarray of field objects

Definition at line 1562 of file class.ilECSSettingsGUI.php.

References ilAdvancedMDRecord\_lookupTitle(), and ILIAS\Repository\lng().

Referenced by initMappingsForm().

1562  : array
1563  {
1564  $options[0] = $this->lng->txt('ecs_ignore_field');
1565  foreach ($fields as $field) {
1566  $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
1567  $options[$field->getFieldId()] = $title . ': ' . $field->getTitle();
1568  }
1569  return $options;
1570  }
static _lookupTitle(int $a_record_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelect()

ilECSSettingsGUI::prepareRoleSelect ( )
private

get global role array

Definition at line 1634 of file class.ilECSSettingsGUI.php.

References ilObject\_lookupTitle(), ilUtil\_sortIds(), and ILIAS\Repository\lng().

Referenced by initSettingsForm().

1634  : array
1635  {
1636  $global_roles = ilUtil::_sortIds(
1637  $this->rbacreview->getGlobalRoles(),
1638  'object_data',
1639  'title',
1640  'obj_id'
1641  );
1642 
1643  $select[0] = $this->lng->txt('links_select_one');
1644  foreach ($global_roles as $role_id) {
1645  $select[$role_id] = ilObject::_lookupTitle((int) $role_id);
1646  }
1647  return $select;
1648  }
static _lookupTitle(int $obj_id)
static _sortIds(array $a_ids, string $a_table, string $a_field, string $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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAll()

ilECSSettingsGUI::readAll ( )
protected

Read all importable econtent.

Definition at line 157 of file class.ilECSSettingsGUI.php.

References $server, ilECSTaskScheduler\_getInstanceByServerId(), ilECSServerSettings\ACTIVE_SERVER, ilECSServerSettings\getInstance(), imported(), and ILIAS\Repository\lng().

157  : bool
158  {
159  try {
160  //TOOD fix somehow broken logic code of this foreach loop
162  (new ilECSEventQueueReader($server))->handleImportReset();
163  (new ilECSEventQueueReader($server))->handleExportReset();
164 
165  ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
166 
167  $this->tpl->setOnScreenMessage('info', $this->lng->txt('ecs_remote_imported'));
168  $this->imported();
169  return true;
170  }
171  } catch (ilECSConnectorException $e1) {
172  $this->tpl->setOnScreenMessage('info', 'Cannot connect to ECS server: ' . $e1->getMessage());
173  $this->imported();
174  } catch (ilException $e2) {
175  $this->tpl->setOnScreenMessage('info', 'Update failed: ' . $e2->getMessage());
176  $this->imported();
177  }
178  return false;
179  }
static getInstance()
Get singleton instance.
Reads ECS events and stores them in the database.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
imported()
Show imported materials.
$server
Definition: shib_login.php:24
+ Here is the call graph for this function:

◆ refreshParticipants()

ilECSSettingsGUI::refreshParticipants ( )
protected

Refresh participants.

Definition at line 546 of file class.ilECSSettingsGUI.php.

References Vendor\Package\$e, $server, ilECSServerSettings\ALL_SERVER, ILIAS\Repository\ctrl(), ilECSParticipantSetting\delete(), ilECSServerSettings\getInstance(), ilECSParticipantSettings\getInstanceByServerId(), ilECSCommunityReader\getInstanceByServerId(), and ILIAS\Repository\lng().

546  : void
547  {
549  foreach ($servers->getServers(ilECSServerSettings::ALL_SERVER) as $server) {
550  // read community
551  try {
552  $creader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
553  foreach (ilECSParticipantSettings::getInstanceByServerId($server->getServerId())->getAvailabeMids() as $mid) {
554  if (!$creader->getParticipantByMID($mid)) {
555  $this->log->notice('Deleting deprecated participant: ' . $server->getServerId() . ' ' . $mid);
556  $part = new ilECSParticipantSetting($server->getServerId(), $mid);
557  $part->delete();
558  }
559  }
560  } catch (ilECSConnectorException $e) {
561  $this->tpl->setOnScreenMessage('failure', $server->getServer() . ': ' . $e->getMessage(), true);
562  }
563  }
564  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
565  $this->ctrl->redirect($this, 'communities');
566  }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getInstance()
Get singleton instance.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
$server
Definition: shib_login.php:24
delete()
Delete one participant entry.
+ Here is the call graph for this function:

◆ released()

ilECSSettingsGUI::released ( )
protected

Show released materials.

Definition at line 1427 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilECSExportManager\getInstance(), ilECSUtils\getPossibleReleaseTypes(), ILIAS\Repository\lng(), settings(), and ILIAS\Repository\toolbar().

1427  : void
1428  {
1429  $this->tabs_gui->setSubTabActive('ecs_released');
1430 
1431  if ($this->settings->isEnabled()) {
1432  $this->toolbar->addButton(
1433  $this->lng->txt('ecs_read_remote_links'),
1434  $this->ctrl->getLinkTarget($this, 'readAll')
1435  );
1436 
1437  $this->toolbar->addSeparator();
1438  }
1439 
1440  $sel_type = $_REQUEST["otype"];
1441  if (!$sel_type) {
1442  $sel_type = "rcrs";
1443  }
1444 
1445  $options = ilECSUtils::getPossibleReleaseTypes(true);
1446 
1447  $sel = new ilSelectInputGUI("", "otype");
1448  $sel->setOptions($options);
1449  $sel->setValue($sel_type);
1450  $this->toolbar->addInputItem($sel);
1451 
1452  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "released"));
1453  $this->toolbar->addFormButton($this->lng->txt("submit"), "released");
1454 
1455  $exported = ilECSExportManager::getInstance()->getExportedIdsByType($sel_type);
1456  if (count($exported)) {
1457  $this->toolbar->addSeparator();
1458 
1459  $this->toolbar->addButton(
1460  $this->lng->txt('csv_export'),
1461  $this->ctrl->getLinkTarget($this, 'exportReleased')
1462  );
1463  }
1464 
1465  $table_gui = new ilECSExportedContentTableGUI($this, 'released');
1466  $table_gui->setTitle($this->lng->txt('ecs_released_content'));
1467  $table_gui->parse($exported);
1468  $this->tpl->setContent($table_gui->getHTML());
1469  }
static getPossibleReleaseTypes(bool $a_with_captions=false)
Get all possible release object types.
This class represents a selection list property in a property form.
static getInstance()
Get the singelton instance of this ilECSExportManager.
+ Here is the call graph for this function:

◆ save()

ilECSSettingsGUI::save ( )
protected

Save settings.

Definition at line 475 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), loadFromPost(), and settings().

475  : void
476  {
477  $this->initSettings(0);
478  $this->loadFromPost();
479 
480  if (!$error = $this->settings->validate()) {
481  $this->settings->save();
482 
483  #$this->updateTitle();
484  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
485  } else {
486  $this->tpl->setOnScreenMessage('info', $this->lng->txt($error));
487  }
488  $this->ctrl->redirect($this, 'overview');
489  }
loadFromPost()
Load from post.
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ saveExportMappings()

ilECSSettingsGUI::saveExportMappings ( )
protected

Save mappings.

Definition at line 869 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

869  : void
870  {
871  foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
872  foreach ((array) $mappings as $ecs_field => $advmd_id) {
873  $map = new ilECSDataMappingSetting(
874  (int) $_POST['ecs_mapping_server'],
875  (int) $mtype,
876  $ecs_field
877  );
878  $map->setAdvMDId((int) $advmd_id);
879  $map->save();
880  }
881  }
882 
883  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
884  $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
885  $this->ctrl->redirect($this, 'exportMappings');
886  }
+ Here is the call graph for this function:

◆ saveImportMappings()

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

Definition at line 847 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

847  : void
848  {
849  foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
850  foreach ((array) $mappings as $ecs_field => $advmd_id) {
851  $map = new ilECSDataMappingSetting(
852  (int) $_REQUEST['ecs_mapping_server'],
853  (int) $mtype,
854  $ecs_field
855  );
856  $map->setAdvMDId((int)$advmd_id);
857  $map->save();
858  }
859  }
860 
861  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
862  $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
863  $this->ctrl->redirect($this, 'importMappings');
864  }
+ Here is the call graph for this function:

◆ setMappingTabs()

ilECSSettingsGUI::setMappingTabs ( int  $a_active)
protected

Handle tabs for ECS data mapping.

Definition at line 728 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by exportMappings(), and importMappings().

728  : void
729  {
730  $this->tabs_gui->clearTargets();
731  $this->tabs_gui->clearSubTabs();
732 
733  $this->tabs_gui->setBackTarget(
734  $this->lng->txt('ecs_settings'),
735  $this->ctrl->getLinkTarget($this, 'overview')
736  );
737  if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
738  $this->tabs_gui->addTab(
739  'import',
740  $this->lng->txt('ecs_tab_import'),
741  $this->ctrl->getLinkTarget($this, 'importMappings')
742  );
743  }
744  $this->tabs_gui->addTab(
745  'export',
746  $this->lng->txt('ecs_tab_export'),
747  $this->ctrl->getLinkTarget($this, 'exportMappings')
748  );
749 
750 
751  switch ($a_active) {
752  case self::MAPPING_IMPORT:
753  $this->tabs_gui->activateTab('import');
754  break;
755 
756  case self::MAPPING_EXPORT:
757  $this->tabs_gui->activateTab('export');
758  break;
759  }
760  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilECSSettingsGUI::setSubTabs ( )
protected

set sub tabs

Definition at line 1585 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ilECSServerSettings\getInstance().

Referenced by executeCommand().

1585  : void
1586  {
1587  $this->tabs_gui->clearSubTabs();
1588 
1589  $this->tabs_gui->addSubTabTarget(
1590  "overview",
1591  $this->ctrl->getLinkTarget($this, 'overview'),
1592  "overview",
1593  get_class($this)
1594  );
1595 
1596  // Disable all other tabs, if server hasn't been configured.
1597  if (ilECSServerSettings::getInstance()->serverExists()) {
1598  $this->tabs_gui->addSubTabTarget(
1599  "ecs_communities",
1600  $this->ctrl->getLinkTarget($this, 'communities'),
1601  "communities",
1602  get_class($this)
1603  );
1604 
1605  if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
1606  $this->tabs_gui->addSubTabTarget(
1607  'ecs_mappings',
1608  $this->ctrl->getLinkTarget($this, 'importMappings'),
1609  'importMappings',
1610  get_class($this)
1611  );
1612 
1613  $this->tabs_gui->addSubTabTarget(
1614  'ecs_category_mapping',
1615  $this->ctrl->getLinkTarget($this, 'categoryMapping')
1616  );
1617 
1618  $this->tabs_gui->addSubTabTarget(
1619  'ecs_import',
1620  $this->ctrl->getLinkTarget($this, 'imported')
1621  );
1622 
1623  $this->tabs_gui->addSubTabTarget(
1624  'ecs_released',
1625  $this->ctrl->getLinkTarget($this, 'released')
1626  );
1627  }
1628  }
1629  }
static getInstance()
Get singleton instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilECSSettingsGUI::settings ( )
protected

show settings

Definition at line 266 of file class.ilECSSettingsGUI.php.

References ILIAS\Repository\form(), and initSettingsForm().

Referenced by activate(), deactivate(), delete(), doDelete(), exportImported(), exportReleased(), initSettings(), initSettingsForm(), loadFromPost(), released(), save(), update(), and updateTitle().

266  : void
267  {
268  $this->initSettingsForm();
269  $this->tabs_gui->setSubTabActive('ecs_settings');
270 
271  $this->tpl->setContent($this->form->getHTML());
272  }
initSettingsForm($a_mode='update')
init settings form
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showRulesTable()

ilECSSettingsGUI::showRulesTable ( )
protected

Show rules table.

Definition at line 1152 of file class.ilECSSettingsGUI.php.

References ilECSCategoryMapping\getActiveRules().

Referenced by categoryMapping().

1152  : string
1153  {
1154  $rule_table = new ilECSCategoryMappingTableGUI($this, 'categoryMapping');
1155  $rule_table->parse(ilECSCategoryMapping::getActiveRules());
1156  return $rule_table->getHTML();
1157  }
static getActiveRules()
get active rules
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilECSSettingsGUI::update ( )
protected

save settings

Definition at line 456 of file class.ilECSSettingsGUI.php.

References edit(), initSettings(), ILIAS\Repository\lng(), loadFromPost(), overview(), and settings().

456  : void
457  {
458  $this->initSettings((int) $_REQUEST['server_id']);
459  $this->loadFromPost();
460 
461  if (!$error = $this->settings->validate()) {
462  $this->settings->update();
463  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
464  } else {
465  $this->tpl->setOnScreenMessage('info', $this->lng->txt($error));
466  $this->edit();
467  }
468 
469  $this->overview();
470  }
edit()
Edit server setting.
loadFromPost()
Load from post.
overview()
List available servers.
initSettings(int $a_server_id=1)
Init settings.
+ Here is the call graph for this function:

◆ updateCategoryMapping()

ilECSSettingsGUI::updateCategoryMapping ( )
protected

update category mapping

Definition at line 1077 of file class.ilECSSettingsGUI.php.

References categoryMapping(), ILIAS\Repository\ctrl(), editCategoryMapping(), ILIAS\Repository\form(), initCategoryMappingForm(), initRule(), ILIAS\Repository\lng(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

1077  : bool
1078  {
1079  if (!$_REQUEST['rule_id']) {
1080  $this->tpl->setOnScreenMessage('info', $this->lng->txt('select_one'));
1081  $this->categoryMapping();
1082  return false;
1083  }
1084  $this->ctrl->saveParameter($this, 'rule_id');
1085  $this->initRule((int) $_REQUEST['rule_id']);
1086  $this->initCategoryMappingForm('edit');
1087  if ($this->form->checkInput()) {
1088  $this->rule->setContainerId((int) $this->form->getInput('import_id'));
1089  $this->rule->setFieldName($this->form->getInput('field'));
1090  $this->rule->setMappingType((int) $this->form->getInput('type'));
1091 
1092 
1093  switch ($this->form->getInput('type')) {
1095  $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1096  break;
1097 
1099  if ($this->form->getItemByPostVar('dur_begin')) {
1100  $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1101  }
1102  if ($this->form->getItemByPostVar('dur_end')) {
1103  $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1104  }
1105  break;
1106 
1108  $this->rule->setByType($this->form->getInput('by_type'));
1109  break;
1110  }
1111 
1112  if ($err = $this->rule->validate()) {
1113  $this->tpl->setOnScreenMessage('info', $this->lng->txt($err));
1114  $this->form->setValuesByPost();
1115  $this->editCategoryMapping();
1116  return false;
1117  }
1118 
1119  $this->rule->update();
1120  $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
1121  $this->ctrl->redirect($this, 'categoryMapping');
1122  return true;
1123  }
1124  $this->tpl->setOnScreenMessage('info', $this->lng->txt('err_check_input'));
1125  $this->form->setValuesByPost();
1126  $this->editCategoryMapping();
1127  return false;
1128  }
editCategoryMapping()
Edit category mapping.
categoryMapping()
Category mappings.
initRule(int $a_rule_id=0)
Init rule.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ updateCommunities()

ilECSSettingsGUI::updateCommunities ( )
protected

update whitelist

Definition at line 663 of file class.ilECSSettingsGUI.php.

References Vendor\Package\$e, $server, ilECSServerSettings\ACTIVE_SERVER, ILIAS\Repository\ctrl(), ilECSServerSettings\getInstance(), ilECSCommunityCache\getInstance(), ilECSCommunityReader\getInstanceByServerId(), ILIAS\Repository\lng(), and validateImportTypes().

663  : void
664  {
665  // @TODO: Delete deprecated communities
666  $validatedImportTypes = $this->validateImportTypes($_POST['import_type']);
667 
669  foreach ($servers->getServers(ilECSServerSettings::ACTIVE_SERVER) as $server) {
670  try {
671  // Read communities
672  $cReader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
673 
674  // Update community cache
675  foreach ($cReader->getCommunities() as $community) {
676  $cCache = ilECSCommunityCache::getInstance($server->getServerId(), $community->getId());
677  $cCache->setCommunityName($community->getTitle());
678  $cCache->setMids($community->getMids());
679  $cCache->setOwnId($community->getOwnId());
680  $cCache->update();
681  }
682  } catch (Exception $e) {
683  $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
684  }
685  }
686  foreach ((array) $_POST['sci_mid'] as $sid => $mids) {
687  $this->log->info("server id is " . print_r($sid, true));
688  foreach ((array) $mids as $mid => $value) {
689  $set = new ilECSParticipantSetting($sid, $mid);
690  #$set->enableExport(array_key_exists($mid, (array) $_POST['export'][$sid]) ? true : false);
691  #$set->enableImport(array_key_exists($mid, (array) $_POST['import'][$sid]) ? true : false);
692  if ($validatedImportTypes) {
693  $set->setImportType((int) $validatedImportTypes[$sid][$mid]);
694  } else {
695  $set->setImportType((int) $_POST['import_type'][$sid][$mid]);
696  }
697 
698  // update title/cname
699  try {
700  $part = ilECSCommunityReader::getInstanceByServerId($sid)->getParticipantByMID($mid);
701  if ($part instanceof ilECSParticipant) {
702  $set->setTitle($part->getParticipantName());
703  }
704  $com = ilECSCommunityReader::getInstanceByServerId($sid)->getCommunityByMID($mid);
705  if ($com instanceof ilECSCommunity) {
706  $set->setCommunityName($com->getTitle());
707  }
708  } catch (Exception $e) {
709  $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
710  }
711 
712  $set->update();
713  }
714  }
715  if ($validatedImportTypes) {
716  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('ecs_invalid_import_type_cms'), true);
717  } else {
718  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
719  }
720  $this->ctrl->redirect($this, 'communities');
721  // TODO: Do update of remote courses and ...
722  }
static getInstance(int $a_server_id, int $a_community_id)
Get instance.
static getInstance()
Get singleton instance.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
$server
Definition: shib_login.php:24
validateImportTypes(array $import_types)
Validate import types.
+ Here is the call graph for this function:

◆ updateTitle()

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

Definition at line 494 of file class.ilECSSettingsGUI.php.

References ilECSCommunityReader\getInstanceByServerId(), and settings().

494  : void
495  {
496  try {
497  $reader = ilECSCommunityReader::getInstanceByServerId($this->settings->getServerId());
498 
499  foreach ($reader->getCommunities() as $community) {
500  foreach ($community->getParticipants() as $part) {
501  $this->log->dump($community);
502  if ($part->isSelf()) {
503  $this->settings->setTitle($part->getParticipantName());
504  $this->settings->update();
505  return;
506  }
507  }
508  }
509  } catch (ilECSConnectorException $exc) {
510  $this->tpl->setOnScreenMessage('failure', $exc->getMessage());
511  }
512  $this->settings->setTitle('');
513  $this->settings->update();
514  }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
+ Here is the call graph for this function:

◆ validateImportTypes()

ilECSSettingsGUI::validateImportTypes ( array  $import_types)
protected

Validate import types.

Parameters
array$import_types

Definition at line 632 of file class.ilECSSettingsGUI.php.

References $server, ilECSParticipantSetting\IMPORT_CMS, and ilECSParticipantSetting\IMPORT_UNCHANGED.

Referenced by updateCommunities().

632  : array
633  {
634  $num_cms = 0;
635  foreach ((array) $import_types as $sid => $server) {
636  foreach ((array) $server as $mid => $import_type) {
637  if ((int) $import_type === ilECSParticipantSetting::IMPORT_CMS) {
638  ++$num_cms;
639  }
640  }
641  }
642 
643  if ($num_cms <= 1) {
644  return [];
645  }
646  // Change to import type "UNCHANGED"
647  $new_types = [];
648  foreach ((array) $import_types as $sid => $server) {
649  foreach ((array) $server as $mid => $import_type) {
650  if ((int) $import_type === ilECSParticipantSetting::IMPORT_CMS) {
651  $new_types[$sid][$mid] = ilECSParticipantSetting::IMPORT_UNCHANGED;
652  } else {
653  $new_types[$sid][$mid] = $import_type;
654  }
655  }
656  }
657  return $new_types;
658  }
$server
Definition: shib_login.php:24
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilECSSettingsGUI::$access
private

Definition at line 39 of file class.ilECSSettingsGUI.php.

◆ $ctrl

ilCtrl ilECSSettingsGUI::$ctrl
private

Definition at line 35 of file class.ilECSSettingsGUI.php.

◆ $form

ilPropertyFormGUI ilECSSettingsGUI::$form = null
private

Definition at line 46 of file class.ilECSSettingsGUI.php.

Referenced by initMappingsForm().

◆ $http

ILIAS HTTP Services ilECSSettingsGUI::$http
private

Definition at line 43 of file class.ilECSSettingsGUI.php.

◆ $lng

ilLanguage ilECSSettingsGUI::$lng
private

Definition at line 34 of file class.ilECSSettingsGUI.php.

◆ $log

ilLogger ilECSSettingsGUI::$log
private

Definition at line 32 of file class.ilECSSettingsGUI.php.

◆ $objDataCache

ilObjectDataCache ilECSSettingsGUI::$objDataCache
private

Definition at line 41 of file class.ilECSSettingsGUI.php.

◆ $rbacreview

ilRbacReview ilECSSettingsGUI::$rbacreview
private

Definition at line 37 of file class.ilECSSettingsGUI.php.

◆ $rule

ilECSCategoryMappingRule ilECSSettingsGUI::$rule
private

Definition at line 47 of file class.ilECSSettingsGUI.php.

◆ $settings

ilECSSetting ilECSSettingsGUI::$settings
private

Definition at line 44 of file class.ilECSSettingsGUI.php.

Referenced by cp().

◆ $tabs_gui

ilTabsGUI ilECSSettingsGUI::$tabs_gui
private

Definition at line 36 of file class.ilECSSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilECSSettingsGUI::$toolbar
private

Definition at line 40 of file class.ilECSSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilECSSettingsGUI::$tpl
private

Definition at line 33 of file class.ilECSSettingsGUI.php.

◆ $tree

ilTree ilECSSettingsGUI::$tree
private

Definition at line 38 of file class.ilECSSettingsGUI.php.

◆ $user

ilObjUser ilECSSettingsGUI::$user
private

Definition at line 42 of file class.ilECSSettingsGUI.php.

◆ MAPPING_EXPORT

const ilECSSettingsGUI::MAPPING_EXPORT = 1

Definition at line 29 of file class.ilECSSettingsGUI.php.

◆ MAPPING_IMPORT

const ilECSSettingsGUI::MAPPING_IMPORT = 2

Definition at line 30 of file class.ilECSSettingsGUI.php.


The documentation for this class was generated from the following file: