ILIAS  release_8 Revision v8.24
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 48 of file class.ilECSSettingsGUI.php.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilECSSettingsGUI::activate ( )
protected

activate server

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

132 : void
133 {
134 $this->initSettings((int) $_REQUEST['server_id']);
135 $this->settings->setEnabledStatus(true);
136 $this->settings->update();
137 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
138 $this->ctrl->redirect($this, 'overview');
139 }

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and 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.

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 }
initRule(int $a_rule_id=0)
Init rule.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
categoryMapping()
Category mappings.
form( $class_path, string $cmd)

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

+ 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.

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...

Referenced by initCategoryMappingForm(), and initSettingsForm().

+ Here is the caller graph for this function:

◆ categoryMapping()

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

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

988 : void
989 {
990 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
991 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.category_mapping.html', 'Services/WebServices/ECS');
992
993 $this->initRule();
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 }
showRulesTable()
Show rules table.

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

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

+ 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.

571 : void
572 {
573 $tpl = new \ilTemplate(
574 'tpl.ecs_communities.html',
575 true,
576 true,
577 'Services/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 {
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 }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getInstance()
Get singleton instance.
ilGlobalTemplateInterface $tpl
$server
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $server, $settings, $tpl, ILIAS\Repository\access(), ilECSServerSettings\ALL_SERVER, ILIAS\Repository\ctrl(), ilGlobalTemplateInterface\get(), ilECSServerSettings\getInstance(), ilECSCommunityReader\getInstanceByServerId(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ cp()

ilECSSettingsGUI::cp ( )
protected

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

215 : void
216 {
217 $this->initSettings((int) $_REQUEST['server_id']);
218
219 $copy = clone $this->settings;
220 $copy->save();
221
222 $this->ctrl->setParameter($this, 'server_id', $copy->getServerId());
223 $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_settings_cloned'), true);
224 $this->ctrl->redirect($this, 'edit');
225 }
save()
save settings

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

+ Here is the call graph for this function:

◆ create()

ilECSSettingsGUI::create ( )
protected

Create new settings.

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

183 : void
184 {
185 $this->initSettings(0);
186
187 $this->tabs_gui->clearTargets();
188 $this->tabs_gui->clearSubTabs();
189 $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
190
191 $this->initSettingsForm('create');
192 $this->tabs_gui->setSubTabActive('ecs_settings');
193
194 $this->tpl->setContent($this->form->getHTML());
195 }
initSettingsForm($a_mode='update')
init settings form

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

+ Here is the call graph for this function:

◆ deactivate()

ilECSSettingsGUI::deactivate ( )
protected

activate server

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

144 : void
145 {
146 $this->initSettings((int) $_REQUEST['server_id']);
147 $this->settings->setEnabledStatus(false);
148 $this->settings->update();
149 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
150 $this->ctrl->redirect($this, 'overview');
151 }

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

+ Here is the call graph for this function:

◆ delete()

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

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

230 : void
231 {
232 $this->initSettings((int) $_REQUEST['server_id']);
233
234 $this->tabs_gui->clearTargets();
235 $this->tabs_gui->clearSubTabs();
236 $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
237
238 $confirm = new ilConfirmationGUI();
239 $confirm->setFormAction($this->ctrl->getFormAction($this));
240 $confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
241 $confirm->setCancel($this->lng->txt('cancel'), 'overview');
242 $confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
243
244 $confirm->addItem('', '', $this->settings->getServer());
245 $confirm->addHiddenItem('server_id', (string) $this->settings->getServerId());
246
247 $this->tpl->setContent($confirm->getHTML());
248 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), initSettings(), ILIAS\Repository\lng(), and 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.

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 }
Defines a rule for the assignment of ECS remote courses to categories.
ilECSCategoryMappingRule $rule

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

+ Here is the call graph for this function:

◆ doDelete()

ilECSSettingsGUI::doDelete ( )
protected

Do delete.

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

253 : void
254 {
255 $this->initSettings((int) $_REQUEST['server_id']);
256 $this->settings->delete();
257 $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_setting_deleted'), true);
258 $this->ctrl->redirect($this, 'overview');
259 }

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

+ Here is the call graph for this function:

◆ edit()

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

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

200 : void
201 {
202 $this->initSettings((int) $_REQUEST['server_id']);
203 $this->ctrl->saveParameter($this, 'server_id');
204
205 $this->tabs_gui->clearTargets();
206 $this->tabs_gui->clearSubTabs();
207 $this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
208
209 $this->initSettingsForm();
210 $this->tabs_gui->setSubTabActive('ecs_settings');
211
212 $this->tpl->setContent($this->form->getHTML());
213 }

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

Referenced by update().

+ 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.

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 }

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

Referenced by updateCategoryMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilECSSettingsGUI::executeCommand ( )

Execute command.

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

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

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

+ 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.

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 ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:43
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id.
Remote course app class.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_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,...

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

+ 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.

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 }
static getInstancesByObjType($a_obj_type, $a_active_only=true)
setMappingTabs(int $a_active)
Handle tabs for ECS data mapping.
ilPropertyFormGUI $form
initMappingsForm(int $a_server_id, int $mapping_type)
init mapping form
This class represents a selection list property in a property form.

References $form, $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().

+ Here is the call graph for this function:

◆ exportReleased()

ilECSSettingsGUI::exportReleased ( )
protected

export released

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

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 getInstance()
Get the singelton instance of this ilECSExportManager.

References $settings, 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().

+ Here is the call graph for this function:

◆ imported()

ilECSSettingsGUI::imported ( )
protected

Show imported materials.

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

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 }
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.

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

Referenced by readAll().

+ 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.

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 }

References $form, $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().

+ 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.

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, 'Services/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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
$type

References $tpl, $type, buildPath(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilGlobalTemplateInterface\get(), ilECSCategoryMapping\getPossibleFields(), ilECSUtils\getPossibleRemoteTypes(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setVariable(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

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

+ 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.

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 }
prepareFieldSelection($fields)
get options for field selection
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
static _getOptionalEContentFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
setFormAction(string $a_formaction)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

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(), and ilPropertyFormGUI\setTitle().

Referenced by exportMappings(), and importMappings().

+ 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.

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 }

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

+ 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.

1577 : void
1578 {
1579 $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1580 }
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.

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

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

+ 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 276 of file class.ilECSSettingsGUI.php.

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

References ILIAS\LTI\ToolProvider\$key, $path, $tpl, $user, ilECSSetting\AUTH_APACHE, ilECSSetting\AUTH_CERTIFICATE, buildPath(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilGlobalTemplateInterface\get(), ILIAS\Repository\lng(), prepareRoleSelect(), ilECSSetting\PROTOCOL_HTTPS, settings(), and ilGlobalTemplateInterface\setVariable().

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

+ 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 518 of file class.ilECSSettingsGUI.php.

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

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

Referenced by save(), and update().

+ 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 111 of file class.ilECSSettingsGUI.php.

111 : void
112 {
113 $this->tabs_gui->setSubTabActive('overview');
114 if ($this->access->checkAccess('write', '', (int) $_REQUEST["ref_id"])) {
115 $this->toolbar->addButton(
116 $this->lng->txt('ecs_add_new_ecs'),
117 $this->ctrl->getLinkTarget($this, 'create')
118 );
119 }
120
122
123 $table = new ilECSServerTableGUI($this, 'overview');
124 $table->initTable();
125 $table->parse($servers);
126 $this->tpl->setContent($table->getHTML());
127 }

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

Referenced by update().

+ 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.

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)

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

Referenced by initMappingsForm().

+ 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.

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 _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,...

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

Referenced by initSettingsForm().

+ 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 156 of file class.ilECSSettingsGUI.php.

156 : bool
157 {
158 try {
159 //TOOD fix somehow broken logic code of this foreach loop
161 (new ilECSEventQueueReader($server))->handleImportReset();
162 (new ilECSEventQueueReader($server))->handleExportReset();
163
164 ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
165
166 $this->tpl->setOnScreenMessage('info', $this->lng->txt('ecs_remote_imported'));
167 $this->imported();
168 return true;
169 }
170 } catch (ilECSConnectorException $e1) {
171 $this->tpl->setOnScreenMessage('info', 'Cannot connect to ECS server: ' . $e1->getMessage());
172 $this->imported();
173 } catch (ilException $e2) {
174 $this->tpl->setOnScreenMessage('info', 'Update failed: ' . $e2->getMessage());
175 $this->imported();
176 }
177 return false;
178 }
Reads ECS events and stores them in the database.
imported()
Show imported materials.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ refreshParticipants()

ilECSSettingsGUI::refreshParticipants ( )
protected

Refresh participants.

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

545 : void
546 {
548 foreach ($servers->getServers(ilECSServerSettings::ALL_SERVER) as $server) {
549
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.

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

+ Here is the call graph for this function:

◆ released()

ilECSSettingsGUI::released ( )
protected

Show released materials.

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

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.

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

+ Here is the call graph for this function:

◆ save()

ilECSSettingsGUI::save ( )
protected

Save settings.

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

474 : void
475 {
476 $this->initSettings(0);
477 $this->loadFromPost();
478
479 if (!$error = $this->settings->validate()) {
480 $this->settings->save();
481
482 #$this->updateTitle();
483 $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
484 } else {
485 $this->tpl->setOnScreenMessage('info', $this->lng->txt($error));
486 }
487 $this->ctrl->redirect($this, 'overview');
488 }
loadFromPost()
Load from post.

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

+ Here is the call graph for this function:

◆ saveExportMappings()

ilECSSettingsGUI::saveExportMappings ( )
protected

Save mappings.

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

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 }

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

+ Here is the call graph for this function:

◆ saveImportMappings()

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

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

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 }

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

+ 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.

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) {
753 $this->tabs_gui->activateTab('import');
754 break;
755
757 $this->tabs_gui->activateTab('export');
758 break;
759 }
760 }

References ILIAS\Repository\access(), ILIAS\Repository\lng(), MAPPING_EXPORT, and MAPPING_IMPORT.

Referenced by exportMappings(), and importMappings().

+ 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.

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 }

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

Referenced by executeCommand().

+ 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 265 of file class.ilECSSettingsGUI.php.

265 : void
266 {
267 $this->initSettingsForm();
268 $this->tabs_gui->setSubTabActive('ecs_settings');
269
270 $this->tpl->setContent($this->form->getHTML());
271 }

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

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

+ 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.

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

References ilECSCategoryMapping\getActiveRules().

Referenced by categoryMapping().

+ 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 455 of file class.ilECSSettingsGUI.php.

455 : void
456 {
457 $this->initSettings((int) $_REQUEST['server_id']);
458 $this->loadFromPost();
459
460 if (!$error = $this->settings->validate()) {
461 $this->settings->update();
462 $this->tpl->setOnScreenMessage('info', $this->lng->txt('settings_saved'), true);
463 } else {
464 $this->tpl->setOnScreenMessage('info', $this->lng->txt($error));
465 $this->edit();
466 }
467
468 $this->overview();
469 }
edit()
Edit server setting.
overview()
List available servers.

References edit(), initSettings(), ILIAS\Repository\lng(), loadFromPost(), overview(), and 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.

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.

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.

+ Here is the call graph for this function:

◆ updateCommunities()

ilECSSettingsGUI::updateCommunities ( )
protected

update whitelist

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

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.
validateImportTypes(array $import_types)
Validate import types.

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

+ Here is the call graph for this function:

◆ updateTitle()

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

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

493 : void
494 {
495 try {
496 $reader = ilECSCommunityReader::getInstanceByServerId($this->settings->getServerId());
497
498 foreach ($reader->getCommunities() as $community) {
499 foreach ($community->getParticipants() as $part) {
500 $this->log->dump($community);
501 if ($part->isSelf()) {
502 $this->settings->setTitle($part->getParticipantName());
503 $this->settings->update();
504 return;
505 }
506 }
507 }
508 } catch (ilECSConnectorException $exc) {
509 $this->tpl->setOnScreenMessage('failure', $exc->getMessage());
510 }
511 $this->settings->setTitle('');
512 $this->settings->update();
513 }

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

+ 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.

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 }

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

Referenced by updateCommunities().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilECSSettingsGUI::$access
private

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

◆ $ctrl

ilCtrl ilECSSettingsGUI::$ctrl
private

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

◆ $form

ilPropertyFormGUI ilECSSettingsGUI::$form = null
private

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

Referenced by exportMappings(), importMappings(), and initMappingsForm().

◆ $http

ILIAS HTTP Services ilECSSettingsGUI::$http
private

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

◆ $lng

ilLanguage ilECSSettingsGUI::$lng
private

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

◆ $log

ilLogger ilECSSettingsGUI::$log
private

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

◆ $objDataCache

ilObjectDataCache ilECSSettingsGUI::$objDataCache
private

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

◆ $rbacreview

ilRbacReview ilECSSettingsGUI::$rbacreview
private

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

◆ $rule

ilECSCategoryMappingRule ilECSSettingsGUI::$rule
private

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

Referenced by deleteCategoryMappings().

◆ $settings

ilECSSetting ilECSSettingsGUI::$settings
private

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

Referenced by communities(), cp(), exportImported(), and exportReleased().

◆ $tabs_gui

ilTabsGUI ilECSSettingsGUI::$tabs_gui
private

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

◆ $toolbar

ilToolbarGUI ilECSSettingsGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilECSSettingsGUI::$tpl
private

◆ $tree

ilTree ilECSSettingsGUI::$tree
private

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

◆ $user

ilObjUser ilECSSettingsGUI::$user
private

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

Referenced by initSettingsForm().

◆ MAPPING_EXPORT

const ilECSSettingsGUI::MAPPING_EXPORT = 1

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

Referenced by setMappingTabs().

◆ MAPPING_IMPORT

const ilECSSettingsGUI::MAPPING_IMPORT = 2

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

Referenced by setMappingTabs().


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