ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilECSSettingsGUI Class Reference
+ Collaboration diagram for ilECSSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 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 @global ilTabs $ilTabs. 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 (&$import_types)
 Validate import types. More...
 
 updateCommunities ()
 update whitelist More...
 
 setMappingTabs ($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 ($a_server_id, $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 ($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 ($a_server_id=1)
 Init settings. More...
 
 setSubTabs ()
 set sub tabs More...
 
 initTaskScheduler ()
 Init next task execution @global <type> $ilDB @global <type> $ilSetting. More...
 

Protected Attributes

 $log = null
 
 $tpl
 
 $lng
 
 $ctrl
 
 $tabs_gui
 

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSSettingsGUI::__construct ( )

Constructor.

@access public

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

57 {
58 global $DIC;
59
60 $lng = $DIC['lng'];
61 $tpl = $DIC['tpl'];
62 $ilCtrl = $DIC['ilCtrl'];
63 $ilTabs = $DIC['ilTabs'];
64
65 $this->tpl = $tpl;
66 $this->lng = $lng;
67 $this->lng->loadLanguageModule('ecs');
68 $this->ctrl = $ilCtrl;
69 $this->tabs_gui = $ilTabs;
70
71 $this->log = $GLOBALS['DIC']->logger()->wsrv();
72
73 $this->initSettings();
74 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
initSettings($a_server_id=1)
Init settings.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $GLOBALS, $ilCtrl, $lng, $tpl, and initSettings().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilECSSettingsGUI::activate ( )
protected

activate server

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

164 {
165 $this->initSettings($_REQUEST['server_id']);
166 $this->settings->setEnabledStatus(true);
167 $this->settings->update();
168 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
169 $this->ctrl->redirect($this, 'overview');
170 }

References initSettings(), and settings().

+ Here is the call graph for this function:

◆ addCategoryMapping()

ilECSSettingsGUI::addCategoryMapping ( )
protected

save category mapping

Returns

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

1214 {
1215 $this->initRule();
1216
1217 $this->initCategoryMappingForm('add');
1218 if ($this->form->checkInput()) {
1219 $this->rule->setContainerId($this->form->getInput('import_id'));
1220 $this->rule->setFieldName($this->form->getInput('field'));
1221 $this->rule->setMappingType($this->form->getInput('type'));
1222
1223 switch ($this->form->getInput('type')) {
1225 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1226 break;
1227
1229 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1230 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1231 break;
1232
1234 $this->rule->setByType($this->form->getInput('by_type'));
1235 break;
1236 }
1237
1238 if ($err = $this->rule->validate()) {
1239 ilUtil::sendInfo($this->lng->txt($err));
1240 $this->form->setValuesByPost();
1241 $this->categoryMapping();
1242 return false;
1243 }
1244
1245 $this->rule->save();
1246 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1247 unset($this->rule);
1248 $this->categoryMapping();
1249 return true;
1250 }
1251 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1252 $this->form->setValuesByPost();
1253 $this->categoryMapping();
1254 return false;
1255 }
initCategoryMappingForm($a_mode='add')
Init category mapping form.
initRule($a_rule_id=0)
Init rule.
categoryMapping()
Category mappings.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References categoryMapping(), initCategoryMappingForm(), initRule(), ilUtil\sendInfo(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

+ Here is the call graph for this function:

◆ buildPath()

ilECSSettingsGUI::buildPath (   $a_ref_id)
private
Parameters
int$a_ref_id
Returns
string

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

1932 {
1933 global $DIC;
1934
1935 $tree = $DIC->repositoryTree();
1936
1937 if (!$tree->isInTree($a_ref_id) || $tree->isDeleted($a_ref_id)) {
1938 return '';
1939 }
1940 $loc = new ilLocatorGUI();
1941 $loc->setTextOnly(false);
1942 $loc->addContextItems($a_ref_id);
1943
1944 return $loc->getHTML();
1945 }
locator handling class

References $DIC.

Referenced by initCategoryMappingForm(), and initSettingsForm().

+ Here is the caller graph for this function:

◆ categoryMapping()

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

Returns

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

1195 {
1196 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1197 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.category_mapping.html', 'Services/WebServices/ECS');
1198
1199 $this->initRule();
1200 $this->initCategoryMappingForm();
1201
1202
1203 $this->tpl->setVariable('NEW_RULE_TABLE', $this->form->getHTML());
1204 if ($html = $this->showRulesTable()) {
1205 $this->tpl->setVariable('RULES_TABLE', $html);
1206 }
1207 }
showRulesTable()
Show rules table.

References 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

@access public

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

682 {
683 global $DIC;
684
685 $gtpl = $DIC->ui()->mainTemplate();
686 $tpl = new \ilTemplate(
687 'tpl.ecs_communities.html',
688 true,
689 true,
690 'Services/WebServices/ECS'
691 );
692
693 $ilAccess = $DIC['ilAccess'];
694 // add toolbar to refresh communities
695 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
696 $GLOBALS['DIC']['ilToolbar']->addButton(
697 $this->lng->txt('ecs_refresh_participants'),
698 $this->ctrl->getLinkTarget($this, 'refreshParticipants')
699 );
700 }
701
702
703 $this->tabs_gui->setSubTabActive('ecs_communities');
704
705 $tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'updateCommunities'));
706
707 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
708 $tpl->setCurrentBlock("submit_buttons");
709 $tpl->setVariable('TXT_SAVE', $this->lng->txt('save'));
710 $tpl->setVariable('TXT_CANCEL', $this->lng->txt('cancel'));
711 $tpl->parseCurrentBlock();
712 }
713
714 include_once('Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
715 include_once('Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
716
717 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
719 #$settings->readInactiveServers();
720
721 foreach ($settings->getServers() as $server) {
722 // Try to read communities
723 try {
725 foreach ($reader->getCommunities() as $community) {
726 $tpl->setCurrentBlock('table_community');
727 $table_gui = new ilECSCommunityTableGUI($server, $this, 'communities', $community->getId());
728 $table_gui->setTitle($community->getTitle() . ' (' . $community->getDescription() . ')');
729 $table_gui->parse($community->getParticipants());
730 $tpl->setVariable('TABLE_COMM', $table_gui->getHTML());
731 $tpl->parseCurrentBlock();
732 }
733 } catch (ilECSConnectorException $exc) {
734 // Maybe server is not fully configured
735 continue;
736 }
737
738 // Show section for each server
739 $tpl->setCurrentBlock('server');
740 $tpl->setVariable('TXT_SERVER_NAME', $server->getTitle());
741 $tpl->parseCurrentBlock();
742 }
743
744 $gtpl->setContent($tpl->get());
745
746
747 }
static getInstanceByServerId($a_server_id)
Get instance by server id.
static getInstance()
Get singleton instance.
$server

References $DIC, $GLOBALS, $reader, $server, $tpl, ilECSServerSettings\getInstance(), and ilECSCommunityReader\getInstanceByServerId().

+ Here is the call graph for this function:

◆ cp()

ilECSSettingsGUI::cp ( )
protected

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

264 {
265 $this->initSettings((int) $_REQUEST['server_id']);
266
267 $copy = clone $this->settings;
268 $copy->save();
269
270 $this->ctrl->setParameter($this, 'server_id', $copy->getServerId());
271 ilUtil::sendSuccess($this->lng->txt('ecs_settings_cloned'), true);
272 $this->ctrl->redirect($this, 'edit');
273 }

References initSettings().

+ Here is the call graph for this function:

◆ create()

ilECSSettingsGUI::create ( )
protected

Create new settings @global ilTabs $ilTabs.

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

224 {
225 global $DIC;
226
227 $ilTabs = $DIC['ilTabs'];
228
229 $this->initSettings(0);
230
231 $ilTabs->clearTargets();
232 $ilTabs->clearSubTabs();
233 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
234
235 $this->initSettingsForm('create');
236 $this->tabs_gui->setSubTabActive('ecs_settings');
237
238 $this->tpl->setContent($this->form->getHTML());
239 }
initSettingsForm($a_mode='update')
init settings form

References $DIC, initSettings(), and initSettingsForm().

Referenced by save().

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

◆ deactivate()

ilECSSettingsGUI::deactivate ( )
protected

activate server

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

176 {
177 $this->initSettings($_REQUEST['server_id']);
178 $this->settings->setEnabledStatus(false);
179 $this->settings->update();
180 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
181 $this->ctrl->redirect($this, 'overview');
182 }

References initSettings(), and settings().

+ Here is the call graph for this function:

◆ delete()

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

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

279 {
280 global $DIC;
281
282 $ilTabs = $DIC['ilTabs'];
283
284 $this->initSettings((int) $_REQUEST['server_id']);
285
286 $ilTabs->clearTargets();
287 $ilTabs->clearSubTabs();
288 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
289
290 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
291 $confirm = new ilConfirmationGUI();
292 $confirm->setFormAction($this->ctrl->getFormAction($this));
293 $confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
294 $confirm->setCancel($this->lng->txt('cancel'), 'overview');
295 $confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
296
297 $confirm->addItem('', '', $this->settings->getServer());
298 $confirm->addHiddenItem('server_id', $this->settings->getServerId());
299
300 $this->tpl->setContent($confirm->getHTML());
301 }
Confirmation screen class.

References $DIC, initSettings(), and settings().

+ Here is the call graph for this function:

◆ deleteCategoryMappings()

ilECSSettingsGUI::deleteCategoryMappings ( )
protected

Delete selected category mappings.

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

1335 {
1336 if (!is_array($_POST['rules']) or !$_POST['rules']) {
1337 ilUtil::sendInfo($this->lng->txt('no_checkbox'));
1338 $this->categoryMapping();
1339 return false;
1340 }
1341 foreach ($_POST['rules'] as $rule_id) {
1342 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1343 $rule = new ilECSCategoryMappingRule($rule_id);
1344 $rule->delete();
1345 }
1346 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1347 $this->categoryMapping();
1348 return true;
1349 }
$_POST["username"]
Defines a rule for the assignment of ECS remote courses to categories.

References $_POST, categoryMapping(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ doDelete()

ilECSSettingsGUI::doDelete ( )
protected

Do delete.

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

307 {
308 $this->initSettings($_REQUEST['server_id']);
309 $this->settings->delete();
310
311 // Delete communities
312 include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
313 ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']);
314
315 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
316 ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']);
317
318 include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
319 ilECSEventQueueReader::deleteServer((int) $_REQUEST['server_id']);
320
321 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
322 ilECSExport::deleteByServer((int) $_REQUEST['server_id']);
323
324 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
325 ilECSImport::deleteByServer((int) $_REQUEST['server_id']);
326
327 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
328 ilECSParticipantSettings::deleteByServer((int) $_REQUEST['server_id']);
329
330 ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'), true);
331 $this->ctrl->redirect($this, 'overview');
332 }
static delete($a_server_id)
Delete comunities by server id.
static delete($a_server_id)
Delete server @global ilDB $ilDB.
static deleteServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server id @global ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server @global $ilDB.

References ilECSCommunitiesCache\delete(), ilECSDataMappingSettings\delete(), ilECSExport\deleteByServer(), ilECSImport\deleteByServer(), ilECSParticipantSettings\deleteByServer(), ilECSEventQueueReader\deleteServer(), initSettings(), and settings().

+ Here is the call graph for this function:

◆ edit()

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

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

245 {
246 global $DIC;
247
248 $ilTabs = $DIC['ilTabs'];
249
250 $this->initSettings((int) $_REQUEST['server_id']);
251 $this->ctrl->saveParameter($this, 'server_id', (int) $_REQUEST['server_id']);
252
253 $ilTabs->clearTargets();
254 $ilTabs->clearSubTabs();
255 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'overview'));
256
257 $this->initSettingsForm();
258 $this->tabs_gui->setSubTabActive('ecs_settings');
259
260 $this->tpl->setContent($this->form->getHTML());
261 }

References $DIC, initSettings(), and initSettingsForm().

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.

Returns

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

1262 {
1263 if (!$_REQUEST['rule_id']) {
1264 ilUtil::sendInfo($this->lng->txt('select_one'));
1265 $this->categoryMapping();
1266 return false;
1267 }
1268
1269 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1270 $this->ctrl->saveParameter($this, 'rule_id');
1271 $this->initRule((int) $_REQUEST['rule_id']);
1272
1273 $this->initCategoryMappingForm('edit');
1274 $this->tpl->setContent($this->form->getHTML());
1275 return true;
1276 }

References categoryMapping(), initCategoryMappingForm(), initRule(), and ilUtil\sendInfo().

Referenced by updateCategoryMapping().

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

◆ executeCommand()

ilECSSettingsGUI::executeCommand ( )

Execute command.

@access public

Parameters

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

84 {
85 global $DIC;
86
87 $ilAccess = $DIC['ilAccess'];
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd();
90
91 $this->setSubTabs();
92 switch ($next_class) {
93 case 'ilecsmappingsettingsgui':
94 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingSettingsGUI.php';
95 $mapset = new ilECSMappingSettingsGUI($this, (int) $_REQUEST['server_id'], (int) $_REQUEST['mid']);
96 $this->ctrl->setReturn($this, 'communities');
97 $this->ctrl->forwardCommand($mapset);
98 break;
99
100 case 'ilecsparticipantsettingsgui':
101 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettingsGUI.php';
102 $part = new ilECSParticipantSettingsGUI(
103 (int) $_REQUEST['server_id'],
104 (int) $_REQUEST['mid']
105 );
106 $this->ctrl->setReturn($this, 'communities');
107 $this->ctrl->forwardCommand($part);
108 break;
109
110 default:
111
112 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"]) && $cmd != "overview" && $cmd != "communities") {
113 $this->ctrl->redirect($this, "overview");
114 }
115
116 if (!$cmd || $cmd == 'view') {
117 $cmd = "overview";
118 }
119 $this->$cmd();
120 break;
121 }
122 return true;
123 }

References $DIC, and setSubTabs().

+ Here is the call graph for this function:

◆ exportImported()

ilECSSettingsGUI::exportImported ( )
protected

csv export of imported remote courses

@access protected

Returns

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

1555 {
1556 global $DIC;
1557
1558 $ilObjDataCache = $DIC['ilObjDataCache'];
1559 $ilUser = $DIC['ilUser'];
1560
1561 // :TODO: mind resource type and move to ilRemoteObjectBase...
1562
1563 $rcourses = ilUtil::_getObjectsByOperations('rcrs', 'visible', $ilUser->getId(), -1);
1564
1565 // Read participants
1566 include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
1567 include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
1568 try {
1570 } catch (ilECSConnectorException $e) {
1571 $reader = null;
1572 }
1573
1574 // read obj_ids
1575 $ilObjDataCache->preloadReferenceCache($rcourses);
1576 $obj_ids = array();
1577 foreach ($rcourses as $rcrs_ref_id) {
1578 $obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
1579 $obj_ids[$obj_id] = $obj_id;
1580 }
1581
1582 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1583 $writer = new ilCSVWriter();
1584
1585 $writer->addColumn($this->lng->txt('title'));
1586 $writer->addColumn($this->lng->txt('description'));
1587 $writer->addColumn($this->lng->txt('ecs_imported_from'));
1588 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1589 $writer->addColumn($this->lng->txt('ecs_field_term'));
1590 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1591 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1592 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1593 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1594 $writer->addColumn($this->lng->txt('ecs_field_room'));
1595 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1596 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1597 $writer->addColumn($this->lng->txt('ecs_field_end'));
1598 $writer->addColumn($this->lng->txt('last_update'));
1599
1600 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1602
1603 foreach ($obj_ids as $obj_id) {
1604 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1605 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1606
1607 $writer->addRow();
1608 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1609 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1610
1611 $mid = ilObjRemoteCourse::_lookupMID($obj_id);
1612 if ($reader and ($participant = $reader->getParticipantByMID($mid))) {
1613 $writer->addColumn($participant->getParticipantName());
1614 }
1615 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseID');
1616 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1617
1618 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'term');
1619 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1620
1621 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'lecturer');
1622 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1623
1624 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseType');
1625 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1626
1627 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'semester_hours');
1628 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1629
1630 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'credits');
1631 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1632
1633 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room');
1634 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1635
1636 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle');
1637 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1638
1639 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin');
1640 $dt = '';
1641 if (isset($values[$field])) {
1642 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1643 $dt = $dt->get(IL_CAL_DATETIME);
1644 }
1645 $writer->addColumn($dt);
1646
1647 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end');
1648 $dt = '';
1649 if (isset($values[$field])) {
1650 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1651 $dt = $dt->get(IL_CAL_DATETIME);
1652 }
1653 $writer->addColumn($dt);
1654
1655 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1656 }
1657 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_import.csv", "text/csv");
1658 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
Helper class to generate CSV files.
@classDescription Date and time handling
static _getInstance()
get singleton instance
static _getInstance()
Get Singleton instance.
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
static _lookupMID($a_obj_id)
lookup owner mid
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
$ilUser
Definition: imgupload.php:18

References $DIC, Vendor\Package\$e, $ilUser, $reader, ilECSCommunityReader\_getInstance(), ilECSDataMappingSettings\_getInstance(), ilUtil\_getObjectsByOperations(), ilObject\_lookupDescription(), ilRemoteObjectBase\_lookupMID(), ilObject\_lookupTitle(), ilUtil\deliverData(), ilECSUtils\getAdvancedMDValuesForObjId(), IL_CAL_DATETIME, IL_CAL_UNIX, and ilECSDataMappingSetting\MAPPING_IMPORT_RCRS.

+ Here is the call graph for this function:

◆ exportMappings()

ilECSSettingsGUI::exportMappings ( )
protected

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

@access protected

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

974 {
975 global $DIC;
976
977 $ilToolbar = $DIC['ilToolbar'];
978
979 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
980
981 $this->setMappingTabs(self::MAPPING_EXPORT);
982
984 if (!count($fields)) {
985 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
986 return true;
987 }
988
989 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
991 $settings->readInactiveServers();
992
993 $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
994 if (!$sel_srv) {
995 $sel_srv = $_SESSION["ecs_sel_srv"];
996 } else {
997 $_SESSION["ecs_sel_srv"] = $sel_srv;
998 }
999
1000 // Iterate all servers
1001 $options = array(0 => $this->lng->txt("please_choose"));
1002 foreach ($settings->getServers() as $server) {
1003 $title = $server->getTitle();
1004 if (!$title) {
1005 $title = "ECS (" . $server->getServerId() . ")";
1006 }
1007 $options[$server->getServerId()] = $title;
1008 }
1009
1010 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1011 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
1012 $sel->setOptions($options);
1013 $sel->setValue($sel_srv);
1014 $ilToolbar->addInputItem($sel);
1015
1016 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "exportMappings"));
1017 $ilToolbar->addFormButton($this->lng->txt("submit"), "exportMappings");
1018
1019 if ($sel_srv) {
1020 $form = $this->initMappingsForm($sel_srv, self::MAPPING_EXPORT);
1021 $this->tpl->setContent($form->getHTML());
1022 }
1023
1024 return true;
1025 }
$_SESSION["AccountId"]
static getInstancesByObjType($a_obj_type, $a_active_only=true)
initMappingsForm($a_server_id, $mapping_type)
init mapping form
setMappingTabs($a_active)
Handle tabs for ECS data mapping.
This class represents a selection list property in a property form.

References $_SESSION, $DIC, $server, ilECSServerSettings\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), initMappingsForm(), ilUtil\sendInfo(), and setMappingTabs().

+ Here is the call graph for this function:

◆ exportReleased()

ilECSSettingsGUI::exportReleased ( )
protected

export released

@access protected

Returns

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

1728 {
1729 global $DIC;
1730
1731 $ilObjDataCache = $DIC['ilObjDataCache'];
1732
1733 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1734 $exported = ilECSExport::getExportedIds();
1735 $ilObjDataCache->preloadObjectCache($exported);
1736
1737 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1738 $writer = new ilCSVWriter();
1739
1740 $writer->addColumn($this->lng->txt('title'));
1741 $writer->addColumn($this->lng->txt('description'));
1742 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1743 $writer->addColumn($this->lng->txt('ecs_field_term'));
1744 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1745 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1746 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1747 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1748 $writer->addColumn($this->lng->txt('ecs_field_room'));
1749 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1750 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1751 $writer->addColumn($this->lng->txt('ecs_field_end'));
1752 $writer->addColumn($this->lng->txt('last_update'));
1753
1754 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1756
1757 foreach ($exported as $obj_id) {
1758 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1759 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1760
1761 $writer->addRow();
1762 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1763 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1764
1765 $field = $settings->getMappingByECSName(0, 'courseID');
1766 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1767
1768 $field = $settings->getMappingByECSName(0, 'term');
1769 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1770
1771 $field = $settings->getMappingByECSName(0, 'lecturer');
1772 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1773
1774 $field = $settings->getMappingByECSName(0, 'courseType');
1775 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1776
1777 $field = $settings->getMappingByECSName(0, 'semester_hours');
1778 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1779
1780 $field = $settings->getMappingByECSName(0, 'credits');
1781 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1782
1783 $field = $settings->getMappingByECSName(0, 'room');
1784 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1785
1786 $field = $settings->getMappingByECSName(0, 'cycle');
1787 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1788
1789 $field = $settings->getMappingByECSName(0, 'begin');
1790 $dt = '';
1791 if (isset($values[$field])) {
1792 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1793 $dt = $dt->get(IL_CAL_DATETIME);
1794 }
1795 $writer->addColumn($dt);
1796
1797 $field = $settings->getMappingByECSName(0, 'end');
1798 $dt = '';
1799 if (isset($values[$field])) {
1800 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1801 $dt = $dt->get(IL_CAL_DATETIME);
1802 }
1803 $writer->addColumn($dt);
1804
1805 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1806 }
1807
1808 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv");
1809 }
static getExportedIds()
Get exported ids @global ilDB $ilDB.

References $DIC, ilECSDataMappingSettings\_getInstance(), ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilUtil\deliverData(), ilECSUtils\getAdvancedMDValuesForObjId(), ilECSExport\getExportedIds(), IL_CAL_DATETIME, and IL_CAL_UNIX.

+ Here is the call graph for this function:

◆ imported()

ilECSSettingsGUI::imported ( )
protected

Show imported materials.

@access protected

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

1493 {
1494 global $DIC;
1495
1496 $ilUser = $DIC['ilUser'];
1497 $ilToolbar = $DIC['ilToolbar'];
1498
1499 $this->tabs_gui->setSubTabActive('ecs_import');
1500
1501 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1502 if (ilECSServerSettings::getInstance()->activeServerExists()) {
1503 $ilToolbar->addButton(
1504 $this->lng->txt('ecs_read_remote_links'),
1505 $this->ctrl->getLinkTarget($this, 'readAll')
1506 );
1507
1508 $ilToolbar->addSeparator();
1509 }
1510
1511
1512 $sel_type = $_REQUEST["otype"];
1513 if (!$sel_type) {
1514 $sel_type = "rcrs";
1515 }
1516
1517 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
1518 $options = ilECSUtils::getPossibleRemoteTypes(true);
1519
1520 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1521 $sel = new ilSelectInputGUI("", "otype");
1522 $sel->setOptions($options);
1523 $sel->setValue($sel_type);
1524 $ilToolbar->addInputItem($sel);
1525
1526 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "imported"));
1527 $ilToolbar->addFormButton($this->lng->txt("submit"), "imported");
1528
1529 $robjs = ilUtil::_getObjectsByOperations($sel_type, 'visible', $ilUser->getId(), -1);
1530 if (count($robjs)) {
1531 $ilToolbar->addSeparator();
1532
1533 $ilToolbar->addButton(
1534 $this->lng->txt('csv_export'),
1535 $this->ctrl->getLinkTarget($this, 'exportImported')
1536 );
1537 }
1538
1539 include_once('Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
1540 $table_gui = new ilECSImportedContentTableGUI($this, 'imported');
1541 $table_gui->setTitle($this->lng->txt('ecs_imported_content'));
1542 $table_gui->parse($robjs);
1543 $this->tpl->setContent($table_gui->getHTML());
1544
1545 return true;
1546 }
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.

References $DIC, $ilUser, ilUtil\_getObjectsByOperations(), ilECSServerSettings\getInstance(), and ilECSUtils\getPossibleRemoteTypes().

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.

@access protected

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

915 {
916 global $DIC;
917
918 $ilToolbar = $DIC['ilToolbar'];
919
920 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
921
922 $this->setMappingTabs(self::MAPPING_IMPORT);
923
925 if (!count($fields)) {
926 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
927 return true;
928 }
929
930 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
932 $settings->readInactiveServers();
933
934 $sel_srv = (int) $_REQUEST["ecs_mapping_server"];
935 if (!$sel_srv) {
936 $sel_srv = $_SESSION["ecs_sel_srv"];
937 } else {
938 $_SESSION["ecs_sel_srv"] = $sel_srv;
939 }
940
941 // Iterate all servers
942 $options = array(0 => $this->lng->txt("please_choose"));
943 foreach ($settings->getServers() as $server) {
944 $title = $server->getTitle();
945 if (!$title) {
946 $title = "ECS (" . $server->getServerId() . ")";
947 }
948 $options[$server->getServerId()] = $title;
949 }
950
951 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
952 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
953 $sel->setOptions($options);
954 $sel->setValue($sel_srv);
955 $ilToolbar->addInputItem($sel);
956
957 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "importMappings"));
958 $ilToolbar->addFormButton($this->lng->txt("submit"), "importMappings");
959
960 if ($sel_srv) {
961 $form = $this->initMappingsForm($sel_srv, self::MAPPING_IMPORT);
962 $this->tpl->setContent($form->getHTML());
963 }
964
965 return true;
966 }

References $_SESSION, $DIC, $server, ilECSServerSettings\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), initMappingsForm(), ilUtil\sendInfo(), and setMappingTabs().

+ Here is the call graph for this function:

◆ initCategoryMappingForm()

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

Init category mapping form.

Returns

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

1388 {
1389 global $DIC;
1390
1391 $ilDB = $DIC['ilDB'];
1392
1393 if (is_object($this->form)) {
1394 return true;
1395 }
1396
1397 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1398 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1399
1400 $this->form = new ilPropertyFormGUI();
1401
1402 if ($a_mode == 'add') {
1403 $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
1404 $this->form->setFormAction($this->ctrl->getFormAction($this, 'categoryMapping'));
1405 $this->form->addCommandButton('addCategoryMapping', $this->lng->txt('save'));
1406 $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
1407 } else {
1408 $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
1409 $this->form->setFormAction($this->ctrl->getFormAction($this, 'editCategoryMapping'));
1410 $this->form->addCommandButton('updateCategoryMapping', $this->lng->txt('save'));
1411 $this->form->addCommandButton('categoryMapping', $this->lng->txt('cancel'));
1412 }
1413
1414 $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'), 'import_id');
1415 $imp->setRequired(true);
1416
1417 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
1418 $tpl->setVariable('SIZE', 5);
1419 $tpl->setVariable('MAXLENGTH', 11);
1420 $tpl->setVariable('POST_VAR', 'import_id');
1421 $tpl->setVariable('PROPERTY_VALUE', $this->rule->getContainerId());
1422
1423 if ($this->settings->getImportId()) {
1424 $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->rule->getContainerId()));
1425 }
1426
1427 $imp->setHTML($tpl->get());
1428 $imp->setInfo($this->lng->txt('ecs_import_id_info'));
1429 $this->form->addItem($imp);
1430
1431 include_once('./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php');
1432 $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'), 'field');
1433 $select->setValue($this->rule->getFieldName());
1434 $select->setRequired(true);
1435 $select->setOptions(ilECSCategoryMapping::getPossibleFields());
1436 $this->form->addItem($select);
1437
1438 // Value
1439 $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'), 'type');
1440 $value->setValue($this->rule->getMappingType());
1441 $value->setRequired(true);
1442
1443 $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'), ilECSCategoryMappingRule::TYPE_FIXED);
1444 $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
1445
1446 $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'), 'mapping_value');
1447 $fixed_val->setValue($this->rule->getMappingValue());
1448 $fixed_val->setMaxLength(255);
1449 $fixed_val->setSize(40);
1450 $fixed_val->setRequired(true);
1451 $fixed->addSubItem($fixed_val);
1452
1453 $value->addOption($fixed);
1454
1455 $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'), ilECSCategoryMappingRule::TYPE_DURATION);
1456 $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
1457
1458 $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'), 'dur_begin');
1459 $dur_start->setRequired(true);
1460 $dur_start->setDate($this->rule->getDateRangeStart());
1461 $duration->addSubItem($dur_start);
1462
1463 $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'), 'dur_end');
1464 $dur_end->setRequired(true);
1465 $dur_end->setDate($this->rule->getDateRangeEnd());
1466 $duration->addSubItem($dur_end);
1467
1468 $value->addOption($duration);
1469
1470 $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'), ilECSCategoryMappingRule::TYPE_BY_TYPE);
1471 $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
1472
1473 $options = ilECSUtils::getPossibleRemoteTypes(true);
1474
1475 $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
1476 $types->setOptions($options);
1477 $types->setValue($this->rule->getByType());
1478 $types->setRequired(true);
1479 $type->addSubitem($types);
1480
1481 $value->addOption($type);
1482
1483 $this->form->addItem($value);
1484 }
This class represents a custom property in a property form.
This class represents a date/time property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
$type
global $ilDB

References $DIC, $ilDB, $tpl, $type, buildPath(), ilECSCategoryMapping\getPossibleFields(), ilECSUtils\getPossibleRemoteTypes(), settings(), 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 (   $a_server_id,
  $mapping_type 
)
protected

init mapping form

Parameters
int$a_server_id
Returns
ilPropertyFormGUI $form

@access protected

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

1090 {
1091 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1092
1093 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1094 $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
1095
1096 $form = new ilPropertyFormGUI();
1097
1098 if ($mapping_type == self::MAPPING_IMPORT) {
1099 $form->setTitle($this->lng->txt('ecs_mapping_tbl'));
1100 $form->addCommandButton('saveImportMappings', $this->lng->txt('save'));
1101 $form->addCommandButton('importMappings', $this->lng->txt('cancel'));
1102 } else {
1103 $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
1104 $form->addCommandButton('saveExportMappings', $this->lng->txt('save'));
1105 $form->addCommandButton('exportMappings', $this->lng->txt('cancel'));
1106 }
1107
1108 $form->setFormAction($this->ctrl->getFormAction($this, 'saveMappings'));
1109
1110 if ($mapping_type == self::MAPPING_IMPORT) {
1111 $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs'));
1112 $form->addItem($assignments);
1113 }
1114
1115 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1117 $options = $this->prepareFieldSelection($fields);
1118
1119 // get all optional ecourse fields
1120 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1122 foreach ($optional as $field_name) {
1123 if ($mapping_type == self::MAPPING_IMPORT) {
1124 $select = new ilSelectInputGUI(
1125 $this->lng->txt('ecs_field_' . $field_name),
1126 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_IMPORT_CRS . '][' . $field_name . ']'
1127 );
1128
1129 $select->setValue(
1130 $mapping_settings->getMappingByECSName(
1132 $field_name
1133 )
1134 );
1135 $select->setOptions($options);
1136 $assignments->addSubItem($select);
1137 } else {
1138 $select = new ilSelectInputGUI(
1139 $this->lng->txt('ecs_field_' . $field_name),
1140 'mapping' . '[' . ilECSDataMappingSetting::MAPPING_EXPORT . '][' . $field_name . ']'
1141 );
1142 $select->setValue(
1143 $mapping_settings->getMappingByECSName(
1145 $field_name
1146 )
1147 );
1148 $select->setOptions($options);
1149 $form->addItem($select);
1150 }
1151 }
1152
1153 $server = new ilHiddenInputGUI('ecs_mapping_server');
1154 $server->setValue($a_server_id);
1155 $form->addItem($server);
1156
1157 // Remote courses
1158 // no remote course settings for export
1159 if ($mapping_type == self::MAPPING_EXPORT) {
1160 return $form;
1161 }
1162
1163 $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs'));
1164 $form->addItem($rcrs);
1165
1166 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1168 $options = $this->prepareFieldSelection($fields);
1169
1170 // get all optional econtent fields
1171 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1173 foreach ($optional as $field_name) {
1174 $select = new ilSelectInputGUI(
1175 $this->lng->txt('ecs_field_' . $field_name),
1176 'mapping[' . ilECSDataMappingSetting::MAPPING_IMPORT_RCRS . '][' . $field_name . ']'
1177 );
1178 $select->setValue(
1179 $mapping_settings->getMappingByECSName(
1181 $field_name
1182 )
1183 );
1184 $select->setOptions($options);
1185 $rcrs->addSubItem($select);
1186 }
1187 return $form;
1188 }
static getInstanceByServerId($a_server_id)
Get singleton instance.
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
This class represents a hidden form property in a property form.

References $server, ilECSUtils\_getOptionalEContentFields(), ilECSUtils\_getOptionalECourseFields(), ilECSDataMappingSettings\getInstanceByServerId(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), ilECSDataMappingSetting\MAPPING_EXPORT, ilECSDataMappingSetting\MAPPING_IMPORT_CRS, ilECSDataMappingSetting\MAPPING_IMPORT_RCRS, and prepareFieldSelection().

Referenced by exportMappings(), and importMappings().

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

◆ initRule()

ilECSSettingsGUI::initRule (   $a_rule_id = 0)
protected

Init rule.

Parameters
int$rule_idrule id
Returns

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

1374 {
1375 if (is_object($this->rule)) {
1376 return $this->rule;
1377 }
1378
1379 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1380 $this->rule = new ilECSCategoryMappingRule($a_rule_id);
1381 }

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

+ Here is the caller graph for this function:

◆ initSettings()

ilECSSettingsGUI::initSettings (   $a_server_id = 1)
protected

Init settings.

@access protected

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

1837 {
1838 include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
1839 $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1840 }
static getInstanceByServerId($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

@access protected

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

354 {
355 if (is_object($this->form)) {
356 return true;
357 }
358 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
359
360 $this->form = new ilPropertyFormGUI();
361 $this->form->setFormAction($this->ctrl->getFormAction($this, 'settings'));
362 $this->form->setTitle($this->lng->txt('ecs_connection_settings'));
363
364 $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'), 'active');
365 $ena->setChecked($this->settings->isEnabled());
366 $ena->setValue(1);
367 $this->form->addItem($ena);
368
369 $server_title = new ilTextInputGUI($this->lng->txt('ecs_server_title'), 'title');
370 $server_title->setValue($this->settings->getTitle());
371 $server_title->setSize(80);
372 $server_title->setMaxLength(128);
373 $server_title->setRequired(true);
374 $this->form->addItem($server_title);
375
376 $ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'), 'server');
377 $ser->setValue((string) $this->settings->getServer());
378 $ser->setRequired(true);
379 $this->form->addItem($ser);
380
381 $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'), 'protocol');
382 // fixed to https
383 #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
384 # ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
385 $pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS'));
386 $pro->setValue($this->settings->getProtocol());
387 $pro->setRequired(true);
388 $this->form->addItem($pro);
389
390 $por = new ilTextInputGUI($this->lng->txt('ecs_port'), 'port');
391 $por->setSize(5);
392 $por->setMaxLength(5);
393 $por->setValue((string) $this->settings->getPort());
394 $por->setRequired(true);
395 $this->form->addItem($por);
396
397 $tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'), 'auth_type');
398 $tcer->setValue($this->settings->getAuthType());
399 $this->form->addItem($tcer);
400
401 // Certificate based authentication
402 $cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), ilECSSetting::AUTH_CERTIFICATE);
403 $tcer->addOption($cert_based);
404
405 $cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'), 'client_cert');
406 $cli->setSize(60);
407 $cli->setValue((string) $this->settings->getClientCertPath());
408 $cli->setRequired(true);
409 $cert_based->addSubItem($cli);
410
411 $key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'), 'key_path');
412 $key->setSize(60);
413 $key->setValue((string) $this->settings->getKeyPath());
414 $key->setRequired(true);
415 $cert_based->addSubItem($key);
416
417 $cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'), 'key_password');
418 $cerp->setSize(12);
419 $cerp->setValue((string) $this->settings->getKeyPassword());
420 $cerp->setInputType('password');
421 $cerp->setRequired(true);
422 $cert_based->addSubItem($cerp);
423
424 $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'), 'ca_cert');
425 $cer->setSize(60);
426 $cer->setValue((string) $this->settings->getCACertPath());
427 $cer->setRequired(true);
428 $cert_based->addSubItem($cer);
429
430 // Apache auth
431 $apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), ilECSSetting::AUTH_APACHE);
432 $tcer->addOption($apa_based);
433
434 $user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'), 'auth_user');
435 $user->setSize(32);
436 $user->setValue((string) $this->settings->getAuthUser());
437 $user->setRequired(true);
438 $apa_based->addSubItem($user);
439
440 $pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass');
441 $pass->setRetype(false);
442 $pass->setSize(32);
443 $pass->setMaxLength(128);
444 $pass->setValue((string) $this->settings->getAuthPass());
445 $pass->setRequired(true);
446 $pass->setSkipSyntaxCheck(true);
447 $apa_based->addSubItem($pass);
448
449
450 $ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
451 $ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value'));
452 $cert_based->addSubItem($ser);
453
454 $loc = new ilFormSectionHeaderGUI();
455 $loc->setTitle($this->lng->txt('ecs_local_settings'));
456 $this->form->addItem($loc);
457
458 #$pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'),'polling');
459 #$pol->setShowDays(false);
460 #$pol->setShowHours(false);
461 #$pol->setShowMinutes(true);
462 #$pol->setShowSeconds(true);
463 #$pol->setSeconds($this->settings->getPollingTimeSeconds());
464 #$pol->setMinutes($this->settings->getPollingTimeMinutes());
465 #$pol->setRequired(true);
466 #$pol->setInfo($this->lng->txt('ecs_polling_info'));
467 #$this->form->addItem($pol);
468
469 $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'));
470 $imp->setRequired(true);
471
472 $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
473 $tpl->setVariable('SIZE', 5);
474 $tpl->setVariable('MAXLENGTH', 11);
475 $tpl->setVariable('POST_VAR', 'import_id');
476 $tpl->setVariable('PROPERTY_VALUE', $this->settings->getImportId());
477
478 if ($this->settings->getImportId()) {
479 $path = $this->buildPath($this->settings->getImportId());
480 if ($path == '') {
481 $imp->setAlert($this->lng->txt('err_check_input'));
482 } else {
483 $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->settings->getImportId()));
484 }
485 }
486
487 $imp->setHTML($tpl->get());
488 $imp->setInfo($this->lng->txt('ecs_import_id_info'));
489 $this->form->addItem($imp);
490
491 $loc = new ilFormSectionHeaderGUI();
492 $loc->setTitle($this->lng->txt('ecs_remote_user_settings'));
493 $this->form->addItem($loc);
494
495 $role = new ilSelectInputGUI($this->lng->txt('ecs_role'), 'global_role');
496 $role->setOptions($this->prepareRoleSelect());
497 $role->setValue($this->settings->getGlobalRole());
498 $role->setInfo($this->lng->txt('ecs_global_role_info'));
499 $role->setRequired(true);
500 $this->form->addItem($role);
501
502 $duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'), 'duration');
503 $duration->setInfo($this->lng->txt('ecs_account_duration_info'));
504 $duration->setMonths($this->settings->getDuration());
505 $duration->setShowSeconds(false);
506 $duration->setShowMinutes(false);
507 $duration->setShowHours(false);
508 $duration->setShowDays(false);
509 $duration->setShowMonths(true);
510 $duration->setRequired(true);
511 $this->form->addItem($duration);
512
513 // Email recipients
514 $loc = new ilFormSectionHeaderGUI();
515 $loc->setTitle($this->lng->txt('ecs_notifications'));
516 $this->form->addItem($loc);
517
518 $rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'), 'user_recipients');
519 $rcp_user->setValue((string) $this->settings->getUserRecipientsAsString());
520 $rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info'));
521 $this->form->addItem($rcp_user);
522
523 $rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'), 'econtent_recipients');
524 $rcp_econ->setValue((string) $this->settings->getEContentRecipientsAsString());
525 $rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info'));
526 $this->form->addItem($rcp_econ);
527
528 $rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'), 'approval_recipients');
529 $rcp_app->setValue((string) $this->settings->getApprovalRecipientsAsString());
530 $rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
531 $this->form->addItem($rcp_app);
532
533 if ($a_mode == 'update') {
534 $this->form->addCommandButton('update', $this->lng->txt('save'));
535 } else {
536 $this->form->addCommandButton('save', $this->lng->txt('save'));
537 }
538 $this->form->addCommandButton('overview', $this->lng->txt('cancel'));
539 }
This class represents a checkbox property in a property form.
This class represents a duration (typical hh:mm:ss) property in a property form.
prepareRoleSelect()
get global role array
This class represents a section header in a property form.
This class represents a non editable value in a property form.
This class represents a password property in a property form.

References $pass, $tpl, ilECSSetting\AUTH_APACHE, ilECSSetting\AUTH_CERTIFICATE, buildPath(), prepareRoleSelect(), ilECSSetting\PROTOCOL_HTTPS, and settings().

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

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

◆ initTaskScheduler()

ilECSSettingsGUI::initTaskScheduler ( )
protected

Init next task execution @global <type> $ilDB @global <type> $ilSetting.

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

1953 {
1954 global $DIC;
1955
1956 $ilDB = $DIC['ilDB'];
1957 $ilSetting = $DIC['ilSetting'];
1958
1959 $setting = new ilSetting('ecs');
1960 $setting->set(
1961 'next_execution_' . $this->settings->getServerId(),
1962 time() + (int) $this->settings->getPollingTime()
1963 );
1964 }
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilDB, $ilSetting, and settings().

Referenced by save(), and update().

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

618 {
619 $this->settings->setEnabledStatus((int) $_POST['active']);
620 $this->settings->setTitle(ilUtil::stripSlashes($_POST['title']));
621 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
622 $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
623 $this->settings->setProtocol(ilUtil::stripSlashes($_POST['protocol']));
624 $this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
625 $this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
626 $this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
627 $this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
628 $this->settings->setImportId(ilUtil::stripSlashes($_POST['import_id']));
629 $this->settings->setPollingTimeMS((int) $_POST['polling']['mm'], (int) $_POST['polling']['ss']);
630 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
631 $this->settings->setGlobalRole((int) $_POST['global_role']);
632 $this->settings->setDuration((int) $_POST['duration']['MM']);
633
634 $this->settings->setUserRecipients(ilUtil::stripSlashes($_POST['user_recipients']));
635 $this->settings->setEContentRecipients(ilUtil::stripSlashes($_POST['econtent_recipients']));
636 $this->settings->setApprovalRecipients(ilUtil::stripSlashes($_POST['approval_recipients']));
637
638 $this->settings->setAuthType((int) $_POST['auth_type']);
639 $this->settings->setAuthPass(ilUtil::stripSlashes($_POST['auth_pass']));
640 $this->settings->setAuthUser(ilUtil::stripSlashes($_POST['auth_user']));
641 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, 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.

Returns
void @global ilToolbar @global ilTabsGUI

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

132 {
133 global $DIC;
134
135 $ilToolbar = $DIC['ilToolbar'];
136 $ilTabs = $DIC['ilTabs'];
137 $ilAccess = $DIC['ilAccess'];
138
139 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
140
141 $ilTabs->setSubTabActive('overview');
142 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
143 $ilToolbar->addButton(
144 $this->lng->txt('ecs_add_new_ecs'),
145 $this->ctrl->getLinkTarget($this, 'create')
146 );
147 }
148
150 $servers->readInactiveServers();
151
152 include_once './Services/WebServices/ECS/classes/class.ilECSServerTableGUI.php';
153 $table = new ilECSServerTableGUI($this, 'overview');
154 $table->initTable();
155 $table->parse($servers);
156 $this->tpl->setContent($table->getHTML());
157 return;
158 }
Description of ilECSServerTableGUI.

References $DIC, and ilECSServerSettings\getInstance().

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 @access protected

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

1818 {
1819 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1820
1821 $options[0] = $this->lng->txt('ecs_ignore_field');
1822 foreach ($fields as $field) {
1823 $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
1824 $options[$field->getFieldId()] = $title . ': ' . $field->getTitle();
1825 }
1826 return $options;
1827 }
static _lookupTitle($a_record_id)
Lookup title.

References ilAdvancedMDRecord\_lookupTitle().

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

@access protected

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

1907 {
1908 global $DIC;
1909
1910 $rbacreview = $DIC['rbacreview'];
1911 $ilObjDataCache = $DIC['ilObjDataCache'];
1912
1913 $global_roles = ilUtil::_sortIds(
1914 $rbacreview->getGlobalRoles(),
1915 'object_data',
1916 'title',
1917 'obj_id'
1918 );
1919
1920 $select[0] = $this->lng->txt('links_select_one');
1921 foreach ($global_roles as $role_id) {
1922 $select[$role_id] = ilObject::_lookupTitle($role_id);
1923 }
1924 return $select;
1925 }
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...

References $DIC, ilObject\_lookupTitle(), and ilUtil\_sortIds().

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.

@access protected

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

190 {
191 include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
192 include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
193 include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
194 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
195
196 try {
197 foreach (ilECSServerSettings::getInstance()->getServers() as $server) {
200
201 include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
202 ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
203
204 ilUtil::sendInfo($this->lng->txt('ecs_remote_imported'));
205 $this->imported();
206 return true;
207 }
208 } catch (ilECSConnectorException $e1) {
209 ilUtil::sendInfo('Cannot connect to ECS server: ' . $e1->getMessage());
210 $this->imported();
211 return false;
212 } catch (ilException $e2) {
213 ilUtil::sendInfo('Update failed: ' . $e1->getMessage());
214 $this->imported();
215 return false;
216 }
217 }
static handleExportReset(ilECSSetting $server)
Handle export reset.
static handleImportReset(ilECSSetting $server)
Reread all imported econtent.
imported()
Show imported materials.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
Base class for ILIAS Exception handling.

References $server, ilECSTaskScheduler\_getInstanceByServerId(), ilECSServerSettings\getInstance(), ilECSEventQueueReader\handleExportReset(), ilECSEventQueueReader\handleImportReset(), imported(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ refreshParticipants()

ilECSSettingsGUI::refreshParticipants ( )
protected

Refresh participants.

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

647 {
648 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
649 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
650 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
651 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
652
654 $servers->readInactiveServers();
655 foreach ($servers->getServers() as $server) {
656
657 // read community
658 try {
659 $creader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
660 foreach (ilECSParticipantSettings::getAvailabeMids($server->getServerId()) as $mid) {
661 if (!$creader->getParticipantByMID($mid)) {
662 $this->log->notice('Deleting deprecated participant: ' . $server->getServerId() . ' ' . $mid);
663 $part = new ilECSParticipantSetting($server->getServerId(), $mid);
664 $part->delete();
665 }
666 }
667 } catch (ilECSConnectorException $e) {
668 ilUtil::sendFailure($server->getServer() . ': ' . $e->getMessage(), true);
669 }
670 }
671 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
672 $this->ctrl->redirect($this, 'communities');
673 }
static getAvailabeMids($a_server_id)
Get all available mids @global $ilDB.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References Vendor\Package\$e, $server, ilECSParticipantSettings\getAvailabeMids(), ilECSServerSettings\getInstance(), ilECSCommunityReader\getInstanceByServerId(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ released()

ilECSSettingsGUI::released ( )
protected

Show released materials.

@access protected

Returns

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

1667 {
1668 global $DIC;
1669
1670 $ilUser = $DIC['ilUser'];
1671 $ilToolbar = $DIC['ilToolbar'];
1672
1673 $this->tabs_gui->setSubTabActive('ecs_released');
1674
1675 if ($this->settings->isEnabled()) {
1676 $ilToolbar->addButton(
1677 $this->lng->txt('ecs_read_remote_links'),
1678 $this->ctrl->getLinkTarget($this, 'readAll')
1679 );
1680
1681 $ilToolbar->addSeparator();
1682 }
1683
1684 $sel_type = $_REQUEST["otype"];
1685 if (!$sel_type) {
1686 $sel_type = "rcrs";
1687 }
1688
1689 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1690 $options = ilECSUtils::getPossibleReleaseTypes(true);
1691
1692 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1693 $sel = new ilSelectInputGUI("", "otype");
1694 $sel->setOptions($options);
1695 $sel->setValue($sel_type);
1696 $ilToolbar->addInputItem($sel);
1697
1698 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "released"));
1699 $ilToolbar->addFormButton($this->lng->txt("submit"), "released");
1700
1701 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1702 $exported = ilECSExport::getExportedIdsByType($sel_type);
1703 if (count($exported)) {
1704 $ilToolbar->addSeparator();
1705
1706 $ilToolbar->addButton(
1707 $this->lng->txt('csv_export'),
1708 $this->ctrl->getLinkTarget($this, 'exportReleased')
1709 );
1710 }
1711
1712 include_once('Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
1713 $table_gui = new ilECSReleasedContentTableGUI($this, 'released');
1714 $table_gui->setTitle($this->lng->txt('ecs_released_content'));
1715 $table_gui->parse($exported);
1716 $this->tpl->setContent($table_gui->getHTML());
1717
1718 return true;
1719 }
static getExportedIdsByType($a_type)
Get exported ids by type @global ilDB $ilDB.
static getPossibleReleaseTypes($a_with_captions=false)
Get all possible release object types.

References $DIC, $ilUser, ilECSExport\getExportedIdsByType(), ilECSUtils\getPossibleReleaseTypes(), and settings().

+ Here is the call graph for this function:

◆ save()

ilECSSettingsGUI::save ( )
protected

Save settings.

Returns
<type>

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

570 {
571 $this->initSettings(0);
572 $this->loadFromPost();
573
574 if (!$error = $this->settings->validate()) {
575 $this->settings->save();
576 $this->initTaskScheduler();
577
578 #$this->updateTitle();
579 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
580 } else {
581 ilUtil::sendInfo($this->lng->txt($error));
582 return $this->create();
583 }
584 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'overview');
585 return true;
586 }
create()
Create new settings @global ilTabs $ilTabs.
initTaskScheduler()
Init next task execution @global <type> $ilDB @global <type> $ilSetting.
loadFromPost()
Load from post.

References $GLOBALS, create(), initSettings(), initTaskScheduler(), loadFromPost(), ilUtil\sendInfo(), and settings().

+ Here is the call graph for this function:

◆ saveExportMappings()

ilECSSettingsGUI::saveExportMappings ( )
protected

Save mappings.

@access protected

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

1061 {
1062 foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
1063 foreach ((array) $mappings as $ecs_field => $advmd_id) {
1064 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1065 $map = new ilECSDataMappingSetting(
1066 (int) $_POST['ecs_mapping_server'],
1067 (int) $mtype,
1068 $ecs_field
1069 );
1070 $map->setAdvMDId($advmd_id);
1071 $map->save();
1072 }
1073 }
1074
1075 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1076 $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
1077 $this->ctrl->redirect($this, 'exportMappings');
1078 return true;
1079 }

References $_POST, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveImportMappings()

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

@access protected

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

1034 {
1035 foreach ((array) $_POST['mapping'] as $mtype => $mappings) {
1036 foreach ((array) $mappings as $ecs_field => $advmd_id) {
1037 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1038 $map = new ilECSDataMappingSetting(
1039 (int) $_REQUEST['ecs_mapping_server'],
1040 (int) $mtype,
1041 $ecs_field
1042 );
1043 $map->setAdvMDId($advmd_id);
1044 $map->save();
1045 }
1046 }
1047
1048 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1049 $this->ctrl->setParameter($this, "ecs_mapping_server", (int) $_POST['ecs_mapping_server']);
1050 $this->ctrl->redirect($this, 'importMappings');
1051 return true;
1052 }

References $_POST, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ setMappingTabs()

ilECSSettingsGUI::setMappingTabs (   $a_active)
protected

Handle tabs for ECS data mapping.

Parameters
int$a_active@global ilTabsGUI ilTabs

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

870 {
871 global $DIC;
872
873 $ilTabs = $DIC['ilTabs'];
874 $ilAccess = $DIC['ilAccess'];
875
876 $ilTabs->clearTargets();
877 $ilTabs->clearSubTabs();
878
879 $ilTabs->setBackTarget(
880 $this->lng->txt('ecs_settings'),
881 $this->ctrl->getLinkTarget($this, 'overview')
882 );
883 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
884 $ilTabs->addTab(
885 'import',
886 $this->lng->txt('ecs_tab_import'),
887 $this->ctrl->getLinkTarget($this, 'importMappings')
888 );
889 }
890 $ilTabs->addTab(
891 'export',
892 $this->lng->txt('ecs_tab_export'),
893 $this->ctrl->getLinkTarget($this, 'exportMappings')
894 );
895
896
897 switch ($a_active) {
899 $ilTabs->activateTab('import');
900 break;
901
903 $ilTabs->activateTab('export');
904 break;
905 }
906 return true;
907 }

References $DIC, MAPPING_EXPORT, and MAPPING_IMPORT.

Referenced by exportMappings(), and importMappings().

+ Here is the caller graph for this function:

◆ setSubTabs()

ilECSSettingsGUI::setSubTabs ( )
protected

set sub tabs

@access protected

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

1848 {
1849 global $DIC;
1850
1851 $ilAccess = $DIC['ilAccess'];
1852 $this->tabs_gui->clearSubTabs();
1853
1854 $this->tabs_gui->addSubTabTarget(
1855 "overview",
1856 $this->ctrl->getLinkTarget($this, 'overview'),
1857 "overview",
1858 get_class($this)
1859 );
1860
1861 // Disable all other tabs, if server hasn't been configured.
1862 #ilECSServerSettings::getInstance()->readInactiveServers();
1863 if (!ilECSServerSettings::getInstance()->serverExists()) {
1864 return true;
1865 }
1866
1867 $this->tabs_gui->addSubTabTarget(
1868 "ecs_communities",
1869 $this->ctrl->getLinkTarget($this, 'communities'),
1870 "communities",
1871 get_class($this)
1872 );
1873
1874 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
1875 return true;
1876 }
1877
1878 $this->tabs_gui->addSubTabTarget(
1879 'ecs_mappings',
1880 $this->ctrl->getLinkTarget($this, 'importMappings'),
1881 'importMappings',
1882 get_class($this)
1883 );
1884
1885 $this->tabs_gui->addSubTabTarget(
1886 'ecs_category_mapping',
1887 $this->ctrl->getLinkTarget($this, 'categoryMapping')
1888 );
1889
1890 $this->tabs_gui->addSubTabTarget(
1891 'ecs_import',
1892 $this->ctrl->getLinkTarget($this, 'imported')
1893 );
1894
1895 $this->tabs_gui->addSubTabTarget(
1896 'ecs_released',
1897 $this->ctrl->getLinkTarget($this, 'released')
1898 );
1899 }

References $DIC, 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

@access protected

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

341 {
342 $this->initSettingsForm();
343 $this->tabs_gui->setSubTabActive('ecs_settings');
344
345 $this->tpl->setContent($this->form->getHTML());
346 }

References initSettingsForm().

Referenced by activate(), deactivate(), delete(), doDelete(), initCategoryMappingForm(), initSettings(), initSettingsForm(), initTaskScheduler(), 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.

Returns

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

1356 {
1357 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
1358
1359 if (!$rules = ilECSCategoryMapping::getActiveRules()) {
1360 return false;
1361 }
1362 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingTableGUI.php';
1363 $rule_table = new ilECSCategoryMappingTableGUI($this, 'categoryMapping');
1364 $rule_table->parse($rules);
1365 return $rule_table->getHTML();
1366 }
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

@access protected

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

547 {
548 $this->initSettings((int) $_REQUEST['server_id']);
549 $this->loadFromPost();
550
551 if (!$error = $this->settings->validate()) {
552 $this->settings->update();
553 $this->initTaskScheduler();
554 #$this->updateTitle();
555 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
556 } else {
557 ilUtil::sendInfo($this->lng->txt($error));
558 $this->edit();
559 }
560
561 $this->overview();
562 return true;
563 }
edit()
Edit server setting.
overview()
List available servers.

References edit(), initSettings(), initTaskScheduler(), loadFromPost(), overview(), ilUtil\sendInfo(), and settings().

+ Here is the call graph for this function:

◆ updateCategoryMapping()

ilECSSettingsGUI::updateCategoryMapping ( )
protected

update category mapping

Returns

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

1283 {
1284 if (!$_REQUEST['rule_id']) {
1285 ilUtil::sendInfo($this->lng->txt('select_one'));
1286 $this->categoryMapping();
1287 return false;
1288 }
1289 $this->ctrl->saveParameter($this, 'rule_id');
1290 $this->initRule((int) $_REQUEST['rule_id']);
1291 $this->initCategoryMappingForm('edit');
1292 if ($this->form->checkInput()) {
1293 $this->rule->setContainerId($this->form->getInput('import_id'));
1294 $this->rule->setFieldName($this->form->getInput('field'));
1295 $this->rule->setMappingType($this->form->getInput('type'));
1296
1297
1298 switch ($this->form->getInput('type')) {
1300 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1301 break;
1302
1304 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1305 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1306 break;
1307
1309 $this->rule->setByType($this->form->getInput('by_type'));
1310 break;
1311 }
1312
1313 if ($err = $this->rule->validate()) {
1314 ilUtil::sendInfo($this->lng->txt($err));
1315 $this->form->setValuesByPost();
1316 $this->editCategoryMapping();
1317 return false;
1318 }
1319
1320 $this->rule->update();
1321 ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
1322 $this->ctrl->redirect($this, 'categoryMapping');
1323 return true;
1324 }
1325 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1326 $this->form->setValuesByPost();
1327 $this->editCategoryMapping();
1328 return false;
1329 }
editCategoryMapping()
Edit category mapping.

References categoryMapping(), editCategoryMapping(), initCategoryMappingForm(), initRule(), ilUtil\sendInfo(), 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

@access protected

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

792 {
793 global $DIC;
794
795 $ilLog = $DIC['ilLog'];
796
797 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
798 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
799
800 // @TODO: Delete deprecated communities
801 $invalidImportTypes = false;
802 if (!$this->validateImportTypes($_POST['import_type'])) {
803 $invalidImportTypes = true;
804 }
805
807 foreach ($servers->getServers() as $server) {
808 try {
809 // Read communities
810 $cReader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
811
812 // Update community cache
813 foreach ($cReader->getCommunities() as $community) {
814 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
815 $cCache = ilECSCommunityCache::getInstance($server->getServerId(), $community->getId());
816 $cCache->setCommunityName($community->getTitle());
817 $cCache->setMids($community->getMids());
818 $cCache->setOwnId($community->getOwnId());
819 $cCache->update();
820 }
821 } catch (Exception $e) {
822 $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
823 }
824 }
825
826 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
827 foreach ((array) $_POST['sci_mid'] as $sid => $tmp) {
828 foreach ((array) $_POST['sci_mid'][$sid] as $mid => $tmp) {
829 $set = new ilECSParticipantSetting($sid, $mid);
830 #$set->enableExport(array_key_exists($mid, (array) $_POST['export'][$sid]) ? true : false);
831 #$set->enableImport(array_key_exists($mid, (array) $_POST['import'][$sid]) ? true : false);
832 $set->setImportType($_POST['import_type'][$sid][$mid]);
833
834 // update title/cname
835 try {
836 $part = ilECSCommunityReader::getInstanceByServerId($sid)->getParticipantByMID($mid);
837 if ($part instanceof ilECSParticipant) {
838 $set->setTitle($part->getParticipantName());
839 }
840 $com = ilECSCommunityReader::getInstanceByServerId($sid)->getCommunityByMID($mid);
841 if ($com instanceof ilECSCommunity) {
842 $set->setCommunityName($com->getTitle());
843 }
844 } catch (Exception $e) {
845 $this->log->error('Cannot read ecs communities: ' . $e->getMessage());
846 }
847
848 $set->update();
849 }
850 }
851 if ($invalidImportTypes) {
852 ilUtil::sendFailure($this->lng->txt('ecs_invalid_import_type_cms'), true);
853 } else {
854 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
855 }
856 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'communities');
857
858 // TODO: Do update of remote courses and ...
859
860 return true;
861 }
static getInstance($a_sid, $a_cid)
Get instance.
validateImportTypes(&$import_types)
Validate import types.

References $_POST, $DIC, Vendor\Package\$e, $GLOBALS, $ilLog, $server, ilECSCommunityCache\getInstance(), ilECSServerSettings\getInstance(), ilECSCommunityReader\getInstanceByServerId(), ilUtil\sendFailure(), and validateImportTypes().

+ Here is the call graph for this function:

◆ updateTitle()

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

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

592 {
593 try {
594 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
596
597 foreach ($reader->getCommunities() as $community) {
598 foreach ($community->getParticipants() as $part) {
599 $this->log->dump($community);
600 if ($part->isSelf()) {
601 $this->settings->setTitle($part->getParticipantName());
602 $this->settings->update();
603 return true;
604 }
605 }
606 }
607 } catch (ilECSConnectorException $exc) {
608 ilUtil::sendFailure($exc->getMessage());
609 }
610 $this->settings->setTitle('');
611 $this->settings->update();
612 }

References $reader, ilECSCommunityReader\getInstanceByServerId(), ilUtil\sendFailure(), and settings().

+ Here is the call graph for this function:

◆ validateImportTypes()

ilECSSettingsGUI::validateImportTypes ( $import_types)
protected

Validate import types.

Parameters
array$import_types
Returns
bool

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

755 {
756 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
757
758 $num_cms = 0;
759 foreach ((array) $import_types as $sid => $server) {
760 foreach ((array) $server as $mid => $import_type) {
761 if ($import_type == ilECSParticipantSetting::IMPORT_CMS) {
762 ++$num_cms;
763 }
764 }
765 }
766
767 if ($num_cms <= 1) {
768 return true;
769 }
770 // Change to import type "UNCHANGED"
771 $new_types = array();
772 foreach ((array) $import_types as $sid => $server) {
773 foreach ((array) $server as $mid => $import_type) {
774 if ($import_type == ilECSParticipantSetting::IMPORT_CMS) {
775 $new_types[$sid][$mid] = ilECSParticipantSetting::IMPORT_UNCHANGED;
776 } else {
777 $new_types[$sid][$mid] = $import_type;
778 }
779 }
780 }
781 $import_types = $new_types;
782 return false;
783 }

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

Referenced by updateCommunities().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilECSSettingsGUI::$ctrl
protected

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

◆ $lng

ilECSSettingsGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilECSSettingsGUI::$log = null
protected

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

◆ $tabs_gui

ilECSSettingsGUI::$tabs_gui
protected

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

◆ $tpl

ilECSSettingsGUI::$tpl
protected

◆ MAPPING_EXPORT

const ilECSSettingsGUI::MAPPING_EXPORT = 1

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

Referenced by setMappingTabs().

◆ MAPPING_IMPORT

const ilECSSettingsGUI::MAPPING_IMPORT = 2

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

Referenced by setMappingTabs().


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