ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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 <type> $ilDB <type> $ilSetting. More...
 

Protected Attributes

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

public

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

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

53  {
54  global $lng,$tpl,$ilCtrl,$ilTabs;
55 
56  $this->tpl = $tpl;
57  $this->lng = $lng;
58  $this->lng->loadLanguageModule('ecs');
59  $this->ctrl = $ilCtrl;
60  $this->tabs_gui = $ilTabs;
61 
62  $this->initSettings();
63  }
global $ilCtrl
Definition: ilias.php:18
initSettings($a_server_id=1)
Init settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilECSSettingsGUI::activate ( )
protected

activate server

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

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

151  {
152  $this->initSettings($_REQUEST['server_id']);
153  $this->settings->setEnabledStatus(true);
154  $this->settings->update();
155  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
156  $this->ctrl->redirect($this,'overview');
157  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ addCategoryMapping()

ilECSSettingsGUI::addCategoryMapping ( )
protected

save category mapping

Returns

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

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

1257  {
1258  $this->initRule();
1259 
1260  $this->initCategoryMappingForm('add');
1261  if($this->form->checkInput())
1262  {
1263  $this->rule->setContainerId($this->form->getInput('import_id'));
1264  $this->rule->setFieldName($this->form->getInput('field'));
1265  $this->rule->setMappingType($this->form->getInput('type'));
1266 
1267  switch($this->form->getInput('type'))
1268  {
1270  $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1271  break;
1272 
1274  $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1275  $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1276  break;
1277 
1279  $this->rule->setByType($this->form->getInput('by_type'));
1280  break;
1281  }
1282 
1283  if($err = $this->rule->validate())
1284  {
1285  ilUtil::sendInfo($this->lng->txt($err));
1286  $this->form->setValuesByPost();
1287  $this->categoryMapping();
1288  return false;
1289  }
1290 
1291  $this->rule->save();
1292  ilUtil::sendInfo($this->lng->txt('settings_saved'));
1293  unset($this->rule);
1294  $this->categoryMapping();
1295  return true;
1296  }
1297  ilUtil::sendInfo($this->lng->txt('err_check_input'));
1298  $this->form->setValuesByPost();
1299  $this->categoryMapping();
1300  return false;
1301  }
categoryMapping()
Category mappings.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
initRule($a_rule_id=0)
Init rule.
+ Here is the call graph for this function:

◆ buildPath()

ilECSSettingsGUI::buildPath (   $a_ref_id)
private

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

Referenced by initCategoryMappingForm(), and initSettingsForm().

1951  {
1952  $loc = new ilLocatorGUI();
1953  $loc->setTextOnly(false);
1954  $loc->addContextItems($a_ref_id);
1955 
1956  return $loc->getHTML();
1957  }
locator handling class
+ Here is the caller graph for this function:

◆ categoryMapping()

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

Returns

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

References $html, initCategoryMappingForm(), initRule(), and showRulesTable().

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

1237  {
1238  $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1239  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.category_mapping.html','Services/WebServices/ECS');
1240 
1241  $this->initRule();
1242  $this->initCategoryMappingForm();
1243 
1244 
1245  $this->tpl->setVariable('NEW_RULE_TABLE',$this->form->getHTML());
1246  if($html = $this->showRulesTable())
1247  {
1248  $this->tpl->setVariable('RULES_TABLE',$html);
1249  }
1250  }
initCategoryMappingForm($a_mode='add')
Init category mapping form.
initRule($a_rule_id=0)
Init rule.
showRulesTable()
Show rules table.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ communities()

ilECSSettingsGUI::communities ( )

show communities

public

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

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

689  {
690  global $ilAccess;
691  // add toolbar to refresh communities
692  if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
693  {
694  $GLOBALS['ilToolbar']->addButton(
695  $this->lng->txt('ecs_refresh_participants'),
696  $this->ctrl->getLinkTarget($this,'refreshParticipants')
697  );
698  }
699 
700 
701  $this->tabs_gui->setSubTabActive('ecs_communities');
702 
703  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_communities.html','Services/WebServices/ECS');
704 
705  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this,'updateCommunities'));
706 
707  if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
708  {
709  $this->tpl->setCurrentBlock("submit_buttons");
710  $this->tpl->setVariable('TXT_SAVE',$this->lng->txt('save'));
711  $this->tpl->setVariable('TXT_CANCEL', $this->lng->txt('cancel'));
712  $this->tpl->parseCurrentBlock();
713  }
714 
715  include_once('Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
716  include_once('Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
717 
718  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
719  $settings = ilECSServerSettings::getInstance();
720  #$settings->readInactiveServers();
721 
722  foreach($settings->getServers() as $server)
723  {
724  // Try to read communities
725  try
726  {
728  foreach($reader->getCommunities() as $community)
729  {
730  $this->tpl->setCurrentBlock('table_community');
731  $table_gui = new ilECSCommunityTableGUI($server,$this,'communities',$community->getId());
732  $table_gui->setTitle($community->getTitle().' ('.$community->getDescription().')');
733  $table_gui->parse($community->getParticipants());
734  $this->tpl->setVariable('TABLE_COMM',$table_gui->getHTML());
735  $this->tpl->parseCurrentBlock();
736  }
737  }
738  catch(ilECSConnectorException $exc)
739  {
740  // Maybe server is not fully configured
741  continue;
742  }
743 
744  // Show section for each server
745  $this->tpl->setCurrentBlock('server');
746  $this->tpl->setVariable('TXT_SERVER_NAME',$server->getTitle());
747  $this->tpl->parseCurrentBlock();
748  }
749  }
static getInstance()
Get singleton instance.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static getInstanceByServerId($a_server_id)
Get instance by server id.
$server
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the call graph for this function:

◆ cp()

ilECSSettingsGUI::cp ( )
protected

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

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

253  {
254  $this->initSettings((int) $_REQUEST['server_id']);
255 
256  $copy = clone $this->settings;
257  $copy->save();
258 
259  $this->ctrl->setParameter($this,'server_id',$copy->getServerId());
260  ilUtil::sendSuccess($this->lng->txt('ecs_settings_cloned'),true);
261  $this->ctrl->redirect($this,'edit');
262  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ create()

ilECSSettingsGUI::create ( )
protected

Create new settings ilTabs $ilTabs.

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

References initSettings(), and initSettingsForm().

Referenced by save().

217  {
218  global $ilTabs;
219 
220  $this->initSettings(0);
221 
222  $ilTabs->clearTargets();
223  $ilTabs->clearSubTabs();
224  $ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
225 
226  $this->initSettingsForm('create');
227  $this->tabs_gui->setSubTabActive('ecs_settings');
228 
229  $this->tpl->setContent($this->form->getHTML());
230  }
initSettingsForm($a_mode='update')
init settings form
initSettings($a_server_id=1)
Init settings.
+ 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 162 of file class.ilECSSettingsGUI.php.

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

163  {
164  $this->initSettings($_REQUEST['server_id']);
165  $this->settings->setEnabledStatus(false);
166  $this->settings->update();
167  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
168  $this->ctrl->redirect($this,'overview');
169  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ delete()

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

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

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

268  {
269  global $ilTabs;
270 
271  $this->initSettings((int) $_REQUEST['server_id']);
272 
273  $ilTabs->clearTargets();
274  $ilTabs->clearSubTabs();
275  $ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
276 
277  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
278  $confirm = new ilConfirmationGUI();
279  $confirm->setFormAction($this->ctrl->getFormAction($this));
280  $confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
281  $confirm->setCancel($this->lng->txt('cancel'), 'overview');
282  $confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
283 
284  $confirm->addItem('','',$this->settings->getServer());
285  $confirm->addHiddenItem('server_id', $this->settings->getServerId());
286 
287  $this->tpl->setContent($confirm->getHTML());
288  }
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteCategoryMappings()

ilECSSettingsGUI::deleteCategoryMappings ( )
protected

Delete selected category mappings.

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

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

1387  {
1388  if(!is_array($_POST['rules']) or !$_POST['rules'])
1389  {
1390  ilUtil::sendInfo($this->lng->txt('no_checkbox'));
1391  $this->categoryMapping();
1392  return false;
1393  }
1394  foreach($_POST['rules'] as $rule_id)
1395  {
1396  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1397  $rule = new ilECSCategoryMappingRule($rule_id);
1398  $rule->delete();
1399  }
1400  ilUtil::sendInfo($this->lng->txt('settings_saved'));
1401  $this->categoryMapping();
1402  return true;
1403  }
categoryMapping()
Category mappings.
$_POST['username']
Definition: cron.php:12
Defines a rule for the assignment of ECS remote courses to categories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ doDelete()

ilECSSettingsGUI::doDelete ( )
protected

Do delete.

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

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

294  {
295  $this->initSettings($_REQUEST['server_id']);
296  $this->settings->delete();
297 
298  // Delete communities
299  include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
300  ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']);
301 
302  include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
303  ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']);
304 
305  include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
307 
308  include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
309  ilECSExport::deleteByServer((int) $_REQUEST['server_id']);
310 
311  include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
312  ilECSImport::deleteByServer((int) $_REQUEST['server_id']);
313 
314  include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
316 
317  ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'),true);
318  $this->ctrl->redirect($this,'overview');
319  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static deleteServer($a_server_id)
Delete by server id ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server id ilDB $ilDB.
static delete($a_server_id)
Delete comunities by server id.
static deleteByServer($a_server_id)
Delete by server id ilDB $ilDB.
static delete($a_server_id)
Delete server ilDB $ilDB.
static deleteByServer($a_server_id)
Delete by server $ilDB.
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ edit()

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

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

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

Referenced by update().

236  {
237  global $ilTabs;
238 
239  $this->initSettings((int) $_REQUEST['server_id']);
240  $this->ctrl->saveParameter($this,'server_id',(int) $_REQUEST['server_id']);
241 
242  $ilTabs->clearTargets();
243  $ilTabs->clearSubTabs();
244  $ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
245 
246  $this->initSettingsForm();
247  $this->tabs_gui->setSubTabActive('ecs_settings');
248 
249  $this->tpl->setContent($this->form->getHTML());
250  }
initSettingsForm($a_mode='update')
init settings form
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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 1307 of file class.ilECSSettingsGUI.php.

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

Referenced by updateCategoryMapping().

1308  {
1309  if(!$_REQUEST['rule_id'])
1310  {
1311  ilUtil::sendInfo($this->lng->txt('select_one'));
1312  $this->categoryMapping();
1313  return false;
1314  }
1315 
1316  $this->tabs_gui->setSubTabActive('ecs_category_mapping');
1317  $this->ctrl->saveParameter($this,'rule_id');
1318  $this->initRule((int) $_REQUEST['rule_id']);
1319 
1320  $this->initCategoryMappingForm('edit');
1321  $this->tpl->setContent($this->form->getHTML());
1322  return true;
1323  }
categoryMapping()
Category mappings.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
initRule($a_rule_id=0)
Init rule.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilECSSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $_REQUEST, $cmd, and setSubTabs().

73  {
74  global $ilAccess;
75  $next_class = $this->ctrl->getNextClass($this);
76  $cmd = $this->ctrl->getCmd();
77 
78  $this->setSubTabs();
79  switch($next_class)
80  {
81  case 'ilecsmappingsettingsgui':
82  include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingSettingsGUI.php';
83  $mapset = new ilECSMappingSettingsGUI($this, (int) $_REQUEST['server_id'], (int) $_REQUEST['mid']);
84  $this->ctrl->setReturn($this,'communities');
85  $this->ctrl->forwardCommand($mapset);
86  break;
87 
88  case 'ilecsparticipantsettingsgui':
89  include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettingsGUI.php';
90  $part = new ilECSParticipantSettingsGUI(
91  (int) $_REQUEST['server_id'],
92  (int) $_REQUEST['mid']
93  );
94  $this->ctrl->setReturn($this,'communities');
95  $this->ctrl->forwardCommand($part);
96  break;
97 
98  default:
99 
100  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]) && $cmd != "overview" && $cmd != "communities")
101  {
102  $this->ctrl->redirect($this, "overview");
103  }
104 
105  if(!$cmd || $cmd == 'view')
106  {
107  $cmd = "overview";
108  }
109  $this->$cmd();
110  break;
111  }
112  return true;
113  }
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ exportImported()

ilECSSettingsGUI::exportImported ( )
protected

csv export of imported remote courses

protected

Returns

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

References $ilUser, $reader, ilECSDataMappingSettings\_getInstance(), ilECSCommunityReader\_getInstance(), ilUtil\_getObjectsByOperations(), ilObject\_lookupDescription(), ilObjRemoteCourse\_lookupMID(), ilObject\_lookupTitle(), ilUtil\deliverData(), ilFormat\formatUnixTime(), ilECSUtils\getAdvancedMDValuesForObjId(), and ilECSDataMappingSetting\MAPPING_IMPORT_RCRS.

1613  {
1614  global $ilObjDataCache,$ilUser;
1615 
1616  // :TODO: mind resource type and move to ilRemoteObjectBase...
1617 
1618  $rcourses = ilUtil::_getObjectsByOperations('rcrs','visible',$ilUser->getId(),-1);
1619 
1620  // Read participants
1621  include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
1622  include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
1623  try
1624  {
1626  }
1627  catch(ilECSConnectorException $e)
1628  {
1629  $reader = null;
1630  }
1631 
1632  // read obj_ids
1633  $ilObjDataCache->preloadReferenceCache($rcourses);
1634  $obj_ids = array();
1635  foreach($rcourses as $rcrs_ref_id)
1636  {
1637  $obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
1638  $obj_ids[$obj_id] = $obj_id;
1639  }
1640 
1641  include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1642  $writer = new ilCSVWriter();
1643 
1644  $writer->addColumn($this->lng->txt('title'));
1645  $writer->addColumn($this->lng->txt('description'));
1646  $writer->addColumn($this->lng->txt('ecs_imported_from'));
1647  $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1648  $writer->addColumn($this->lng->txt('ecs_field_term'));
1649  $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1650  $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1651  $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1652  $writer->addColumn($this->lng->txt('ecs_field_credits'));
1653  $writer->addColumn($this->lng->txt('ecs_field_room'));
1654  $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1655  $writer->addColumn($this->lng->txt('ecs_field_begin'));
1656  $writer->addColumn($this->lng->txt('ecs_field_end'));
1657  $writer->addColumn($this->lng->txt('last_update'));
1658 
1659  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1661 
1662  foreach($obj_ids as $obj_id)
1663  {
1664  include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1665  $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1666 
1667  $writer->addRow();
1668  $writer->addColumn(ilObject::_lookupTitle($obj_id));
1669  $writer->addColumn(ilObject::_lookupDescription($obj_id));
1670 
1671  $mid = ilObjRemoteCourse::_lookupMID($obj_id);
1672  if($reader and ($participant = $reader->getParticipantByMID($mid)))
1673  {
1674  $writer->addColumn($participant->getParticipantName());
1675  }
1676  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseID');
1677  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1678 
1679  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'term');
1680  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1681 
1682  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'lecturer');
1683  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1684 
1685  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseType');
1686  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1687 
1688  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'semester_hours');
1689  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1690 
1691  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'credits');
1692  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1693 
1694  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'room');
1695  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1696 
1697  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'cycle');
1698  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1699 
1700  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'begin');
1701  $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
1702 
1703  $field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'end');
1704  $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
1705 
1706  $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1707  }
1708  ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_import.csv", "text/csv");
1709  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
Helper class to generate CSV files.
static _getInstance()
get singleton instance
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
static _lookupTitle($a_id)
lookup object title
static _lookupMID($a_obj_id)
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
static _lookupDescription($a_id)
lookup object description
formatUnixTime($ut, $with_time=false)
global $ilUser
Definition: imgupload.php:15
static _getInstance()
Get Singleton instance.
+ Here is the call graph for this function:

◆ exportMappings()

ilECSSettingsGUI::exportMappings ( )
protected

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

protected

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

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

1001  {
1002  global $ilToolbar;
1003 
1004  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1005 
1006  $this->setMappingTabs(self::MAPPING_EXPORT);
1007 
1009  if(!count($fields))
1010  {
1011  ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
1012  return true;
1013  }
1014 
1015  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1016  $settings = ilECSServerSettings::getInstance();
1017  $settings->readInactiveServers();
1018 
1019  $sel_srv = (int)$_REQUEST["ecs_mapping_server"];
1020  if(!$sel_srv)
1021  {
1022  $sel_srv = $_SESSION["ecs_sel_srv"];
1023  }
1024  else
1025  {
1026  $_SESSION["ecs_sel_srv"] = $sel_srv;
1027  }
1028 
1029  // Iterate all servers
1030  $options = array(0 => $this->lng->txt("please_choose"));
1031  foreach($settings->getServers() as $server)
1032  {
1033  $title = $server->getTitle();
1034  if(!$title)
1035  {
1036  $title = "ECS (".$server->getServerId().")";
1037  }
1038  $options[$server->getServerId()] = $title;
1039  }
1040 
1041  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1042  $sel = new ilSelectInputGUI("", "ecs_mapping_server");
1043  $sel->setOptions($options);
1044  $sel->setValue($sel_srv);
1045  $ilToolbar->addInputItem($sel);
1046 
1047  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "exportMappings"));
1048  $ilToolbar->addFormButton($this->lng->txt("submit"), "exportMappings");
1049 
1050  if($sel_srv)
1051  {
1052  $form = $this->initMappingsForm($sel_srv,self::MAPPING_EXPORT);
1053  $this->tpl->setContent($form->getHTML());
1054  }
1055 
1056  return true;
1057  }
setMappingTabs($a_active)
Handle tabs for ECS data mapping.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
initMappingsForm($a_server_id, $mapping_type)
init mapping form
static getInstancesByObjType($a_obj_type, $a_active_only=true)
$server
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ exportReleased()

ilECSSettingsGUI::exportReleased ( )
protected

export released

protected

Returns

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

References ilECSDataMappingSettings\_getInstance(), ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilUtil\deliverData(), ilFormat\formatUnixTime(), ilECSUtils\getAdvancedMDValuesForObjId(), and ilECSExport\getExportedIds().

1779  {
1780  global $ilObjDataCache;
1781 
1782  include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1783  $exported = ilECSExport::getExportedIds();
1784  $ilObjDataCache->preloadObjectCache($exported);
1785 
1786  include_once('Services/Utilities/classes/class.ilCSVWriter.php');
1787  $writer = new ilCSVWriter();
1788 
1789  $writer->addColumn($this->lng->txt('title'));
1790  $writer->addColumn($this->lng->txt('description'));
1791  $writer->addColumn($this->lng->txt('ecs_field_courseID'));
1792  $writer->addColumn($this->lng->txt('ecs_field_term'));
1793  $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
1794  $writer->addColumn($this->lng->txt('ecs_field_courseType'));
1795  $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
1796  $writer->addColumn($this->lng->txt('ecs_field_credits'));
1797  $writer->addColumn($this->lng->txt('ecs_field_room'));
1798  $writer->addColumn($this->lng->txt('ecs_field_cycle'));
1799  $writer->addColumn($this->lng->txt('ecs_field_begin'));
1800  $writer->addColumn($this->lng->txt('ecs_field_end'));
1801  $writer->addColumn($this->lng->txt('last_update'));
1802 
1803  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1805 
1806  foreach($exported as $obj_id)
1807  {
1808  include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1809  $values = ilECSUtils::getAdvancedMDValuesForObjId($obj_id);
1810 
1811  $writer->addRow();
1812  $writer->addColumn(ilObject::_lookupTitle($obj_id));
1813  $writer->addColumn(ilObject::_lookupDescription($obj_id));
1814 
1815  $field = $settings->getMappingByECSName(0, 'courseID');
1816  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1817 
1818  $field = $settings->getMappingByECSName(0,'term');
1819  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1820 
1821  $field = $settings->getMappingByECSName(0,'lecturer');
1822  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1823 
1824  $field = $settings->getMappingByECSName(0,'courseType');
1825  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1826 
1827  $field = $settings->getMappingByECSName(0,'semester_hours');
1828  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1829 
1830  $field = $settings->getMappingByECSName(0,'credits');
1831  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1832 
1833  $field = $settings->getMappingByECSName(0,'room');
1834  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1835 
1836  $field = $settings->getMappingByECSName(0,'cycle');
1837  $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
1838 
1839  $field = $settings->getMappingByECSName(0,'begin');
1840  $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
1841 
1842  $field = $settings->getMappingByECSName(0,'end');
1843  $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
1844 
1845  $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
1846  }
1847 
1848  ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_export.csv", "text/csv");
1849  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
Helper class to generate CSV files.
static _lookupTitle($a_id)
lookup object title
static getExportedIds()
Get exported ids ilDB $ilDB.
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
static _lookupDescription($a_id)
lookup object description
formatUnixTime($ut, $with_time=false)
static _getInstance()
Get Singleton instance.
+ Here is the call graph for this function:

◆ imported()

ilECSSettingsGUI::imported ( )
protected

Show imported materials.

protected

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

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

Referenced by readAll().

1551  {
1552  global $ilUser, $ilToolbar;
1553 
1554  $this->tabs_gui->setSubTabActive('ecs_import');
1555 
1556  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
1557  if(ilECSServerSettings::getInstance()->activeServerExists())
1558  {
1559  $ilToolbar->addButton(
1560  $this->lng->txt('ecs_read_remote_links'),
1561  $this->ctrl->getLinkTarget($this,'readAll')
1562  );
1563 
1564  $ilToolbar->addSeparator();
1565  }
1566 
1567 
1568  $sel_type = $_REQUEST["otype"];
1569  if(!$sel_type)
1570  {
1571  $sel_type = "rcrs";
1572  }
1573 
1574  include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
1576 
1577  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1578  $sel = new ilSelectInputGUI("", "otype");
1579  $sel->setOptions($options);
1580  $sel->setValue($sel_type);
1581  $ilToolbar->addInputItem($sel);
1582 
1583  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "imported"));
1584  $ilToolbar->addFormButton($this->lng->txt("submit"), "imported");
1585 
1586  $robjs = ilUtil::_getObjectsByOperations($sel_type,'visible',$ilUser->getId(),-1);
1587  if(count($robjs))
1588  {
1589  $ilToolbar->addSeparator();
1590 
1591  $ilToolbar->addButton(
1592  $this->lng->txt('csv_export'),
1593  $this->ctrl->getLinkTarget($this,'exportImported')
1594  );
1595  }
1596 
1597  include_once('Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
1598  $table_gui = new ilECSImportedContentTableGUI($this,'imported');
1599  $table_gui->setTitle($this->lng->txt('ecs_imported_content'));
1600  $table_gui->parse($robjs);
1601  $this->tpl->setContent($table_gui->getHTML());
1602 
1603  return true;
1604  }
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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.

protected

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

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

937  {
938  global $ilToolbar;
939 
940  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
941 
942  $this->setMappingTabs(self::MAPPING_IMPORT);
943 
945  if(!count($fields))
946  {
947  ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
948  return true;
949  }
950 
951  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
952  $settings = ilECSServerSettings::getInstance();
953  $settings->readInactiveServers();
954 
955  $sel_srv = (int)$_REQUEST["ecs_mapping_server"];
956  if(!$sel_srv)
957  {
958  $sel_srv = $_SESSION["ecs_sel_srv"];
959  }
960  else
961  {
962  $_SESSION["ecs_sel_srv"] = $sel_srv;
963  }
964 
965  // Iterate all servers
966  $options = array(0 => $this->lng->txt("please_choose"));
967  foreach($settings->getServers() as $server)
968  {
969  $title = $server->getTitle();
970  if(!$title)
971  {
972  $title = "ECS (".$server->getServerId().")";
973  }
974  $options[$server->getServerId()] = $title;
975  }
976 
977  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
978  $sel = new ilSelectInputGUI("", "ecs_mapping_server");
979  $sel->setOptions($options);
980  $sel->setValue($sel_srv);
981  $ilToolbar->addInputItem($sel);
982 
983  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "importMappings"));
984  $ilToolbar->addFormButton($this->lng->txt("submit"), "importMappings");
985 
986  if($sel_srv)
987  {
988  $form = $this->initMappingsForm($sel_srv, self::MAPPING_IMPORT);
989  $this->tpl->setContent($form->getHTML());
990  }
991 
992  return true;
993  }
setMappingTabs($a_active)
Handle tabs for ECS data mapping.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
static getInstance()
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
initMappingsForm($a_server_id, $mapping_type)
init mapping form
static getInstancesByObjType($a_obj_type, $a_active_only=true)
$server
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ initCategoryMappingForm()

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

Init category mapping form.

Returns

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

References $ilDB, $options, $tpl, buildPath(), ilECSCategoryMapping\getPossibleFields(), ilECSUtils\getPossibleRemoteTypes(), ilDateTimeInputGUI\setDate(), ilRadioOption\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), settings(), ilTextInputGUI\setValue(), ilSelectInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilECSCategoryMappingRule\TYPE_BY_TYPE, ilECSCategoryMappingRule\TYPE_DURATION, and ilECSCategoryMappingRule\TYPE_FIXED.

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

1444  {
1445  global $ilDB;
1446 
1447  if(is_object($this->form))
1448  {
1449  return true;
1450  }
1451 
1452  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1453  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1454 
1455  $this->form = new ilPropertyFormGUI();
1456 
1457  if($a_mode == 'add')
1458  {
1459  $this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
1460  $this->form->setFormAction($this->ctrl->getFormAction($this,'categoryMapping'));
1461  $this->form->addCommandButton('addCategoryMapping',$this->lng->txt('save'));
1462  $this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
1463  }
1464  else
1465  {
1466  $this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
1467  $this->form->setFormAction($this->ctrl->getFormAction($this,'editCategoryMapping'));
1468  $this->form->addCommandButton('updateCategoryMapping',$this->lng->txt('save'));
1469  $this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
1470  }
1471 
1472  $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'),'import_id');
1473  $imp->setRequired(true);
1474 
1475  $tpl = new ilTemplate('tpl.ecs_import_id_form.html',true,true,'Services/WebServices/ECS');
1476  $tpl->setVariable('SIZE',5);
1477  $tpl->setVariable('MAXLENGTH',11);
1478  $tpl->setVariable('POST_VAR','import_id');
1479  $tpl->setVariable('PROPERTY_VALUE',$this->rule->getContainerId());
1480 
1481  if($this->settings->getImportId())
1482  {
1483  $tpl->setVariable('COMPLETE_PATH',$this->buildPath($this->rule->getContainerId()));
1484  }
1485 
1486  $imp->setHTML($tpl->get());
1487  $imp->setInfo($this->lng->txt('ecs_import_id_info'));
1488  $this->form->addItem($imp);
1489 
1490  include_once('./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php');
1491  $select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'),'field');
1492  $select->setValue($this->rule->getFieldName());
1493  $select->setRequired(true);
1494  $select->setOptions(ilECSCategoryMapping::getPossibleFields());
1495  $this->form->addItem($select);
1496 
1497  // Value
1498  $value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'),'type');
1499  $value->setValue($this->rule->getMappingType());
1500  $value->setRequired(true);
1501 
1502  $fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'),ilECSCategoryMappingRule::TYPE_FIXED);
1503  $fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
1504 
1505  $fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'),'mapping_value');
1506  $fixed_val->setValue($this->rule->getMappingValue());
1507  $fixed_val->setMaxLength(255);
1508  $fixed_val->setSize(40);
1509  $fixed_val->setRequired(true);
1510  $fixed->addSubItem($fixed_val);
1511 
1512  $value->addOption($fixed);
1513 
1514  $duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'),ilECSCategoryMappingRule::TYPE_DURATION);
1515  $duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
1516 
1517  $dur_start = new ilDateTimeInputGUI($this->lng->txt('from'),'dur_begin');
1518  $dur_start->setDate($this->rule->getDateRangeStart());
1519  $duration->addSubItem($dur_start);
1520 
1521  $dur_end = new ilDateTimeInputGUI($this->lng->txt('to'),'dur_end');
1522  $dur_end->setDate($this->rule->getDateRangeEnd());
1523  $duration->addSubItem($dur_end);
1524 
1525  $value->addOption($duration);
1526 
1527  $type = new ilRadioOption($this->lng->txt('ecs_cat_mapping_by_type'),ilECSCategoryMappingRule::TYPE_BY_TYPE);
1528  $type->setInfo($this->lng->txt('ecs_cat_mapping_by_type_info'));
1529 
1531 
1532  $types = new ilSelectInputGUI($this->lng->txt('type'), 'by_type');
1533  $types->setOptions($options);
1534  $types->setValue($this->rule->getByType());
1535  $types->setRequired(true);
1536  $type->addSubitem($types);
1537 
1538  $value->addOption($type);
1539 
1540  $this->form->addItem($value);
1541 
1542  }
This class represents an option in a radio group.
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
This class represents a selection list property in a property form.
This class represents a property form user interface.
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
setInfo($a_info)
Set Info.
This class represents a date/time property in a property form.
This class represents a property in a property form.
if(!is_array($argv)) $options
setValue($a_value)
Set Value.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setOptions($a_options)
Set Options.
This class represents a custom property in a property form.
global $ilDB
setValue($a_value)
Set Value.
setRequired($a_required)
Set Required.
+ 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

protected

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

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

Referenced by exportMappings(), and importMappings().

1126  {
1127  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1128 
1129  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
1130  $mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
1131 
1132  $form = new ilPropertyFormGUI();
1133 
1134  if($mapping_type == self::MAPPING_IMPORT)
1135  {
1136  $form->setTitle($this->lng->txt('ecs_mapping_tbl'));
1137  $form->addCommandButton('saveImportMappings',$this->lng->txt('save'));
1138  $form->addCommandButton('importMappings',$this->lng->txt('cancel'));
1139  }
1140  else
1141  {
1142  $form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
1143  $form->addCommandButton('saveExportMappings',$this->lng->txt('save'));
1144  $form->addCommandButton('exportMappings',$this->lng->txt('cancel'));
1145  }
1146 
1147  $form->setFormAction($this->ctrl->getFormAction($this,'saveMappings'));
1148 
1149  if($mapping_type == self::MAPPING_IMPORT)
1150  {
1151  $assignments = new ilCustomInputGUI($this->lng->txt('ecs_mapping_crs'));
1152  $form->addItem($assignments);
1153  }
1154 
1155  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1157  $options = $this->prepareFieldSelection($fields);
1158 
1159  // get all optional ecourse fields
1160  include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1162  foreach($optional as $field_name)
1163  {
1164  if($mapping_type == self::MAPPING_IMPORT)
1165  {
1166  $select = new ilSelectInputGUI(
1167  $this->lng->txt('ecs_field_'.$field_name),
1168  'mapping'.'['.ilECSDataMappingSetting::MAPPING_IMPORT_CRS.']['.$field_name.']'
1169  );
1170 
1171  $select->setValue(
1172  $mapping_settings->getMappingByECSName(
1174  $field_name)
1175  );
1176  $select->setOptions($options);
1177  $assignments->addSubItem($select);
1178  }
1179  else
1180  {
1181  $select = new ilSelectInputGUI(
1182  $this->lng->txt('ecs_field_'.$field_name),
1183  'mapping'.'['.ilECSDataMappingSetting::MAPPING_EXPORT.']['.$field_name.']'
1184  );
1185  $select->setValue(
1186  $mapping_settings->getMappingByECSName(
1188  $field_name)
1189  );
1190  $select->setOptions($options);
1191  $form->addItem($select);
1192  }
1193  }
1194 
1195  $server = new ilHiddenInputGUI('ecs_mapping_server');
1196  $server->setValue($a_server_id);
1197  $form->addItem($server);
1198 
1199  // Remote courses
1200  // no remote course settings for export
1201  if($mapping_type == self::MAPPING_EXPORT)
1202  {
1203  return $form;
1204  }
1205 
1206  $rcrs = new ilCustomInputGUI($this->lng->txt('ecs_mapping_rcrs'));
1207  $form->addItem($rcrs);
1208 
1209  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1211  $options = $this->prepareFieldSelection($fields);
1212 
1213  // get all optional econtent fields
1214  include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
1216  foreach($optional as $field_name)
1217  {
1218  $select = new ilSelectInputGUI(
1219  $this->lng->txt('ecs_field_'.$field_name),
1220  'mapping['.ilECSDataMappingSetting::MAPPING_IMPORT_RCRS.']['.$field_name.']');
1221  $select->setValue(
1222  $mapping_settings->getMappingByECSName(
1224  $field_name)
1225  );
1226  $select->setOptions($options);
1227  $rcrs->addSubItem($select);
1228  }
1229  return $form;
1230  }
static getInstanceByServerId($a_server_id)
Get singleton instance.
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a hidden form property in a property form.
if(!is_array($argv)) $options
setValue($a_value)
Set Value.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _getOptionalEContentFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...
$server
This class represents a custom property in a property form.
prepareFieldSelection($fields)
get options for field selection
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRule()

ilECSSettingsGUI::initRule (   $a_rule_id = 0)
protected

Init rule.

Parameters
int$rule_idrule id
Returns

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

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

1429  {
1430  if(is_object($this->rule))
1431  {
1432  return $this->rule;
1433  }
1434 
1435  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
1436  $this->rule = new ilECSCategoryMappingRule($a_rule_id);
1437  }
Defines a rule for the assignment of ECS remote courses to categories.
+ Here is the caller graph for this function:

◆ initSettings()

ilECSSettingsGUI::initSettings (   $a_server_id = 1)
protected

Init settings.

protected

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

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

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

1878  {
1879  include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
1880  $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
1881  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

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

init settings form

protected

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

References $pass, $tpl, ilECSSetting\AUTH_APACHE, ilECSSetting\AUTH_CERTIFICATE, buildPath(), prepareRoleSelect(), ilECSSetting\PROTOCOL_HTTPS, ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilDurationInputGUI\setShowDays(), ilTextInputGUI\setSize(), settings(), ilTextInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), and ilNonEditableValueGUI\setValue().

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

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

◆ initTaskScheduler()

ilECSSettingsGUI::initTaskScheduler ( )
protected

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

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

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

Referenced by save(), and update().

1965  {
1966  global $ilDB,$ilSetting;
1967 
1968  #$ilDB->lockTables(array('name' => 'settings', 'type' => ilDB::LOCK_WRITE));
1969  $setting = new ilSetting('ecs');
1970  $setting->set(
1971  'next_execution_'.$this->settings->getServerId(),
1972  time() + (int) $this->settings->getPollingTime()
1973  );
1974  }
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:40
global $ilDB
+ 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 616 of file class.ilECSSettingsGUI.php.

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

Referenced by save(), and update().

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

◆ overview()

ilECSSettingsGUI::overview ( )

List available servers.

Returns
void ilToolbar ilTabsGUI

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

References $_REQUEST, and ilECSServerSettings\getInstance().

Referenced by update().

122  {
123  global $ilToolbar,$ilTabs, $ilAccess;
124 
125  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
126 
127  $ilTabs->setSubTabActive('overview');
128  if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
129  {
130  $ilToolbar->addButton(
131  $this->lng->txt('ecs_add_new_ecs'),
132  $this->ctrl->getLinkTarget($this,'create')
133  );
134  }
135 
137  $servers->readInactiveServers();
138 
139  include_once './Services/WebServices/ECS/classes/class.ilECSServerTableGUI.php';
140  $table = new ilECSServerTableGUI($this,'overview');
141  $table->initTable();
142  $table->parse($servers);
143  $this->tpl->setContent($table->getHTML());
144  return;
145  }
static getInstance()
Get singleton instance.
Description of ilECSServerTableGUI.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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 protected

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

References $options, and ilAdvancedMDRecord\_lookupTitle().

Referenced by initMappingsForm().

1858  {
1859  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
1860 
1861  $options[0] = $this->lng->txt('ecs_ignore_field');
1862  foreach($fields as $field)
1863  {
1864  $title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
1865  $options[$field->getFieldId()] = $title.': '.$field->getTitle();
1866  }
1867  return $options;
1868  }
if(!is_array($argv)) $options
static _lookupTitle($a_record_id)
Lookup title.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelect()

ilECSSettingsGUI::prepareRoleSelect ( )
private

get global role array

protected

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

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

Referenced by initSettingsForm().

1934  {
1935  global $rbacreview,$ilObjDataCache;
1936 
1937  $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
1938  'object_data',
1939  'title',
1940  'obj_id');
1941 
1942  $select[0] = $this->lng->txt('links_select_one');
1943  foreach($global_roles as $role_id)
1944  {
1945  $select[$role_id] = ilObject::_lookupTitle($role_id);
1946  }
1947  return $select;
1948  }
static _lookupTitle($a_id)
lookup object title
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAll()

ilECSSettingsGUI::readAll ( )
protected

Read all importable econtent.

protected

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

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

177  {
178  include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
179  include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
180  include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
181  include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
182 
183  try
184  {
185  foreach(ilECSServerSettings::getInstance()->getServers() as $server)
186  {
189 
190  include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
191  ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
192 
193  ilUtil::sendInfo($this->lng->txt('ecs_remote_imported'));
194  $this->imported();
195  return true;
196  }
197  }
198  catch(ilECSConnectorException $e1)
199  {
200  ilUtil::sendInfo('Cannot connect to ECS server: '.$e1->getMessage());
201  $this->imported();
202  return false;
203  }
204  catch(ilException $e2)
205  {
206  ilUtil::sendInfo('Update failed: '.$e1->getMessage());
207  $this->imported();
208  return false;
209  }
210  }
Base class for ILIAS Exception handling.
static handleImportReset(ilECSSetting $server)
Reread all imported econtent.
static getInstance()
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
$server
imported()
Show imported materials.
static handleExportReset(ilECSSetting $server)
Handle export reset.
+ Here is the call graph for this function:

◆ refreshParticipants()

ilECSSettingsGUI::refreshParticipants ( )
protected

Refresh participants.

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

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

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 
658  // read community
659  try {
660 
661  $creader = ilECSCommunityReader::getInstanceByServerId($server->getServerId());
662  foreach(ilECSParticipantSettings::getAvailabeMids($server->getServerId()) as $mid)
663  {
664  if(!$creader->getParticipantByMID($mid))
665  {
666  $GLOBALS['ilLog']->write(__METHOD__.': Deleting deprecated participant '. $server->getServerId().' '. $mid);
667 
668  $part = new ilECSParticipantSetting($server->getServerId(),$mid);
669  $part->delete();
670  }
671  }
672  }
673  catch(ilECSConnectorException $e)
674  {
675  ilUtil::sendFailure($server->getServer().': '. $e->getMessage(),TRUE);
676  }
677  }
678  ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
679  $this->ctrl->redirect($this,'communities');
680  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getInstance()
Get singleton instance.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$server
static getAvailabeMids($a_server_id)
Get all available mids $ilDB.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
delete()
Delete one participant entry <type> $ilDB.
+ Here is the call graph for this function:

◆ released()

ilECSSettingsGUI::released ( )
protected

Show released materials.

protected

Returns

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

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

1718  {
1719  global $ilUser, $ilToolbar;
1720 
1721  $this->tabs_gui->setSubTabActive('ecs_released');
1722 
1723  if($this->settings->isEnabled())
1724  {
1725  $ilToolbar->addButton(
1726  $this->lng->txt('ecs_read_remote_links'),
1727  $this->ctrl->getLinkTarget($this,'readAll')
1728  );
1729 
1730  $ilToolbar->addSeparator();
1731  }
1732 
1733  $sel_type = $_REQUEST["otype"];
1734  if(!$sel_type)
1735  {
1736  $sel_type = "rcrs";
1737  }
1738 
1739  include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
1741 
1742  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1743  $sel = new ilSelectInputGUI("", "otype");
1744  $sel->setOptions($options);
1745  $sel->setValue($sel_type);
1746  $ilToolbar->addInputItem($sel);
1747 
1748  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "released"));
1749  $ilToolbar->addFormButton($this->lng->txt("submit"), "released");
1750 
1751  include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
1752  $exported = ilECSExport::getExportedIdsByType($sel_type);
1753  if(count($exported))
1754  {
1755  $ilToolbar->addSeparator();
1756 
1757  $ilToolbar->addButton(
1758  $this->lng->txt('csv_export'),
1759  $this->ctrl->getLinkTarget($this,'exportReleased')
1760  );
1761  }
1762 
1763  include_once('Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
1764  $table_gui = new ilECSReleasedContentTableGUI($this,'released');
1765  $table_gui->setTitle($this->lng->txt('ecs_released_content'));
1766  $table_gui->parse($exported);
1767  $this->tpl->setContent($table_gui->getHTML());
1768 
1769  return true;
1770  }
static getPossibleReleaseTypes($a_with_captions=false)
Get all possible release object types.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options
static getExportedIdsByType($a_type)
Get exported ids by type ilDB $ilDB.
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ save()

ilECSSettingsGUI::save ( )
protected

Save settings.

Returns
<type>

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

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

560  {
561  $this->initSettings(0);
562  $this->loadFromPost();
563 
564  if(!$error = $this->settings->validate())
565  {
566  $this->settings->save();
567  $this->initTaskScheduler();
568 
569  #$this->updateTitle();
570  ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
571  }
572  else
573  {
574  ilUtil::sendInfo($this->lng->txt($error));
575  return $this->create();
576  }
577  $GLOBALS['ilCtrl']->redirect($this,'overview');
578  return true;
579  }
loadFromPost()
Load from post.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initTaskScheduler()
Init next task execution <type> $ilDB <type> $ilSetting.
initSettings($a_server_id=1)
Init settings.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
create()
Create new settings ilTabs $ilTabs.
+ Here is the call graph for this function:

◆ saveExportMappings()

ilECSSettingsGUI::saveExportMappings ( )
protected

Save mappings.

protected

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

References $_POST, and ilUtil\sendInfo().

1095  {
1096  foreach((array) $_POST['mapping'] as $mtype => $mappings)
1097  {
1098  foreach((array) $mappings as $ecs_field => $advmd_id)
1099  {
1100  include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1101  $map = new ilECSDataMappingSetting(
1102  (int) $_POST['ecs_mapping_server'],
1103  (int) $mtype,
1104  $ecs_field
1105  );
1106  $map->setAdvMDId($advmd_id);
1107  $map->save();
1108  }
1109  }
1110 
1111  ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1112  $this->ctrl->setParameter($this, "ecs_mapping_server", (int)$_POST['ecs_mapping_server']);
1113  $this->ctrl->redirect($this,'exportMappings');
1114  return true;
1115  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ saveImportMappings()

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

protected

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

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

1066  {
1067  foreach((array) $_POST['mapping'] as $mtype => $mappings)
1068  {
1069  foreach((array) $mappings as $ecs_field => $advmd_id)
1070  {
1071  include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
1072  $map = new ilECSDataMappingSetting(
1073  (int) $_REQUEST['ecs_mapping_server'],
1074  (int) $mtype,
1075  $ecs_field
1076  );
1077  $map->setAdvMDId($advmd_id);
1078  $map->save();
1079  }
1080  }
1081 
1082  ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1083  $this->ctrl->setParameter($this, "ecs_mapping_server", (int)$_POST['ecs_mapping_server']);
1084  $this->ctrl->redirect($this,'importMappings');
1085  return true;
1086  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ setMappingTabs()

ilECSSettingsGUI::setMappingTabs (   $a_active)
protected

Handle tabs for ECS data mapping.

Parameters
int$a_activeilTabsGUI ilTabs

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

References $_REQUEST.

Referenced by exportMappings(), and importMappings().

893  {
894  global $ilTabs, $ilAccess;
895 
896  $ilTabs->clearTargets();
897  $ilTabs->clearSubTabs();
898 
899  $ilTabs->setBackTarget(
900  $this->lng->txt('ecs_settings'),
901  $this->ctrl->getLinkTarget($this,'overview')
902  );
903  if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
904  {
905  $ilTabs->addTab(
906  'import',
907  $this->lng->txt('ecs_tab_import'),
908  $this->ctrl->getLinkTarget($this,'importMappings')
909  );
910  }
911  $ilTabs->addTab(
912  'export',
913  $this->lng->txt('ecs_tab_export'),
914  $this->ctrl->getLinkTarget($this,'exportMappings')
915  );
916 
917 
918  switch($a_active)
919  {
920  case self::MAPPING_IMPORT:
921  $ilTabs->activateTab('import');
922  break;
923 
924  case self::MAPPING_EXPORT:
925  $ilTabs->activateTab('export');
926  break;
927  }
928  return true;
929  }
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the caller graph for this function:

◆ setSubTabs()

ilECSSettingsGUI::setSubTabs ( )
protected

set sub tabs

protected

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

References $_REQUEST, and ilECSServerSettings\getInstance().

Referenced by executeCommand().

1889  {
1890  global $ilAccess;
1891  $this->tabs_gui->clearSubTabs();
1892 
1893  $this->tabs_gui->addSubTabTarget("overview",
1894  $this->ctrl->getLinkTarget($this,'overview'),
1895  "overview",get_class($this));
1896 
1897  // Disable all other tabs, if server hasn't been configured.
1898  #ilECSServerSettings::getInstance()->readInactiveServers();
1899  if(!ilECSServerSettings::getInstance()->serverExists())
1900  {
1901  return true;
1902  }
1903 
1904  $this->tabs_gui->addSubTabTarget("ecs_communities",
1905  $this->ctrl->getLinkTarget($this,'communities'),
1906  "communities",get_class($this));
1907 
1908  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
1909  {
1910  return true;
1911  }
1912 
1913  $this->tabs_gui->addSubTabTarget('ecs_mappings',
1914  $this->ctrl->getLinkTarget($this,'importMappings'),
1915  'importMappings',get_class($this));
1916 
1917  $this->tabs_gui->addSubTabTarget('ecs_category_mapping',
1918  $this->ctrl->getLinkTarget($this,'categoryMapping'));
1919 
1920  $this->tabs_gui->addSubTabTarget('ecs_import',
1921  $this->ctrl->getLinkTarget($this,'imported'));
1922 
1923  $this->tabs_gui->addSubTabTarget('ecs_released',
1924  $this->ctrl->getLinkTarget($this,'released'));
1925 
1926  }
static getInstance()
Get singleton instance.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilECSSettingsGUI::settings ( )
protected

show settings

protected

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

References initSettingsForm().

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

328  {
329  $this->initSettingsForm();
330  $this->tabs_gui->setSubTabActive('ecs_settings');
331 
332  $this->tpl->setContent($this->form->getHTML());
333  }
initSettingsForm($a_mode='update')
init settings form
+ 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 1409 of file class.ilECSSettingsGUI.php.

References ilECSCategoryMapping\getActiveRules().

Referenced by categoryMapping().

1410  {
1411  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
1412 
1413  if(!$rules = ilECSCategoryMapping::getActiveRules())
1414  {
1415  return false;
1416  }
1417  include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingTableGUI.php';
1418  $rule_table = new ilECSCategoryMappingTableGUI($this,'categoryMapping');
1419  $rule_table->parse($rules);
1420  return $rule_table->getHTML();
1421  }
static getActiveRules()
get active rules
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilECSSettingsGUI::update ( )
protected

save settings

protected

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

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

534  {
535  $this->initSettings((int) $_REQUEST['server_id']);
536  $this->loadFromPost();
537 
538  if(!$error = $this->settings->validate())
539  {
540  $this->settings->update();
541  $this->initTaskScheduler();
542  #$this->updateTitle();
543  ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
544  }
545  else
546  {
547  ilUtil::sendInfo($this->lng->txt($error));
548  $this->edit();
549  }
550 
551  $this->overview();
552  return true;
553  }
edit()
Edit server setting.
loadFromPost()
Load from post.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initTaskScheduler()
Init next task execution <type> $ilDB <type> $ilSetting.
overview()
List available servers.
initSettings($a_server_id=1)
Init settings.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ updateCategoryMapping()

ilECSSettingsGUI::updateCategoryMapping ( )
protected

update category mapping

Returns

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

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

1330  {
1331  if(!$_REQUEST['rule_id'])
1332  {
1333  ilUtil::sendInfo($this->lng->txt('select_one'));
1334  $this->categoryMapping();
1335  return false;
1336  }
1337  $this->ctrl->saveParameter($this,'rule_id');
1338  $this->initRule((int) $_REQUEST['rule_id']);
1339  $this->initCategoryMappingForm('edit');
1340  if($this->form->checkInput())
1341  {
1342  $this->rule->setContainerId($this->form->getInput('import_id'));
1343  $this->rule->setFieldName($this->form->getInput('field'));
1344  $this->rule->setMappingType($this->form->getInput('type'));
1345 
1346 
1347  switch($this->form->getInput('type'))
1348  {
1350  $this->rule->setMappingValue($this->form->getInput('mapping_value'));
1351  break;
1352 
1354  $this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
1355  $this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
1356  break;
1357 
1359  $this->rule->setByType($this->form->getInput('by_type'));
1360  break;
1361  }
1362 
1363  if($err = $this->rule->validate())
1364  {
1365  ilUtil::sendInfo($this->lng->txt($err));
1366  $this->form->setValuesByPost();
1367  $this->editCategoryMapping();
1368  return false;
1369  }
1370 
1371  $this->rule->update();
1372  ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
1373  $this->ctrl->redirect($this,'categoryMapping');
1374  return true;
1375  }
1376  ilUtil::sendInfo($this->lng->txt('err_check_input'));
1377  $this->form->setValuesByPost();
1378  $this->editCategoryMapping();
1379  return false;
1380 
1381  }
editCategoryMapping()
Edit category mapping.
categoryMapping()
Category mappings.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
initRule($a_rule_id=0)
Init rule.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ updateCommunities()

ilECSSettingsGUI::updateCommunities ( )
protected

update whitelist

protected

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

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

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

◆ updateTitle()

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

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

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

585  {
586  try
587  {
588  include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
590 
591  foreach($reader->getCommunities() as $community)
592  {
593  foreach($community->getParticipants() as $part)
594  {
595  $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($community,true));
596  if($part->isSelf())
597  {
598  $this->settings->setTitle($part->getParticipantName());
599  $this->settings->update();
600  return true;
601  }
602  }
603  }
604  }
605  catch(ilECSConnectorException $exc)
606  {
607  ilUtil::sendFailure($exc->getMessage());
608  }
609  $this->settings->setTitle('');
610  $this->settings->update();
611  }
static getInstanceByServerId($a_server_id)
Get instance by server id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ 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 756 of file class.ilECSSettingsGUI.php.

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

Referenced by updateCommunities().

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

Field Documentation

◆ $ctrl

ilECSSettingsGUI::$ctrl
protected

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

◆ $lng

ilECSSettingsGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs_gui

ilECSSettingsGUI::$tabs_gui
protected

Definition at line 44 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.

◆ MAPPING_IMPORT

const ilECSSettingsGUI::MAPPING_IMPORT = 2

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


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