ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSSettingsGUI Class Reference
+ Collaboration diagram for ilECSSettingsGUI:

Public Member Functions

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

Data Fields

const MAPPING_EXPORT = 1
const MAPPING_IMPORT = 2

Protected Member Functions

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

Protected Attributes

 $tpl
 $lng
 $ctrl
 $tabs_gui

Private Member Functions

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

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilECSSettingsGUI:

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

Constructor & Destructor Documentation

ilECSSettingsGUI::__construct ( )

Constructor.

public

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

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

{
global $lng,$tpl,$ilCtrl,$ilTabs;
$this->tpl = $tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('ecs');
$this->ctrl = $ilCtrl;
$this->tabs_gui = $ilTabs;
$this->initSettings();
}

+ Here is the call graph for this function:

Member Function Documentation

ilECSSettingsGUI::activate ( )
protected

activate server

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

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

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

+ Here is the call graph for this function:

ilECSSettingsGUI::addCategoryMapping ( )
protected

save category mapping

Returns

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

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

{
$this->initRule();
$this->initCategoryMappingForm('add');
if($this->form->checkInput())
{
$this->rule->setContainerId($this->form->getInput('import_id'));
$this->rule->setMappingType($this->form->getInput('type'));
$this->rule->setMappingValue($this->form->getInput('mapping_value'));
$this->rule->setFieldName($this->form->getInput('field'));
$this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
$this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
if($err = $this->rule->validate())
{
ilUtil::sendInfo($this->lng->txt($err));
$this->form->setValuesByPost();
$this->categoryMapping();
return false;
}
$this->rule->save();
ilUtil::sendInfo($this->lng->txt('settings_saved'));
unset($this->rule);
$this->categoryMapping();
return true;
}
ilUtil::sendInfo($this->lng->txt('err_check_input'));
$this->form->setValuesByPost();
$this->categoryMapping();
return false;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::buildPath (   $a_ref_id)
private

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

Referenced by initCategoryMappingForm(), and initSettingsForm().

{
$loc = new ilLocatorGUI();
$loc->setTextOnly(false);
$loc->addContextItems($a_ref_id);
return $loc->getHTML();
}

+ Here is the caller graph for this function:

ilECSSettingsGUI::categoryMapping ( )
protected

Category mappings.

Returns

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

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

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

{
$this->tabs_gui->setSubTabActive('ecs_category_mapping');
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.category_mapping.html','Services/WebServices/ECS');
$this->initRule();
$this->tpl->setVariable('NEW_RULE_TABLE',$this->form->getHTML());
if($html = $this->showRulesTable())
{
$this->tpl->setVariable('RULES_TABLE',$html);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::communities ( )

show communities

public

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

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

{
$this->tabs_gui->setSubTabActive('ecs_communities');
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_communities.html','Services/WebServices/ECS');
$this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this,'updateCommunities'));
$this->tpl->setVariable('TXT_SAVE',$this->lng->txt('save'));
$this->tpl->setVariable('TXT_CANCEL', $this->lng->txt('cancel'));
include_once('Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
include_once('Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
$settings->readInactiveServers();
foreach($settings->getServers() as $server)
{
// Try to read communities
try
{
foreach($reader->getCommunities() as $community)
{
$this->tpl->setCurrentBlock('table_community');
$table_gui = new ilECSCommunityTableGUI($server,$this,'communities',$community->getId());
$table_gui->setTitle($community->getTitle().' ('.$community->getDescription().')');
$table_gui->parse($community->getParticipants());
$this->tpl->setVariable('TABLE_COMM',$table_gui->getHTML());
$this->tpl->parseCurrentBlock();
}
}
{
// Maybe server is not fully configured
continue;
}
// Show section for each server
$this->tpl->setCurrentBlock('server');
$this->tpl->setVariable('TXT_SERVER_NAME',$server->getTitle());
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

ilECSSettingsGUI::cp ( )
protected

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

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

{
$this->initSettings((int) $_REQUEST['server_id']);
$copy = clone $this->settings;
$copy->save();
$this->ctrl->setParameter($this,'server_id',$copy->getServerId());
ilUtil::sendSuccess($this->lng->txt('ecs_settings_cloned'),true);
$this->ctrl->redirect($this,'edit');
}

+ Here is the call graph for this function:

ilECSSettingsGUI::create ( )
protected

Create new settings ilTabs $ilTabs.

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

References initSettings(), and initSettingsForm().

Referenced by save().

{
global $ilTabs;
$this->initSettings(0);
$ilTabs->clearTargets();
$ilTabs->clearSubTabs();
$ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
$this->initSettingsForm('create');
$this->tabs_gui->setSubTabActive('ecs_settings');
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_settings.html','Services/WebServices/ECS');
$this->tpl->setVariable('SETTINGS_TABLE',$this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::deactivate ( )
protected

activate server

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

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

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

+ Here is the call graph for this function:

ilECSSettingsGUI::delete ( )
protected

Delete confirmation.

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

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

Referenced by doDelete().

{
global $ilTabs;
$this->initSettings((int) $_REQUEST['server_id']);
$ilTabs->clearTargets();
$ilTabs->clearSubTabs();
$ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($this->ctrl->getFormAction($this));
$confirm->setConfirm($this->lng->txt('delete'), 'doDelete');
$confirm->setCancel($this->lng->txt('cancel'), 'overview');
$confirm->setHeaderText($this->lng->txt('ecs_delete_setting'));
$confirm->addItem('','',$this->settings->getServer());
$confirm->addHiddenItem('server_id', $this->settings->getServerId());
$this->tpl->setContent($confirm->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::deleteCategoryMappings ( )
protected

Delete selected category mappings.

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

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

{
if(!is_array($_POST['rules']) or !$_POST['rules'])
{
ilUtil::sendInfo($this->lng->txt('no_checkbox'));
$this->categoryMapping();
return false;
}
foreach($_POST['rules'] as $rule_id)
{
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
$rule = new ilECSCategoryMappingRule($rule_id);
$rule->delete();
}
ilUtil::sendInfo($this->lng->txt('settings_saved'));
$this->categoryMapping();
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::doDelete ( )
protected

Do delete.

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

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

{
$this->initSettings($_REQUEST['server_id']);
$this->settings->delete();
// Delete communities
include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'),true);
$this->ctrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

ilECSSettingsGUI::edit ( )
protected

Edit server setting.

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

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

Referenced by update().

{
global $ilTabs;
$this->initSettings((int) $_REQUEST['server_id']);
$this->ctrl->saveParameter($this,'server_id',(int) $_REQUEST['server_id']);
$ilTabs->clearTargets();
$ilTabs->clearSubTabs();
$ilTabs->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'overview'));
$this->initSettingsForm();
$this->tabs_gui->setSubTabActive('ecs_settings');
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_settings.html','Services/WebServices/ECS');
$this->tpl->setVariable('SETTINGS_TABLE',$this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::editCategoryMapping ( )
protected

Edit category mapping.

Returns

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

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

Referenced by updateCategoryMapping().

{
if(!$_REQUEST['rule_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'));
$this->categoryMapping();
return false;
}
$this->tabs_gui->setSubTabActive('ecs_category_mapping');
$this->ctrl->saveParameter($this,'rule_id');
$this->initRule((int) $_REQUEST['rule_id']);
$this->initCategoryMappingForm('edit');
$this->tpl->setContent($this->form->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

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

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

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->setSubTabs();
switch($next_class)
{
case 'ilecsmappingsettingsgui':
include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingSettingsGUI.php';
$mapset = new ilECSMappingSettingsGUI($this, (int) $_REQUEST['server_id']);
$this->ctrl->setReturn($this,'communities');
$this->ctrl->forwardCommand($mapset);
break;
default:
if(!$cmd)
{
$cmd = "overview";
}
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::exportImported ( )
protected

csv export of imported remote courses

protected

Returns

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

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

{
global $ilObjDataCache,$ilUser;
$rcourses = ilUtil::_getObjectsByOperations('rcrs','visible',$ilUser->getId(),-1);
// Read participants
include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
include_once('./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
try
{
}
{
$reader = null;
}
// read obj_ids
$ilObjDataCache->preloadReferenceCache($rcourses);
$obj_ids = array();
foreach($rcourses as $rcrs_ref_id)
{
$obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
$obj_ids[$obj_id] = $obj_id;
}
include_once('Services/Utilities/classes/class.ilCSVWriter.php');
$writer = new ilCSVWriter();
$writer->addColumn($this->lng->txt('title'));
$writer->addColumn($this->lng->txt('description'));
$writer->addColumn($this->lng->txt('ecs_imported_from'));
$writer->addColumn($this->lng->txt('ecs_field_courseID'));
$writer->addColumn($this->lng->txt('ecs_field_term'));
$writer->addColumn($this->lng->txt('ecs_field_lecturer'));
$writer->addColumn($this->lng->txt('ecs_field_courseType'));
$writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
$writer->addColumn($this->lng->txt('ecs_field_credits'));
$writer->addColumn($this->lng->txt('ecs_field_room'));
$writer->addColumn($this->lng->txt('ecs_field_cycle'));
$writer->addColumn($this->lng->txt('ecs_field_begin'));
$writer->addColumn($this->lng->txt('ecs_field_end'));
$writer->addColumn($this->lng->txt('last_update'));
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
foreach($obj_ids as $obj_id)
{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
$writer->addRow();
$writer->addColumn(ilObject::_lookupTitle($obj_id));
$writer->addColumn(ilObject::_lookupDescription($obj_id));
if($reader and ($participant = $reader->getParticipantByMID($mid)))
{
$writer->addColumn($participant->getParticipantName());
}
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseID');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'term');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'lecturer');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'courseType');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'semester_hours');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'credits');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'room');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'cycle');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'begin');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS,'end');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
$writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
}
ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_import.csv", "text/csv");
}

+ Here is the call graph for this function:

ilECSSettingsGUI::exportMappings ( )
protected

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

protected

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

References $server, ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), ilAccordionGUI\FIRST_OPEN, ilECSServerSettings\getInstance(), initMappingsForm(), MAPPING_EXPORT, ilUtil\sendInfo(), and setMappingTabs().

{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$this->setMappingTabs(self::MAPPING_EXPORT);
if(!count($fields))
{
ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
return true;
}
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
$settings->readInactiveServers();
include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
$acc = new ilAccordionGUI();
// Iterate all servers
foreach($settings->getServers() as $server)
{
$acc->setOrientation(ilAccordionGUI::FIRST_OPEN);
$acc->setId('ecs_mapping_import_'.$server->getServerId());
$form = $this->initMappingsForm($server->getServerId(),self::MAPPING_EXPORT);
$acc->addItem(
$server->getTitle() ? $server->getTitle() : 'ECS',
'<br />'.$form->getHTML().'<br />'
);
}
if($acc instanceof ilAccordionGUI)
{
$this->tpl->setContent($acc->getHTML());
}
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::exportReleased ( )
protected

export released

protected

Returns

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

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

{
global $ilObjDataCache;
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$ilObjDataCache->preloadObjectCache($exported);
include_once('Services/Utilities/classes/class.ilCSVWriter.php');
$writer = new ilCSVWriter();
$writer->addColumn($this->lng->txt('title'));
$writer->addColumn($this->lng->txt('description'));
$writer->addColumn($this->lng->txt('ecs_field_courseID'));
$writer->addColumn($this->lng->txt('ecs_field_term'));
$writer->addColumn($this->lng->txt('ecs_field_lecturer'));
$writer->addColumn($this->lng->txt('ecs_field_courseType'));
$writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
$writer->addColumn($this->lng->txt('ecs_field_credits'));
$writer->addColumn($this->lng->txt('ecs_field_room'));
$writer->addColumn($this->lng->txt('ecs_field_cycle'));
$writer->addColumn($this->lng->txt('ecs_field_begin'));
$writer->addColumn($this->lng->txt('ecs_field_end'));
$writer->addColumn($this->lng->txt('last_update'));
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
foreach($exported as $obj_id)
{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
$writer->addRow();
$writer->addColumn(ilObject::_lookupTitle($obj_id));
$writer->addColumn(ilObject::_lookupDescription($obj_id));
$field = $settings->getMappingByECSName('courseID');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('term');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('lecturer');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('courseType');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('semester_hours');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('credits');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('room');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('cycle');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName('begin');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
$field = $settings->getMappingByECSName('end');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field],true) : '');
$writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
}
ilUtil::deliverData($writer->getCSVString(), date("Y_m_d")."_ecs_export.csv", "text/csv");
}

+ Here is the call graph for this function:

ilECSSettingsGUI::imported ( )
protected

Show imported materials.

protected

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

References ilUtil\_getObjectsByOperations(), and ilECSServerSettings\getInstance().

Referenced by readAll().

{
global $ilUser;
$this->tabs_gui->setSubTabActive('ecs_import');
$rcourses = ilUtil::_getObjectsByOperations('rcrs','visible',$ilUser->getId(),-1);
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_imported.html','Services/WebServices/ECS');
include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
$tb = new ilToolbarGUI();
if(count($rcourses))
{
$tb->addButton(
$this->lng->txt('csv_export'),
$this->ctrl->getLinkTarget($this,'exportImported')
);
}
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
if(ilECSServerSettings::getInstance()->activeServerExists())
{
$tb->addButton(
$this->lng->txt('ecs_read_remote_links'),
$this->ctrl->getLinkTarget($this,'readAll')
);
}
$this->tpl->setVariable('ACTION_BUTTONS',$tb->getHTML());
include_once('Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
$table_gui = new ilECSImportedContentTableGUI($this,'imported');
$table_gui->setTitle($this->lng->txt('ecs_imported_content'));
$table_gui->parse($rcourses);
$this->tpl->setVariable('TBL_IMPORTED',$table_gui->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::importMappings ( )

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

protected

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

References $server, ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), ilAccordionGUI\FIRST_OPEN, ilECSServerSettings\getInstance(), initMappingsForm(), MAPPING_IMPORT, ilUtil\sendInfo(), and setMappingTabs().

{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$this->setMappingTabs(self::MAPPING_IMPORT);
if(!count($fields))
{
ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
return true;
}
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
$settings->readInactiveServers();
include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
$acc = new ilAccordionGUI();
// Iterate all servers
foreach($settings->getServers() as $server)
{
$acc->setOrientation(ilAccordionGUI::FIRST_OPEN);
$acc->setId('ecs_mapping_import_'.$server->getServerId());
$form = $this->initMappingsForm($server->getServerId(),self::MAPPING_IMPORT);
$acc->addItem(
$server->getTitle() ? $server->getTitle() : 'ECS',
'<br />'.$form->getHTML().'<br />'
);
}
if($acc instanceof ilAccordionGUI)
{
$this->tpl->setContent($acc->getHTML());
}
return true;
}

+ Here is the call graph for this function:

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

Init category mapping form.

Returns

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

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

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

{
global $ilDB;
if(is_object($this->form))
{
return true;
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
$this->form = new ilPropertyFormGUI();
if($a_mode == 'add')
{
$this->form->setTitle($this->lng->txt('ecs_new_category_mapping'));
$this->form->setFormAction($this->ctrl->getFormAction($this,'categoryMapping'));
$this->form->addCommandButton('addCategoryMapping',$this->lng->txt('save'));
$this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
}
else
{
$this->form->setTitle($this->lng->txt('ecs_edit_category_mapping'));
$this->form->setFormAction($this->ctrl->getFormAction($this,'editCategoryMapping'));
$this->form->addCommandButton('updateCategoryMapping',$this->lng->txt('save'));
$this->form->addCommandButton('categoryMapping',$this->lng->txt('cancel'));
}
$imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'),'import_id');
$imp->setRequired(true);
$tpl = new ilTemplate('tpl.ecs_import_id_form.html',true,true,'Services/WebServices/ECS');
$tpl->setVariable('SIZE',5);
$tpl->setVariable('MAXLENGTH',11);
$tpl->setVariable('POST_VAR','import_id');
$tpl->setVariable('PROPERTY_VALUE',$this->rule->getContainerId());
if($this->settings->getImportId())
{
$tpl->setVariable('COMPLETE_PATH',$this->buildPath($this->rule->getContainerId()));
}
$imp->setHTML($tpl->get());
$imp->setInfo($this->lng->txt('ecs_import_id_info'));
$this->form->addItem($imp);
include_once('./Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php');
foreach($fields as $field)
{
$options[$field] = $this->lng->txt('ecs_field_'.$field);
}
$select = new ilSelectInputGUI($this->lng->txt('ecs_attribute_name'),'field');
$select->setValue($this->rule->getFieldName());
$select->setRequired(true);
$select->setOptions($options);
$this->form->addItem($select);
// Value
$value = new ilRadioGroupInputGUI($this->lng->txt('ecs_cat_mapping_type'),'type');
$value->setValue($this->rule->getMappingType());
$value->setRequired(true);
$fixed = new ilRadioOption($this->lng->txt('ecs_cat_mapping_fixed'),ilECSCategoryMappingRule::TYPE_FIXED);
$fixed->setInfo($this->lng->txt('ecs_cat_mapping_fixed_info'));
$fixed_val = new ilTextInputGUI($this->lng->txt('ecs_cat_mapping_values'),'mapping_value');
$fixed_val->setValue($this->rule->getMappingValue());
$fixed_val->setMaxLength(255);
$fixed_val->setSize(40);
$fixed->addSubItem($fixed_val);
$value->addOption($fixed);
$duration = new ilRadioOption($this->lng->txt('ecs_cat_mapping_duration'),ilECSCategoryMappingRule::TYPE_DURATION);
$duration->setInfo($this->lng->txt('ecs_cat_mapping_duration_info'));
$dur_start = new ilDateTimeInputGUI($this->lng->txt('from'),'dur_begin');
$dur_start->setDate($this->rule->getDateRangeStart());
$duration->addSubItem($dur_start);
$dur_end = new ilDateTimeInputGUI($this->lng->txt('to'),'dur_end');
$dur_end->setDate($this->rule->getDateRangeEnd());
$duration->addSubItem($dur_end);
$value->addOption($duration);
$this->form->addItem($value);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

init mapping form

Parameters
int$a_server_id
Returns
ilPropertyFormGUI $form

protected

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

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

Referenced by exportMappings(), and importMappings().

{
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
$mapping_settings = ilECSDataMappingSettings::getInstanceByServerId($a_server_id);
$form = new ilPropertyFormGUI();
if($mapping_type == self::MAPPING_IMPORT)
{
$form->setTitle($this->lng->txt('ecs_mapping_tbl'));
$form->addCommandButton('saveImportMappings',$this->lng->txt('save'));
$form->addCommandButton('importMappings',$this->lng->txt('cancel'));
}
else
{
$form->setTitle($this->lng->txt('ecs_mapping_exp_tbl'));
$form->addCommandButton('saveExportMappings',$this->lng->txt('save'));
$form->addCommandButton('exportMappings',$this->lng->txt('cancel'));
}
$form->setFormAction($this->ctrl->getFormAction($this,'saveMappings'));
if($mapping_type == self::MAPPING_IMPORT)
{
$assignments = new ilCheckboxGroupInputGUI('', 'mapping_type');
$form->addItem($assignments);
$option = new ilCheckboxInputGUI($this->lng->txt('ecs_mapping_crs'), 'mapping_type');
$assignments->addOption($option);
}
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$options = $this->prepareFieldSelection($fields);
// get all optional ecourse fields
include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
foreach($optional as $field_name)
{
if($mapping_type == self::MAPPING_IMPORT)
{
$select = new ilSelectInputGUI(
$this->lng->txt('ecs_field_'.$field_name),
'mapping'.'['.ilECSDataMappingSetting::MAPPING_IMPORT_CRS.']['.$field_name.']'
);
$select->setValue(
$mapping_settings->getMappingByECSName(
$field_name)
);
$select->setOptions($options);
$option->addSubItem($select);
}
else
{
$select = new ilSelectInputGUI(
$this->lng->txt('ecs_field_'.$field_name),
'mapping'.'['.ilECSDataMappingSetting::MAPPING_EXPORT.']['.$field_name.']'
);
$select->setValue(
$mapping_settings->getMappingByECSName(
$field_name)
);
$select->setOptions($options);
$form->addItem($select);
}
}
$server = new ilHiddenInputGUI('ecs_mapping_server');
$server->setValue($a_server_id);
$form->addItem($server);
// Remote courses
// no remote course settings for export
if($mapping_type == self::MAPPING_EXPORT)
{
return $form;
}
$rcrs = new ilCheckboxInputGUI($this->lng->txt('ecs_mapping_rcrs'), 'mapping_type');
$assignments->addOption($rcrs);
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$options = $this->prepareFieldSelection($fields);
// get all optional econtent fields
include_once('./Services/WebServices/ECS/classes/class.ilECSUtils.php');
foreach($optional as $field_name)
{
$select = new ilSelectInputGUI(
$this->lng->txt('ecs_field_'.$field_name),
'mapping['.ilECSDataMappingSetting::MAPPING_IMPORT_RCRS.']['.$field_name.']');
$select->setValue(
$mapping_settings->getMappingByECSName(
$field_name)
);
$select->setOptions($options);
$rcrs->addSubItem($select);
}
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::initRule (   $a_rule_id = 0)
protected

Init rule.

Parameters
int$rule_idrule id
Returns

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

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

{
if(is_object($this->rule))
{
return $this->rule;
}
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingRule.php';
$this->rule = new ilECSCategoryMappingRule($a_rule_id);
}

+ Here is the caller graph for this function:

ilECSSettingsGUI::initSettings (   $a_server_id = 1)
protected

Init settings.

protected

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

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

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

{
include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

init settings form

protected

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

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

{
if(is_object($this->form))
{
return true;
}
include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'settings'));
$this->form->setTitle($this->lng->txt('ecs_connection_settings'));
$ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'),'active');
$ena->setChecked($this->settings->isEnabled());
$ena->setValue(1);
$this->form->addItem($ena);
$ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'),'server');
$ser->setValue((string) $this->settings->getServer());
$ser->setRequired(true);
$this->form->addItem($ser);
$pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'),'protocol');
// fixed to https
#$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
# ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS'));
$pro->setValue($this->settings->getProtocol());
$pro->setRequired(true);
$this->form->addItem($pro);
$por = new ilTextInputGUI($this->lng->txt('ecs_port'),'port');
$por->setSize(5);
$por->setMaxLength(5);
$por->setValue((string) $this->settings->getPort());
$por->setRequired(true);
$this->form->addItem($por);
$tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'),'auth_type');
$tcer->setValue($this->settings->getAuthType());
$this->form->addItem($tcer);
// Certificate based authentication
$cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), ilECSSetting::AUTH_CERTIFICATE);
$tcer->addOption($cert_based);
$cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'),'client_cert');
$cli->setSize(60);
$cli->setValue((string) $this->settings->getClientCertPath());
$cli->setRequired(true);
$cert_based->addSubItem($cli);
$key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'),'key_path');
$key->setSize(60);
$key->setValue((string) $this->settings->getKeyPath());
$key->setRequired(true);
$cert_based->addSubItem($key);
$cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'),'key_password');
$cerp->setSize(12);
$cerp->setValue((string) $this->settings->getKeyPassword());
$cerp->setInputType('password');
$cerp->setRequired(true);
$cert_based->addSubItem($cerp);
$cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'),'ca_cert');
$cer->setSize(60);
$cer->setValue((string) $this->settings->getCACertPath());
$cer->setRequired(true);
$cert_based->addSubItem($cer);
// Apache auth
$apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), ilECSSetting::AUTH_APACHE);
$tcer->addOption($apa_based);
$user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'),'auth_user');
$user->setSize(32);
$user->setValue((string) $this->settings->getAuthUser());
$user->setRequired(true);
$apa_based->addSubItem($user);
$pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass');
$pass->setRetype(false);
$pass->setSize(16);
$pass->setMaxLength(32);
$pass->setValue((string) $this->settings->getAuthPass());
$pass->setRequired(true);
$apa_based->addSubItem($pass);
$ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
$ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value'));
$cert_based->addSubItem($ser);
$loc = new ilFormSectionHeaderGUI();
$loc->setTitle($this->lng->txt('ecs_local_settings'));
$this->form->addItem($loc);
$pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'),'polling');
$pol->setShowDays(false);
$pol->setShowHours(false);
$pol->setShowMinutes(true);
$pol->setShowSeconds(true);
$pol->setSeconds($this->settings->getPollingTimeSeconds());
$pol->setMinutes($this->settings->getPollingTimeMinutes());
$pol->setRequired(true);
$pol->setInfo($this->lng->txt('ecs_polling_info'));
$this->form->addItem($pol);
$imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id'));
$imp->setRequired(true);
$tpl = new ilTemplate('tpl.ecs_import_id_form.html',true,true,'Services/WebServices/ECS');
$tpl->setVariable('SIZE',5);
$tpl->setVariable('MAXLENGTH',11);
$tpl->setVariable('POST_VAR','import_id');
$tpl->setVariable('PROPERTY_VALUE',$this->settings->getImportId());
if($this->settings->getImportId())
{
$tpl->setVariable('COMPLETE_PATH',$this->buildPath($this->settings->getImportId()));
}
$imp->setHTML($tpl->get());
$imp->setInfo($this->lng->txt('ecs_import_id_info'));
$this->form->addItem($imp);
$loc = new ilFormSectionHeaderGUI();
$loc->setTitle($this->lng->txt('ecs_remote_user_settings'));
$this->form->addItem($loc);
$role = new ilSelectInputGUI($this->lng->txt('ecs_role'),'global_role');
$role->setOptions($this->prepareRoleSelect());
$role->setValue($this->settings->getGlobalRole());
$role->setInfo($this->lng->txt('ecs_global_role_info'));
$role->setRequired(true);
$this->form->addItem($role);
$duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'),'duration');
$duration->setInfo($this->lng->txt('ecs_account_duration_info'));
$duration->setMonths($this->settings->getDuration());
$duration->setShowSeconds(false);
$duration->setShowMinutes(false);
$duration->setShowHours(false);
$duration->setShowDays(false);
$duration->setShowMonths(true);
$duration->setRequired(true);
$this->form->addItem($duration);
// Email recipients
$loc = new ilFormSectionHeaderGUI();
$loc->setTitle($this->lng->txt('ecs_notifications'));
$this->form->addItem($loc);
$rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'),'user_recipients');
$rcp_user->setValue((string) $this->settings->getUserRecipientsAsString());
$rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info'));
$this->form->addItem($rcp_user);
$rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'),'econtent_recipients');
$rcp_econ->setValue((string) $this->settings->getEContentRecipientsAsString());
$rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info'));
$this->form->addItem($rcp_econ);
$rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'),'approval_recipients');
$rcp_app->setValue((string) $this->settings->getApprovalRecipientsAsString());
$rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
$this->form->addItem($rcp_app);
if($a_mode == 'update')
{
$this->form->addCommandButton('update',$this->lng->txt('save'));
}
else
{
$this->form->addCommandButton('save',$this->lng->txt('save'));
}
$this->form->addCommandButton('overview',$this->lng->txt('cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::initTaskScheduler ( )
protected

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

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

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

Referenced by save(), and update().

{
global $ilDB,$ilSetting;
#$ilDB->lockTables(array('name' => 'settings', 'type' => ilDB::LOCK_WRITE));
$setting = new ilSetting('ecs');
$setting->set(
'next_execution_'.$this->settings->getServerId(),
time() + (int) $this->settings->getPollingTime()
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::loadFromPost ( )
protected

Load from post.

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

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

Referenced by save(), and update().

{
$this->settings->setEnabledStatus((int) $_POST['active']);
//$this->settings->setTitle(ilUtil::stripSlashes($_POST['title']));
$this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
$this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
$this->settings->setProtocol(ilUtil::stripSlashes($_POST['protocol']));
$this->settings->setClientCertPath(ilUtil::stripSlashes($_POST['client_cert']));
$this->settings->setCACertPath(ilUtil::stripSlashes($_POST['ca_cert']));
$this->settings->setKeyPath(ilUtil::stripSlashes($_POST['key_path']));
$this->settings->setKeyPassword(ilUtil::stripSlashes($_POST['key_password']));
$this->settings->setImportId(ilUtil::stripSlashes($_POST['import_id']));
$this->settings->setPollingTimeMS((int) $_POST['polling']['mm'],(int) $_POST['polling']['ss']);
$this->settings->setServer(ilUtil::stripSlashes($_POST['server']));
$this->settings->setGlobalRole((int) $_POST['global_role']);
$this->settings->setDuration((int) $_POST['duration']['MM']);
$this->settings->setUserRecipients(ilUtil::stripSlashes($_POST['user_recipients']));
$this->settings->setEContentRecipients(ilUtil::stripSlashes($_POST['econtent_recipients']));
$this->settings->setApprovalRecipients(ilUtil::stripSlashes($_POST['approval_recipients']));
$this->settings->setAuthType((int) $_POST['auth_type']);
$this->settings->setAuthPass(ilUtil::stripSlashes($_POST['auth_pass']));
$this->settings->setAuthUser(ilUtil::stripSlashes($_POST['auth_user']));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::overview ( )

List available servers.

Returns
void ilToolbar ilTabsGUI

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

References ilECSServerSettings\getInstance().

Referenced by save(), and update().

{
global $ilToolbar,$ilTabs;
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
$ilTabs->setSubTabActive('overview');
$ilToolbar->addButton(
$this->lng->txt('ecs_add_new_ecs'),
$this->ctrl->getLinkTarget($this,'create')
);
$servers->readInactiveServers();
include_once './Services/WebServices/ECS/classes/class.ilECSServerTableGUI.php';
$table = new ilECSServerTableGUI($this,'overview');
$table->initTable();
$table->parse($servers);
$this->tpl->setContent($table->getHTML());
return;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::prepareFieldSelection (   $fields)
protected

get options for field selection

Parameters
arrayarray of field objects protected

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

References $title, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), and ilAdvancedMDRecord\_lookupTitle().

Referenced by initMappingsForm().

{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
$options[0] = $this->lng->txt('ecs_ignore_field');
foreach($fields as $field)
{
$title = ilAdvancedMDRecord::_lookupTitle($field->getRecordId());
$options[$field->getFieldId()] = $title.': '.$field->getTitle();
}
return $options;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::prepareRoleSelect ( )
private

get global role array

protected

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

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

Referenced by initSettingsForm().

{
global $rbacreview,$ilObjDataCache;
$global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
'object_data',
'title',
'obj_id');
$select[0] = $this->lng->txt('links_select_one');
foreach($global_roles as $role_id)
{
$select[$role_id] = ilObject::_lookupTitle($role_id);
}
return $select;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::readAll ( )
protected

Read all importable econtent.

protected

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

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

{
include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
try
{
foreach(ilECSServerSettings::getInstance()->getServers() as $server)
{
include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
ilECSTaskScheduler::_getInstanceByServerId($server->getServerId())->startTaskExecution();
ilUtil::sendInfo($this->lng->txt('ecs_remote_imported'));
$this->imported();
return true;
}
}
{
ilUtil::sendInfo('Cannot connect to ECS server: '.$e1->getMessage());
$this->imported();
return false;
}
catch(ilException $e2)
{
ilUtil::sendInfo('Update failed: '.$e1->getMessage());
$this->imported();
return false;
}
}

+ Here is the call graph for this function:

ilECSSettingsGUI::released ( )
protected

Show released materials.

protected

Returns

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

References settings().

{
global $ilUser;
$this->tabs_gui->setSubTabActive('ecs_released');
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$exported = ilECSExport::getExportedIDs();
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_released.html','Services/WebServices/ECS');
include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
$tb = new ilToolbarGUI();
if(count($exported))
{
$tb->addButton(
$this->lng->txt('csv_export'),
$this->ctrl->getLinkTarget($this,'exportReleased')
);
}
if($this->settings->isEnabled())
{
$tb->addButton(
$this->lng->txt('ecs_read_remote_links'),
$this->ctrl->getLinkTarget($this,'readAll')
);
}
$this->tpl->setVariable('ACTION_BUTTONS',$tb->getHTML());
include_once('Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
$table_gui = new ilECSReleasedContentTableGUI($this,'released');
$table_gui->setTitle($this->lng->txt('ecs_released_content'));
$table_gui->parse($exported);
$this->tpl->setVariable('TABLE_REL',$table_gui->getHTML());
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::save ( )
protected

Save settings.

Returns
<type>

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

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

{
$this->initSettings(0);
$this->loadFromPost();
if(!$error = $this->settings->validate())
{
$this->settings->save();
$this->updateTitle();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
}
else
{
ilUtil::sendInfo($this->lng->txt($error));
$this->create();
}
$this->overview();
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::saveExportMappings ( )
protected

Save mappings.

protected

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

References $_POST, and ilUtil\sendInfo().

{
foreach((array) $_POST['mapping'] as $mtype => $mappings)
{
foreach((array) $mappings as $ecs_field => $advmd_id)
{
include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
(int) $_POST['ecs_mapping_server'],
(int) $mtype,
$ecs_field
);
$map->setAdvMDId($advmd_id);
$map->save();
}
}
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'exportMappings');
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::saveImportMappings ( )
protected

Save mappings.

protected

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

References $_POST, and ilUtil\sendInfo().

{
foreach((array) $_POST['mapping'] as $mtype => $mappings)
{
foreach((array) $mappings as $ecs_field => $advmd_id)
{
include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
(int) $_POST['ecs_mapping_server'],
(int) $mtype,
$ecs_field
);
$map->setAdvMDId($advmd_id);
$map->save();
}
}
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'importMappings');
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::setMappingTabs (   $a_active)
protected

Handle tabs for ECS data mapping.

Parameters
int$a_activeilTabsGUI ilTabs

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

Referenced by exportMappings(), and importMappings().

{
global $ilTabs;
$ilTabs->clearTargets();
$ilTabs->clearSubTabs();
$ilTabs->setBackTarget(
$this->lng->txt('ecs_settings'),
$this->ctrl->getLinkTarget($this,'overview')
);
$ilTabs->addTab(
'import',
$this->lng->txt('ecs_tab_import'),
$this->ctrl->getLinkTarget($this,'importMappings')
);
$ilTabs->addTab(
'export',
$this->lng->txt('ecs_tab_export'),
$this->ctrl->getLinkTarget($this,'exportMappings')
);
switch($a_active)
{
case self::MAPPING_IMPORT:
$ilTabs->activateTab('import');
break;
case self::MAPPING_EXPORT:
$ilTabs->activateTab('export');
break;
}
return true;
}

+ Here is the caller graph for this function:

ilECSSettingsGUI::setSubTabs ( )
protected

set sub tabs

protected

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

References ilECSServerSettings\getInstance().

Referenced by executeCommand().

{
$this->tabs_gui->clearSubTabs();
$this->tabs_gui->addSubTabTarget("overview",
$this->ctrl->getLinkTarget($this,'overview'),
"overview",get_class($this));
// Disable all other tabs, if server hasn't been configured.
ilECSServerSettings::getInstance()->readInactiveServers();
if(!ilECSServerSettings::getInstance()->serverExists())
{
return true;
}
$this->tabs_gui->addSubTabTarget("ecs_communities",
$this->ctrl->getLinkTarget($this,'communities'),
"communities",get_class($this));
$this->tabs_gui->addSubTabTarget('ecs_mappings',
$this->ctrl->getLinkTarget($this,'importMappings'),
'importMappings',get_class($this));
$this->tabs_gui->addSubTabTarget('ecs_category_mapping',
$this->ctrl->getLinkTarget($this,'categoryMapping'));
$this->tabs_gui->addSubTabTarget('ecs_import',
$this->ctrl->getLinkTarget($this,'imported'));
$this->tabs_gui->addSubTabTarget('ecs_released',
$this->ctrl->getLinkTarget($this,'released'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::settings ( )
protected

show settings

protected

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

References initSettingsForm().

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

{
$this->initSettingsForm();
$this->tabs_gui->setSubTabActive('ecs_settings');
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.ecs_settings.html','Services/WebServices/ECS');
$this->tpl->setVariable('SETTINGS_TABLE',$this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::showRulesTable ( )
protected

Show rules table.

Returns

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

References ilECSCategoryMapping\getActiveRules().

Referenced by categoryMapping().

{
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMapping.php';
{
return false;
}
include_once './Services/WebServices/ECS/classes/class.ilECSCategoryMappingTableGUI.php';
$rule_table = new ilECSCategoryMappingTableGUI($this,'categoryMapping');
$rule_table->parse($rules);
return $rule_table->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::update ( )
protected

save settings

protected

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

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

{
$this->initSettings((int) $_REQUEST['server_id']);
$this->loadFromPost();
if(!$error = $this->settings->validate())
{
$this->settings->update();
$this->updateTitle();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
}
else
{
ilUtil::sendInfo($this->lng->txt($error));
$this->edit();
}
$this->overview();
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::updateCategoryMapping ( )
protected

update category mapping

Returns

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

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

{
if(!$_REQUEST['rule_id'])
{
ilUtil::sendInfo($this->lng->txt('select_one'));
$this->categoryMapping();
return false;
}
$this->ctrl->saveParameter($this,'rule_id');
$this->initRule((int) $_REQUEST['rule_id']);
$this->initCategoryMappingForm('edit');
if($this->form->checkInput())
{
$this->rule->setContainerId($this->form->getInput('import_id'));
$this->rule->setMappingType($this->form->getInput('type'));
$this->rule->setMappingValue($this->form->getInput('mapping_value'));
$this->rule->setFieldName($this->form->getInput('field'));
$this->rule->setDateRangeStart($this->form->getItemByPostVar('dur_begin')->getDate());
$this->rule->setDateRangeEnd($this->form->getItemByPostVar('dur_end')->getDate());
if($err = $this->rule->validate())
{
ilUtil::sendInfo($this->lng->txt($err));
$this->form->setValuesByPost();
return false;
}
$this->rule->update();
ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'categoryMapping');
return true;
}
ilUtil::sendInfo($this->lng->txt('err_check_input'));
$this->form->setValuesByPost();
return false;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::updateCommunities ( )
protected

update whitelist

protected

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

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

{
global $ilLog;
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
// @TODO: Delete deprecated communities
$invalidImportTypes = false;
if(!$this->validateImportTypes($_POST['import_type']))
{
$invalidImportTypes = true;
}
foreach($servers->getServers() as $server)
{
try {
// Read communities
// Update community cache
foreach($cReader->getCommunities() as $community)
{
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
$cCache = ilECSCommunityCache::getInstance($server->getServerId(), $community->getId());
$cCache->setCommunityName($community->getTitle());
$cCache->setMids($community->getMids());
$cCache->setOwnId($community->getOwnId());
$cCache->update();
}
}
catch(Exception $e)
{
$GLOBALS['ilLog']->write(__METHOD__.': Cannot read ecs communities: '.$e->getMessage());
}
}
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
foreach((array) $_POST['sci_mid'] as $sid => $tmp)
{
foreach((array) $_POST['sci_mid'][$sid] as $mid => $tmp)
{
$set = new ilECSParticipantSetting($sid, $mid);
$set->enableExport(array_key_exists($mid, (array) $_POST['export'][$sid]) ? true : false);
$set->enableImport(array_key_exists($mid, (array) $_POST['import'][$sid]) ? true : false);
$set->setImportType($_POST['import_type'][$sid][$mid]);
// update title/cname
try {
$part = ilECSCommunityReader::getInstanceByServerId($sid)->getParticipantByMID($mid);
if($part instanceof ilECSParticipant)
{
$set->setTitle($part->getParticipantName());
}
$com = ilECSCommunityReader::getInstanceByServerId($sid)->getCommunityByMID($mid);
if($com instanceof ilECSCommunity)
{
$set->setCommunityName($com->getTitle());
}
}
catch(Exception $e)
{
$GLOBALS['ilLog']->write(__METHOD__.': Cannot read ecs communities: '.$e->getMessage());
}
$set->update();
}
}
if($invalidImportTypes)
{
ilUtil::sendFailure($this->lng->txt('ecs_invalid_import_type_cms'),true);
}
else
{
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
}
$GLOBALS['ilCtrl']->redirect($this,'communities');
// TODO: Do update of remote courses and ...
return true;
/*
$mids = $_POST['mid'] ? $_POST['mid'] : array();
include_once('./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
$part = ilECSParticipantSettings::_getInstance();
foreach($part->getEnabledParticipants() as $mid)
{
if(!in_array($mid,$mids))
{
// Delete all remote courses
include_once('./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
#foreach(ilObjRemoteCourse::_lookupObjIdsByMID($mid) as $obj_id)
{
foreach(ilObject::_getAllReferences($obj_id) as $ref_id)
{
$to_delete = ilObjectFactory::getInstanceByRefId($ref_id,false);
$to_delete->delete();
}
}
}
}
*/
/*
try
{
// Update all exported econtent
include_once('./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
include_once('./Services/WebServices/ECS/classes/class.ilECSConnector.php');
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$reader = new ilECSEContentReader();
$reader->read();
$all_content = $reader->getEContent();
// read update events
foreach($all_content as $content)
{
if(ilECSExport::_isRemote($content->getEContentId()))
{
$ilLog->write(__METHOD__.': Ignoring remote EContent: '.$content->getTitle());
// Do not handle remote courses.
continue;
}
$members = array_intersect($mids,$content->getEligibleMembers());
if(!$members)
{
$ilLog->write(__METHOD__.': Deleting EContent: '.$content->getTitle());
$connector = new ilECSConnector();
$connector->deleteResource($content->getEContentId());
ilECSExport::_deleteEContentIds(array($content->getEContentId()));
}
elseif(count($members) != count($content->getEligibleMembers()))
{
$ilLog->write(__METHOD__.': Update eligible members for EContent: '.$content->getTitle());
$content->setEligibleMembers($members);
$connector = new ilECSConnector();
$connector->updateResource($content->getEContentId(),json_encode($content));
}
}
}
catch(ilECSConnectorException $e)
{
ilUtil::sendInfo('Cannot connect to ECS server: '.$e->getMessage());
$this->communities();
return false;
}
catch(ilException $e)
{
ilUtil::sendInfo('Update failed: '.$e->getMessage());
$this->communities();
return false;
}
*/
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::updateTitle ( )
protected

Update configuration title.

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

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

Referenced by save(), and update().

{
try
{
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
foreach($reader->getCommunities() as $community)
{
foreach($community->getParticipants() as $part)
{
if($part->isSelf())
{
$this->settings->setTitle($part->getParticipantName());
$this->settings->update();
return true;
}
}
}
}
{
ilUtil::sendFailure($exc->getMessage());
}
$this->settings->setTitle('');
$this->settings->update();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::validateImportTypes ( $import_types)
protected

Validate import types.

Parameters
array$import_types
Returns
bool

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

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

Referenced by updateCommunities().

{
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
$num_cms = 0;
foreach((array) $import_types as $sid => $server)
{
foreach((array) $server as $mid => $import_type)
{
{
++$num_cms;
}
}
}
if($num_cms <= 1)
{
return true;
}
// Change to import type "UNCHANGED"
$new_types = array();
foreach((array) $import_types as $sid => $server)
{
foreach((array) $server as $mid => $import_type)
{
{
}
else
{
$new_types[$sid][$mid] = $import_type;
}
}
}
$import_types = $new_types;
return false;
}

+ Here is the caller graph for this function:

Field Documentation

ilECSSettingsGUI::$ctrl
protected

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

ilECSSettingsGUI::$lng
protected

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

Referenced by __construct().

ilECSSettingsGUI::$tabs_gui
protected

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

ilECSSettingsGUI::$tpl
protected
const ilECSSettingsGUI::MAPPING_EXPORT = 1

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

Referenced by exportMappings().

const ilECSSettingsGUI::MAPPING_IMPORT = 2

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

Referenced by importMappings().


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