ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $lng,$tpl,$ilCtrl,$ilTabs;
59
60 $this->tpl = $tpl;
61 $this->lng = $lng;
62 $this->lng->loadLanguageModule('ecs');
63 $this->ctrl = $ilCtrl;
64 $this->tabs_gui = $ilTabs;
65
66 $this->log = $GLOBALS['DIC']->logger()->wsrv();
67
68 $this->initSettings();
69 }
initSettings($a_server_id=1)
Init settings.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18

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

157 {
158 $this->initSettings($_REQUEST['server_id']);
159 $this->settings->setEnabledStatus(true);
160 $this->settings->update();
161 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
162 $this->ctrl->redirect($this,'overview');
163 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References initSettings(), ilUtil\sendSuccess(), and settings().

+ Here is the call graph for this function:

◆ addCategoryMapping()

ilECSSettingsGUI::addCategoryMapping ( )
protected

save category mapping

Returns

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

1262 {
1263 $this->initRule();
1264
1265 $this->initCategoryMappingForm('add');
1266 if($this->form->checkInput())
1267 {
1268 $this->rule->setContainerId($this->form->getInput('import_id'));
1269 $this->rule->setFieldName($this->form->getInput('field'));
1270 $this->rule->setMappingType($this->form->getInput('type'));
1271
1272 switch($this->form->getInput('type'))
1273 {
1275 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1276 break;
1277
1279 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1280 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1281 break;
1282
1284 $this->rule->setByType($this->form->getInput('by_type'));
1285 break;
1286 }
1287
1288 if($err = $this->rule->validate())
1289 {
1290 ilUtil::sendInfo($this->lng->txt($err));
1291 $this->form->setValuesByPost();
1292 $this->categoryMapping();
1293 return false;
1294 }
1295
1296 $this->rule->save();
1297 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1298 unset($this->rule);
1299 $this->categoryMapping();
1300 return true;
1301 }
1302 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1303 $this->form->setValuesByPost();
1304 $this->categoryMapping();
1305 return false;
1306 }
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

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

1982 {
1983 $loc = new ilLocatorGUI();
1984 $loc->setTextOnly(false);
1985 $loc->addContextItems($a_ref_id);
1986
1987 return $loc->getHTML();
1988 }
locator handling class

Referenced by initCategoryMappingForm(), and initSettingsForm().

+ Here is the caller graph for this function:

◆ categoryMapping()

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

Returns

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

1242 {
1243 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1244 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.category_mapping.html','Services/WebServices/ECS');
1245
1246 $this->initRule();
1247 $this->initCategoryMappingForm();
1248
1249
1250 $this->tpl->setVariable('NEW_RULE_TABLE',$this->form->getHTML());
1251 if($html = $this->showRulesTable())
1252 {
1253 $this->tpl->setVariable('RULES_TABLE',$html);
1254 }
1255 }
showRulesTable()
Show rules table.
$html
Definition: example_001.php:87

References $html, 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 693 of file class.ilECSSettingsGUI.php.

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

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

+ Here is the call graph for this function:

◆ cp()

ilECSSettingsGUI::cp ( )
protected

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

259 {
260 $this->initSettings((int) $_REQUEST['server_id']);
261
262 $copy = clone $this->settings;
263 $copy->save();
264
265 $this->ctrl->setParameter($this,'server_id',$copy->getServerId());
266 ilUtil::sendSuccess($this->lng->txt('ecs_settings_cloned'),true);
267 $this->ctrl->redirect($this,'edit');
268 }

References initSettings(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ create()

ilECSSettingsGUI::create ( )
protected

Create new settings @global ilTabs $ilTabs.

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

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

References 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 168 of file class.ilECSSettingsGUI.php.

169 {
170 $this->initSettings($_REQUEST['server_id']);
171 $this->settings->setEnabledStatus(false);
172 $this->settings->update();
173 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
174 $this->ctrl->redirect($this,'overview');
175 }

References initSettings(), ilUtil\sendSuccess(), and settings().

+ Here is the call graph for this function:

◆ delete()

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

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

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

References initSettings(), and settings().

+ Here is the call graph for this function:

◆ deleteCategoryMappings()

ilECSSettingsGUI::deleteCategoryMappings ( )
protected

Delete selected category mappings.

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

1392 {
1393 if(!is_array($_POST['rules']) or !$_POST['rules'])
1394 {
1395 ilUtil::sendInfo($this->lng->txt('no_checkbox'));
1396 $this->categoryMapping();
1397 return false;
1398 }
1399 foreach($_POST['rules'] as $rule_id)
1400 {
1401 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1402 $rule = new ilECSCategoryMappingRule($rule_id);
1403 $rule->delete();
1404 }
1405 ilUtil::sendInfo($this->lng->txt('settings_saved'));
1406 $this->categoryMapping();
1407 return true;
1408 }
$_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 299 of file class.ilECSSettingsGUI.php.

300 {
301 $this->initSettings($_REQUEST['server_id']);
302 $this->settings->delete();
303
304 // Delete communities
305 include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
306 ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']);
307
308 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
309 ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']);
310
311 include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
312 ilECSEventQueueReader::deleteServer((int) $_REQUEST['server_id']);
313
314 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
315 ilECSExport::deleteByServer((int) $_REQUEST['server_id']);
316
317 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
318 ilECSImport::deleteByServer((int) $_REQUEST['server_id']);
319
320 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
321 ilECSParticipantSettings::deleteByServer((int) $_REQUEST['server_id']);
322
323 ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'),true);
324 $this->ctrl->redirect($this,'overview');
325 }
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(), ilUtil\sendSuccess(), and settings().

+ Here is the call graph for this function:

◆ edit()

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

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

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

References 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 1312 of file class.ilECSSettingsGUI.php.

1313 {
1314 if(!$_REQUEST['rule_id'])
1315 {
1316 ilUtil::sendInfo($this->lng->txt('select_one'));
1317 $this->categoryMapping();
1318 return false;
1319 }
1320
1321 $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1322 $this->ctrl->saveParameter($this,'rule_id');
1323 $this->initRule((int) $_REQUEST['rule_id']);
1324
1325 $this->initCategoryMappingForm('edit');
1326 $this->tpl->setContent($this->form->getHTML());
1327 return true;
1328 }

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

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

References $cmd, 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 1619 of file class.ilECSSettingsGUI.php.

1620 {
1621 global $ilObjDataCache,$ilUser;
1622
1623 // :TODO: mind resource type and move to ilRemoteObjectBase...
1624
1625 $rcourses = ilUtil::_getObjectsByOperations('rcrs','visible',$ilUser->getId(),-1);
1626
1627 // Read participants
1628 include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
1629 include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
1630 try
1631 {
1633 }
1634 catch(ilECSConnectorException $e)
1635 {
1636 $reader = null;
1637 }
1638
1639 // read obj_ids
1640 $ilObjDataCache->preloadReferenceCache($rcourses);
1641 $obj_ids = array();
1642 foreach($rcourses as $rcrs_ref_id)
1643 {
1644 $obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
1645 $obj_ids[$obj_id] = $obj_id;
1646 }
1647
1648 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1649 $writer = new ilCSVWriter();
1650
1651 $writer->addColumn($this->lng->txt('title'));
1652 $writer->addColumn($this->lng->txt('description'));
1653 $writer->addColumn($this->lng->txt('ecs_imported_from'));
1654 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1655 $writer->addColumn($this->lng->txt('ecs_field_term'));
1656 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1657 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1658 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1659 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1660 $writer->addColumn($this->lng->txt('ecs_field_room'));
1661 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1662 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1663 $writer->addColumn($this->lng->txt('ecs_field_end'));
1664 $writer->addColumn($this->lng->txt('last_update'));
1665
1666 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1668
1669 foreach($obj_ids as $obj_id)
1670 {
1671 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1672 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1673
1674 $writer->addRow();
1675 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1676 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1677
1678 $mid = ilObjRemoteCourse::_lookupMID($obj_id);
1679 if($reader and ($participant = $reader->getParticipantByMID($mid)))
1680 {
1681 $writer->addColumn($participant->getParticipantName());
1682 }
1683 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseID');
1684 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1685
1686 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'term');
1687 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1688
1689 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'lecturer');
1690 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1691
1692 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseType');
1693 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1694
1695 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'semester_hours');
1696 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1697
1698 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'credits');
1699 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1700
1701 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'room');
1702 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1703
1704 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'cycle');
1705 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1706
1707 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'begin');
1708 $dt = '';
1709 if(isset($values[$field]))
1710 {
1711 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1712 $dt = $dt->get(IL_CAL_DATETIME);
1713 }
1714 $writer->addColumn($dt);
1715
1716 $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'end');
1717 $dt = '';
1718 if(isset($values[$field]))
1719 {
1720 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1721 $dt = $dt->get(IL_CAL_DATETIME);
1722 }
1723 $writer->addColumn($dt);
1724
1725 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1726 }
1727 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_import.csv", "text/csv");
1728 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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 $ilUser, $reader, ilECSCommunityReader\_getInstance(), ilECSDataMappingSettings\_getInstance(), ilUtil\_getObjectsByOperations(), ilObject\_lookupDescription(), ilRemoteObjectBase\_lookupMID(), ilObject\_lookupTitle(), date, 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 1005 of file class.ilECSSettingsGUI.php.

1006 {
1007 global $ilToolbar;
1008
1009 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1010
1011 $this->setMappingTabs(self::MAPPING_EXPORT);
1012
1014 if(!count($fields))
1015 {
1016 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
1017 return true;
1018 }
1019
1020 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1022 $settings->readInactiveServers();
1023
1024 $sel_srv = (int)$_REQUEST["ecs_mapping_server"];
1025 if(!$sel_srv)
1026 {
1027 $sel_srv = $_SESSION["ecs_sel_srv"];
1028 }
1029 else
1030 {
1031 $_SESSION["ecs_sel_srv"] = $sel_srv;
1032 }
1033
1034 // Iterate all servers
1035 $options = array(0 => $this->lng->txt("please_choose"));
1036 foreach($settings->getServers() as $server)
1037 {
1038 $title = $server->getTitle();
1039 if(!$title)
1040 {
1041 $title = "ECS (".$server->getServerId().")";
1042 }
1043 $options[$server->getServerId()] = $title;
1044 }
1045
1046 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1047 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
1048 $sel->setOptions($options);
1049 $sel->setValue($sel_srv);
1050 $ilToolbar->addInputItem($sel);
1051
1052 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "exportMappings"));
1053 $ilToolbar->addFormButton($this->lng->txt("submit"), "exportMappings");
1054
1055 if($sel_srv)
1056 {
1057 $form = $this->initMappingsForm($sel_srv,self::MAPPING_EXPORT);
1058 $this->tpl->setContent($form->getHTML());
1059 }
1060
1061 return true;
1062 }
$_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.
if(!is_array($argv)) $options

References $_SESSION, $options, $server, $title, 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 1797 of file class.ilECSSettingsGUI.php.

1798 {
1799 global $ilObjDataCache;
1800
1801 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1802 $exported = ilECSExport::getExportedIds();
1803 $ilObjDataCache->preloadObjectCache($exported);
1804
1805 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1806 $writer = new ilCSVWriter();
1807
1808 $writer->addColumn($this->lng->txt('title'));
1809 $writer->addColumn($this->lng->txt('description'));
1810 $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1811 $writer->addColumn($this->lng->txt('ecs_field_term'));
1812 $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1813 $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1814 $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1815 $writer->addColumn($this->lng->txt('ecs_field_credits'));
1816 $writer->addColumn($this->lng->txt('ecs_field_room'));
1817 $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1818 $writer->addColumn($this->lng->txt('ecs_field_begin'));
1819 $writer->addColumn($this->lng->txt('ecs_field_end'));
1820 $writer->addColumn($this->lng->txt('last_update'));
1821
1822 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1824
1825 foreach($exported as $obj_id)
1826 {
1827 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1828 $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1829
1830 $writer->addRow();
1831 $writer->addColumn(ilObject::_lookupTitle($obj_id));
1832 $writer->addColumn(ilObject::_lookupDescription($obj_id));
1833
1834 $field = $settings->getMappingByECSName(0, 'courseID');
1835 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1836
1837 $field = $settings->getMappingByECSName(0,'term');
1838 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1839
1840 $field = $settings->getMappingByECSName(0,'lecturer');
1841 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1842
1843 $field = $settings->getMappingByECSName(0,'courseType');
1844 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1845
1846 $field = $settings->getMappingByECSName(0,'semester_hours');
1847 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1848
1849 $field = $settings->getMappingByECSName(0,'credits');
1850 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1851
1852 $field = $settings->getMappingByECSName(0,'room');
1853 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1854
1855 $field = $settings->getMappingByECSName(0,'cycle');
1856 $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1857
1858 $field = $settings->getMappingByECSName(0,'begin');
1859 $dt = '';
1860 if(isset($values[$field]))
1861 {
1862 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1863 $dt = $dt->get(IL_CAL_DATETIME);
1864 }
1865 $writer->addColumn($dt);
1866
1867 $field = $settings->getMappingByECSName(0,'end');
1868 $dt = '';
1869 if(isset($values[$field]))
1870 {
1871 $dt = new ilDateTime($values[$field], IL_CAL_UNIX);
1872 $dt = $dt->get(IL_CAL_DATETIME);
1873 }
1874 $writer->addColumn($dt);
1875
1876 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1877 }
1878
1879 ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_export.csv", "text/csv");
1880 }
static getExportedIds()
Get exported ids @global ilDB $ilDB.

References ilECSDataMappingSettings\_getInstance(), ilObject\_lookupDescription(), ilObject\_lookupTitle(), date, 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 1557 of file class.ilECSSettingsGUI.php.

1558 {
1559 global $ilUser, $ilToolbar;
1560
1561 $this->tabs_gui->setSubTabActive('ecs_import');
1562
1563 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1564 if(ilECSServerSettings::getInstance()->activeServerExists())
1565 {
1566 $ilToolbar->addButton(
1567 $this->lng->txt('ecs_read_remote_links'),
1568 $this->ctrl->getLinkTarget($this,'readAll')
1569 );
1570
1571 $ilToolbar->addSeparator();
1572 }
1573
1574
1575 $sel_type = $_REQUEST["otype"];
1576 if(!$sel_type)
1577 {
1578 $sel_type = "rcrs";
1579 }
1580
1581 include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
1583
1584 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1585 $sel = new ilSelectInputGUI("", "otype");
1586 $sel->setOptions($options);
1587 $sel->setValue($sel_type);
1588 $ilToolbar->addInputItem($sel);
1589
1590 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "imported"));
1591 $ilToolbar->addFormButton($this->lng->txt("submit"), "imported");
1592
1593 $robjs = ilUtil::_getObjectsByOperations($sel_type,'visible',$ilUser->getId(),-1);
1594 if(count($robjs))
1595 {
1596 $ilToolbar->addSeparator();
1597
1598 $ilToolbar->addButton(
1599 $this->lng->txt('csv_export'),
1600 $this->ctrl->getLinkTarget($this,'exportImported')
1601 );
1602 }
1603
1604 include_once('Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
1605 $table_gui = new ilECSImportedContentTableGUI($this,'imported');
1606 $table_gui->setTitle($this->lng->txt('ecs_imported_content'));
1607 $table_gui->parse($robjs);
1608 $this->tpl->setContent($table_gui->getHTML());
1609
1610 return true;
1611 }
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.

References $ilUser, $options, 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 941 of file class.ilECSSettingsGUI.php.

942 {
943 global $ilToolbar;
944
945 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
946
947 $this->setMappingTabs(self::MAPPING_IMPORT);
948
950 if(!count($fields))
951 {
952 ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
953 return true;
954 }
955
956 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
958 $settings->readInactiveServers();
959
960 $sel_srv = (int)$_REQUEST["ecs_mapping_server"];
961 if(!$sel_srv)
962 {
963 $sel_srv = $_SESSION["ecs_sel_srv"];
964 }
965 else
966 {
967 $_SESSION["ecs_sel_srv"] = $sel_srv;
968 }
969
970 // Iterate all servers
971 $options = array(0 => $this->lng->txt("please_choose"));
972 foreach($settings->getServers() as $server)
973 {
974 $title = $server->getTitle();
975 if(!$title)
976 {
977 $title = "ECS (".$server->getServerId().")";
978 }
979 $options[$server->getServerId()] = $title;
980 }
981
982 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
983 $sel = new ilSelectInputGUI("", "ecs_mapping_server");
984 $sel->setOptions($options);
985 $sel->setValue($sel_srv);
986 $ilToolbar->addInputItem($sel);
987
988 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "importMappings"));
989 $ilToolbar->addFormButton($this->lng->txt("submit"), "importMappings");
990
991 if($sel_srv)
992 {
993 $form = $this->initMappingsForm($sel_srv, self::MAPPING_IMPORT);
994 $this->tpl->setContent($form->getHTML());
995 }
996
997 return true;
998 }

References $_SESSION, $options, $server, $title, 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 1448 of file class.ilECSSettingsGUI.php.

1449 {
1450 global $ilDB;
1451
1452 if(is_object($this->form))
1453 {
1454 return true;
1455 }
1456
1457 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1458 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1459
1460 $this->form = new ilPropertyFormGUI();
1461
1462 if($a_mode == 'add')
1463 {
1464 $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
1465 $this->form->setFormAction($this->ctrl->getFormAction($this,'categoryMapping'));
1466 $this->form->addCommandButton('addCategoryMapping',$this->lng->txt('save'));
1467 $this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
1468 }
1469 else
1470 {
1471 $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
1472 $this->form->setFormAction($this->ctrl->getFormAction($this,'editCategoryMapping'));
1473 $this->form->addCommandButton('updateCategoryMapping',$this->lng->txt('save'));
1474 $this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
1475 }
1476
1477 $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'),'import_id');
1478 $imp->setRequired(true);
1479
1480 $tpl = new ilTemplate('tpl.ecs_import_id_form.html',true,true,'Services/WebServices/ECS');
1481 $tpl->setVariable('SIZE',5);
1482 $tpl->setVariable('MAXLENGTH',11);
1483 $tpl->setVariable('POST_VAR','import_id');
1484 $tpl->setVariable('PROPERTY_VALUE',$this->rule->getContainerId());
1485
1486 if($this->settings->getImportId())
1487 {
1488 $tpl->setVariable('COMPLETE_PATH',$this->buildPath($this->rule->getContainerId()));
1489 }
1490
1491 $imp->setHTML($tpl->get());
1492 $imp->setInfo($this->lng->txt('ecs_import_id_info'));
1493 $this->form->addItem($imp);
1494
1495 include_once('./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php');
1496 $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'),'field');
1497 $select->setValue($this->rule->getFieldName());
1498 $select->setRequired(true);
1499 $select->setOptions(ilECSCategoryMapping::getPossibleFields());
1500 $this->form->addItem($select);
1501
1502 // Value
1503 $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'),'type');
1504 $value->setValue($this->rule->getMappingType());
1505 $value->setRequired(true);
1506
1507 $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'),ilECSCategoryMappingRule::TYPE_FIXED);
1508 $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
1509
1510 $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'),'mapping_value');
1511 $fixed_val->setValue($this->rule->getMappingValue());
1512 $fixed_val->setMaxLength(255);
1513 $fixed_val->setSize(40);
1514 $fixed_val->setRequired(true);
1515 $fixed->addSubItem($fixed_val);
1516
1517 $value->addOption($fixed);
1518
1519 $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'),ilECSCategoryMappingRule::TYPE_DURATION);
1520 $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
1521
1522 $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'),'dur_begin');
1523 $dur_start->setRequired(true);
1524 $dur_start->setDate($this->rule->getDateRangeStart());
1525 $duration->addSubItem($dur_start);
1526
1527 $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'),'dur_end');
1528 $dur_end->setRequired(true);
1529 $dur_end->setDate($this->rule->getDateRangeEnd());
1530 $duration->addSubItem($dur_end);
1531
1532 $value->addOption($duration);
1533
1534 $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'),ilECSCategoryMappingRule::TYPE_BY_TYPE);
1535 $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
1536
1538
1539 $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
1540 $types->setOptions($options);
1541 $types->setValue($this->rule->getByType());
1542 $types->setRequired(true);
1543 $type->addSubitem($types);
1544
1545 $value->addOption($type);
1546
1547 $this->form->addItem($value);
1548
1549 }
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.
global $ilDB

References $duration, $ilDB, $options, $tpl, 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 1130 of file class.ilECSSettingsGUI.php.

1131 {
1132 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1133
1134 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1135 $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
1136
1137 $form = new ilPropertyFormGUI();
1138
1139 if($mapping_type == self::MAPPING_IMPORT)
1140 {
1141 $form->setTitle($this->lng->txt('ecs_mapping_tbl'));
1142 $form->addCommandButton('saveImportMappings',$this->lng->txt('save'));
1143 $form->addCommandButton('importMappings',$this->lng->txt('cancel'));
1144 }
1145 else
1146 {
1147 $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
1148 $form->addCommandButton('saveExportMappings',$this->lng->txt('save'));
1149 $form->addCommandButton('exportMappings',$this->lng->txt('cancel'));
1150 }
1151
1152 $form->setFormAction($this->ctrl->getFormAction($this,'saveMappings'));
1153
1154 if($mapping_type == self::MAPPING_IMPORT)
1155 {
1156 $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs'));
1157 $form->addItem($assignments);
1158 }
1159
1160 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1162 $options = $this->prepareFieldSelection($fields);
1163
1164 // get all optional ecourse fields
1165 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1167 foreach($optional as $field_name)
1168 {
1169 if($mapping_type == self::MAPPING_IMPORT)
1170 {
1171 $select = new ilSelectInputGUI(
1172 $this->lng->txt('ecs_field_'.$field_name),
1173 'mapping'.'['.ilECSDataMappingSetting::MAPPING_IMPORT_CRS.']['.$field_name.']'
1174 );
1175
1176 $select->setValue(
1177 $mapping_settings->getMappingByECSName(
1179 $field_name)
1180 );
1181 $select->setOptions($options);
1182 $assignments->addSubItem($select);
1183 }
1184 else
1185 {
1186 $select = new ilSelectInputGUI(
1187 $this->lng->txt('ecs_field_'.$field_name),
1188 'mapping'.'['.ilECSDataMappingSetting::MAPPING_EXPORT.']['.$field_name.']'
1189 );
1190 $select->setValue(
1191 $mapping_settings->getMappingByECSName(
1193 $field_name)
1194 );
1195 $select->setOptions($options);
1196 $form->addItem($select);
1197 }
1198 }
1199
1200 $server = new ilHiddenInputGUI('ecs_mapping_server');
1201 $server->setValue($a_server_id);
1202 $form->addItem($server);
1203
1204 // Remote courses
1205 // no remote course settings for export
1206 if($mapping_type == self::MAPPING_EXPORT)
1207 {
1208 return $form;
1209 }
1210
1211 $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs'));
1212 $form->addItem($rcrs);
1213
1214 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1216 $options = $this->prepareFieldSelection($fields);
1217
1218 // get all optional econtent fields
1219 include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1221 foreach($optional as $field_name)
1222 {
1223 $select = new ilSelectInputGUI(
1224 $this->lng->txt('ecs_field_'.$field_name),
1225 'mapping['.ilECSDataMappingSetting::MAPPING_IMPORT_RCRS.']['.$field_name.']');
1226 $select->setValue(
1227 $mapping_settings->getMappingByECSName(
1229 $field_name)
1230 );
1231 $select->setOptions($options);
1232 $rcrs->addSubItem($select);
1233 }
1234 return $form;
1235 }
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 $options, $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 1433 of file class.ilECSSettingsGUI.php.

1434 {
1435 if(is_object($this->rule))
1436 {
1437 return $this->rule;
1438 }
1439
1440 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1441 $this->rule = new ilECSCategoryMappingRule($a_rule_id);
1442 }

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

1909 {
1910 include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
1911 $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1912 }
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 346 of file class.ilECSSettingsGUI.php.

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

1996 {
1997 global $ilDB,$ilSetting;
1998
1999 $setting = new ilSetting('ecs');
2000 $setting->set(
2001 'next_execution_'.$this->settings->getServerId(),
2002 time() + (int) $this->settings->getPollingTime()
2003 );
2004 }
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:17

References $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 622 of file class.ilECSSettingsGUI.php.

623 {
624 $this->settings->setEnabledStatus((int) $_POST['active']);
625 $this->settings->setTitle(ilUtil::stripSlashes($_POST['title']));
626 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
627 $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
628 $this->settings->setProtocol(ilUtil::stripSlashes($_POST['protocol']));
629 $this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
630 $this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
631 $this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
632 $this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
633 $this->settings->setImportId(ilUtil::stripSlashes($_POST['import_id']));
634 $this->settings->setPollingTimeMS((int) $_POST['polling']['mm'],(int) $_POST['polling']['ss']);
635 $this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
636 $this->settings->setGlobalRole((int) $_POST['global_role']);
637 $this->settings->setDuration((int) $_POST['duration']['MM']);
638
639 $this->settings->setUserRecipients(ilUtil::stripSlashes($_POST['user_recipients']));
640 $this->settings->setEContentRecipients(ilUtil::stripSlashes($_POST['econtent_recipients']));
641 $this->settings->setApprovalRecipients(ilUtil::stripSlashes($_POST['approval_recipients']));
642
643 $this->settings->setAuthType((int) $_POST['auth_type']);
644 $this->settings->setAuthPass(ilUtil::stripSlashes($_POST['auth_pass']));
645 $this->settings->setAuthUser(ilUtil::stripSlashes($_POST['auth_user']));
646
647 }
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 127 of file class.ilECSSettingsGUI.php.

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

References 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 1888 of file class.ilECSSettingsGUI.php.

1889 {
1890 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1891
1892 $options[0] = $this->lng->txt('ecs_ignore_field');
1893 foreach($fields as $field)
1894 {
1895 $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
1896 $options[$field->getFieldId()] = $title.': '.$field->getTitle();
1897 }
1898 return $options;
1899 }
static _lookupTitle($a_record_id)
Lookup title.

References $options, $title, and 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 1964 of file class.ilECSSettingsGUI.php.

1965 {
1966 global $rbacreview,$ilObjDataCache;
1967
1968 $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
1969 'object_data',
1970 'title',
1971 'obj_id');
1972
1973 $select[0] = $this->lng->txt('links_select_one');
1974 foreach($global_roles as $role_id)
1975 {
1976 $select[$role_id] = ilObject::_lookupTitle($role_id);
1977 }
1978 return $select;
1979 }
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 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 182 of file class.ilECSSettingsGUI.php.

183 {
184 include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
185 include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
186 include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
187 include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
188
189 try
190 {
191 foreach(ilECSServerSettings::getInstance()->getServers() as $server)
192 {
195
196 include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
197 ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
198
199 ilUtil::sendInfo($this->lng->txt('ecs_remote_imported'));
200 $this->imported();
201 return true;
202 }
203 }
204 catch(ilECSConnectorException $e1)
205 {
206 ilUtil::sendInfo('Cannot connect to ECS server: '.$e1->getMessage());
207 $this->imported();
208 return false;
209 }
210 catch(ilException $e2)
211 {
212 ilUtil::sendInfo('Update failed: '.$e1->getMessage());
213 $this->imported();
214 return false;
215 }
216 }
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 652 of file class.ilECSSettingsGUI.php.

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

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

+ Here is the call graph for this function:

◆ released()

ilECSSettingsGUI::released ( )
protected

Show released materials.

@access protected

Returns

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

1737 {
1738 global $ilUser, $ilToolbar;
1739
1740 $this->tabs_gui->setSubTabActive('ecs_released');
1741
1742 if($this->settings->isEnabled())
1743 {
1744 $ilToolbar->addButton(
1745 $this->lng->txt('ecs_read_remote_links'),
1746 $this->ctrl->getLinkTarget($this,'readAll')
1747 );
1748
1749 $ilToolbar->addSeparator();
1750 }
1751
1752 $sel_type = $_REQUEST["otype"];
1753 if(!$sel_type)
1754 {
1755 $sel_type = "rcrs";
1756 }
1757
1758 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1760
1761 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1762 $sel = new ilSelectInputGUI("", "otype");
1763 $sel->setOptions($options);
1764 $sel->setValue($sel_type);
1765 $ilToolbar->addInputItem($sel);
1766
1767 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "released"));
1768 $ilToolbar->addFormButton($this->lng->txt("submit"), "released");
1769
1770 include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1771 $exported = ilECSExport::getExportedIdsByType($sel_type);
1772 if(count($exported))
1773 {
1774 $ilToolbar->addSeparator();
1775
1776 $ilToolbar->addButton(
1777 $this->lng->txt('csv_export'),
1778 $this->ctrl->getLinkTarget($this,'exportReleased')
1779 );
1780 }
1781
1782 include_once('Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
1783 $table_gui = new ilECSReleasedContentTableGUI($this,'released');
1784 $table_gui->setTitle($this->lng->txt('ecs_released_content'));
1785 $table_gui->parse($exported);
1786 $this->tpl->setContent($table_gui->getHTML());
1787
1788 return true;
1789 }
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 $ilUser, $options, 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 565 of file class.ilECSSettingsGUI.php.

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

References $error, $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 1099 of file class.ilECSSettingsGUI.php.

1100 {
1101 foreach((array) $_POST['mapping'] as $mtype => $mappings)
1102 {
1103 foreach((array) $mappings as $ecs_field => $advmd_id)
1104 {
1105 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1106 $map = new ilECSDataMappingSetting(
1107 (int) $_POST['ecs_mapping_server'],
1108 (int) $mtype,
1109 $ecs_field
1110 );
1111 $map->setAdvMDId($advmd_id);
1112 $map->save();
1113 }
1114 }
1115
1116 ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1117 $this->ctrl->setParameter($this, "ecs_mapping_server", (int)$_POST['ecs_mapping_server']);
1118 $this->ctrl->redirect($this,'exportMappings');
1119 return true;
1120 }

References $_POST, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveImportMappings()

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

@access protected

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

1071 {
1072 foreach((array) $_POST['mapping'] as $mtype => $mappings)
1073 {
1074 foreach((array) $mappings as $ecs_field => $advmd_id)
1075 {
1076 include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1077 $map = new ilECSDataMappingSetting(
1078 (int) $_REQUEST['ecs_mapping_server'],
1079 (int) $mtype,
1080 $ecs_field
1081 );
1082 $map->setAdvMDId($advmd_id);
1083 $map->save();
1084 }
1085 }
1086
1087 ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1088 $this->ctrl->setParameter($this, "ecs_mapping_server", (int)$_POST['ecs_mapping_server']);
1089 $this->ctrl->redirect($this,'importMappings');
1090 return true;
1091 }

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

898 {
899 global $ilTabs, $ilAccess;
900
901 $ilTabs->clearTargets();
902 $ilTabs->clearSubTabs();
903
904 $ilTabs->setBackTarget(
905 $this->lng->txt('ecs_settings'),
906 $this->ctrl->getLinkTarget($this,'overview')
907 );
908 if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
909 {
910 $ilTabs->addTab(
911 'import',
912 $this->lng->txt('ecs_tab_import'),
913 $this->ctrl->getLinkTarget($this,'importMappings')
914 );
915 }
916 $ilTabs->addTab(
917 'export',
918 $this->lng->txt('ecs_tab_export'),
919 $this->ctrl->getLinkTarget($this,'exportMappings')
920 );
921
922
923 switch($a_active)
924 {
926 $ilTabs->activateTab('import');
927 break;
928
930 $ilTabs->activateTab('export');
931 break;
932 }
933 return true;
934 }

References 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 1919 of file class.ilECSSettingsGUI.php.

1920 {
1921 global $ilAccess;
1922 $this->tabs_gui->clearSubTabs();
1923
1924 $this->tabs_gui->addSubTabTarget("overview",
1925 $this->ctrl->getLinkTarget($this,'overview'),
1926 "overview",get_class($this));
1927
1928 // Disable all other tabs, if server hasn't been configured.
1929 #ilECSServerSettings::getInstance()->readInactiveServers();
1930 if(!ilECSServerSettings::getInstance()->serverExists())
1931 {
1932 return true;
1933 }
1934
1935 $this->tabs_gui->addSubTabTarget("ecs_communities",
1936 $this->ctrl->getLinkTarget($this,'communities'),
1937 "communities",get_class($this));
1938
1939 if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
1940 {
1941 return true;
1942 }
1943
1944 $this->tabs_gui->addSubTabTarget('ecs_mappings',
1945 $this->ctrl->getLinkTarget($this,'importMappings'),
1946 'importMappings',get_class($this));
1947
1948 $this->tabs_gui->addSubTabTarget('ecs_category_mapping',
1949 $this->ctrl->getLinkTarget($this,'categoryMapping'));
1950
1951 $this->tabs_gui->addSubTabTarget('ecs_import',
1952 $this->ctrl->getLinkTarget($this,'imported'));
1953
1954 $this->tabs_gui->addSubTabTarget('ecs_released',
1955 $this->ctrl->getLinkTarget($this,'released'));
1956
1957 }

References 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 333 of file class.ilECSSettingsGUI.php.

334 {
335 $this->initSettingsForm();
336 $this->tabs_gui->setSubTabActive('ecs_settings');
337
338 $this->tpl->setContent($this->form->getHTML());
339 }

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

1415 {
1416 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
1417
1419 {
1420 return false;
1421 }
1422 include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingTableGUI.php';
1423 $rule_table = new ilECSCategoryMappingTableGUI($this,'categoryMapping');
1424 $rule_table->parse($rules);
1425 return $rule_table->getHTML();
1426 }
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 539 of file class.ilECSSettingsGUI.php.

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

References $error, 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 1334 of file class.ilECSSettingsGUI.php.

1335 {
1336 if(!$_REQUEST['rule_id'])
1337 {
1338 ilUtil::sendInfo($this->lng->txt('select_one'));
1339 $this->categoryMapping();
1340 return false;
1341 }
1342 $this->ctrl->saveParameter($this,'rule_id');
1343 $this->initRule((int) $_REQUEST['rule_id']);
1344 $this->initCategoryMappingForm('edit');
1345 if($this->form->checkInput())
1346 {
1347 $this->rule->setContainerId($this->form->getInput('import_id'));
1348 $this->rule->setFieldName($this->form->getInput('field'));
1349 $this->rule->setMappingType($this->form->getInput('type'));
1350
1351
1352 switch($this->form->getInput('type'))
1353 {
1355 $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1356 break;
1357
1359 $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1360 $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1361 break;
1362
1364 $this->rule->setByType($this->form->getInput('by_type'));
1365 break;
1366 }
1367
1368 if($err = $this->rule->validate())
1369 {
1370 ilUtil::sendInfo($this->lng->txt($err));
1371 $this->form->setValuesByPost();
1372 $this->editCategoryMapping();
1373 return false;
1374 }
1375
1376 $this->rule->update();
1377 ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1378 $this->ctrl->redirect($this,'categoryMapping');
1379 return true;
1380 }
1381 ilUtil::sendInfo($this->lng->txt('err_check_input'));
1382 $this->form->setValuesByPost();
1383 $this->editCategoryMapping();
1384 return false;
1385
1386 }
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 807 of file class.ilECSSettingsGUI.php.

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

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

+ Here is the call graph for this function:

◆ updateTitle()

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

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

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

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

762 {
763 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
764
765 $num_cms = 0;
766 foreach((array) $import_types as $sid => $server)
767 {
768 foreach((array) $server as $mid => $import_type)
769 {
770 if($import_type == ilECSParticipantSetting::IMPORT_CMS)
771 {
772 ++$num_cms;
773 }
774 }
775 }
776
777 if($num_cms <= 1)
778 {
779 return true;
780 }
781 // Change to import type "UNCHANGED"
782 $new_types = array();
783 foreach((array) $import_types as $sid => $server)
784 {
785 foreach((array) $server as $mid => $import_type)
786 {
787 if($import_type == ilECSParticipantSetting::IMPORT_CMS)
788 {
789 $new_types[$sid][$mid] = ilECSParticipantSetting::IMPORT_UNCHANGED;
790 }
791 else
792 {
793 $new_types[$sid][$mid] = $import_type;
794 }
795 }
796 }
797 $import_types = $new_types;
798 return false;
799 }

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: