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

Public Member Functions

 __construct ()
 Constructor.
 executeCommand ()
 Execute command.
 communities ()
 show communities
 mappings ()
 Show mapping settings (EContent-Data <-> (Remote)Course.

Protected Member Functions

 readAll ()
 Read all importable econtent.
 settings ()
 show settings
 initSettingsForm ()
 init settings form
 saveSettings ()
 save settings
 updateCommunities ()
 update whitelist
 saveMappings ()
 Save mappings.
 initMappingsForm ()
 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 ()
 Init settings.
 setSubTabs ()
 set sub tabs

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

Constructor & Destructor Documentation

ilECSSettingsGUI::__construct ( )

Constructor.

public

Definition at line 46 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::addCategoryMapping ( )
protected

save category mapping

Returns

Definition at line 574 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 1190 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 554 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 335 of file class.ilECSSettingsGUI.php.

References $reader, ilECSCommunityReader\_getInstance(), ilUtil\getImagePath(), ilUtil\sendInfo(), and ilTable2GUI\setTitle().

Referenced by updateCommunities().

{
$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('IMAGE_DOWNRIGHT',ilUtil::getImagePath('arrow_downright.gif'));
$this->tpl->setVariable('TXT_SAVE',$this->lng->txt('ecs_enable_participant'));
include_once('Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
include_once('Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
try
{
foreach($reader->getCommunities() as $community)
{
$this->tpl->setCurrentBlock('table_community');
$table_gui = new ilECSCommunityTableGUI($this,'communities',$community->getId());
$table_gui->setTitle($community->getTitle().' ('.$community->getDescription().')');
#$table_gui->parse($community->getParticipants());
$table_gui->parse($community->getParticipants());
#$table_gui->setSelectAllCheckbox("mid");
$this->tpl->setVariable('TABLE_COMM',$table_gui->getHTML());
$this->tpl->parseCurrentBlock();
}
}
{
ilUtil::sendInfo('Cannot connect to ECS server');
return true;
}
}

+ 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 675 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::editCategoryMapping ( )
protected

Edit category mapping.

Returns

Definition at line 611 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 66 of file class.ilECSSettingsGUI.php.

References $cmd, and setSubTabs().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->setSubTabs();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = "settings";
}
$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 874 of file class.ilECSSettingsGUI.php.

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

{
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('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_import.csv", "text/csv");
}

+ Here is the call graph for this function:

ilECSSettingsGUI::exportReleased ( )
protected

export released

protected

Returns

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

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

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

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

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')
);
}
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.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::initCategoryMappingForm (   $a_mode = 'add')
protected

Init category mapping form.

Returns

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

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

{
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 ( )
protected

init mapping form

protected

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

References ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), ilECSDataMappingSettings\_getInstance(), ilECSUtils\_getOptionalEContentFields(), and prepareFieldSelection().

Referenced by mappings().

{
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
if(is_object($this->form))
{
return true;
}
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$fields = array_unique(array_merge(ilAdvancedMDFieldDefinition::_getActiveDefinitionsByObjType('crs'),
$options = $this->prepareFieldSelection($fields);
$this->form = new ilPropertyFormGUI();
$this->form->setTitle($this->lng->txt('ecs_mapping_tbl'));
$this->form->setFormAction($this->ctrl->getFormAction($this,'saveMappings'));
$this->form->addCommandButton('saveMappings',$this->lng->txt('save'));
$this->form->addCommandButton('mappings',$this->lng->txt('cancel'));
// get all optional 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['.$field_name.']');
$select->setValue($mapping_settings->getMappingByECSName($field_name));
$select->setOptions($options);
$this->form->addItem($select);
}
}

+ 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 717 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 ( )
protected

Init settings.

protected

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

References ilECSSettings\_getInstance(), and settings().

Referenced by __construct().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::initSettingsForm ( )
protected

init settings form

protected

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

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

Referenced by 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($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(ilECSSettings::PROTOCOL_HTTP => $this->lng->txt('http'),
# ilECSSettings::PROTOCOL_HTTPS => $this->lng->txt('https')));
$pro->setOptions(array(ilECSSettings::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($this->settings->getPort());
$por->setRequired(true);
$this->form->addItem($por);
$cer = new ilTextInputGUI($this->lng->txt('ecs_client_cert'),'client_cert');
$cer->setSize(60);
$cer->setValue($this->settings->getClientCertPath());
$cer->setRequired(true);
$this->form->addItem($cer);
$cer = new ilTextInputGUI($this->lng->txt('ecs_cert_key'),'key_path');
$cer->setSize(60);
$cer->setValue($this->settings->getKeyPath());
$cer->setRequired(true);
$this->form->addItem($cer);
$cer = new ilTextInputGUI($this->lng->txt('ecs_key_password'),'key_password');
$cer->setSize(12);
$cer->setValue($this->settings->getKeyPassword());
$cer->setInputType('password');
$cer->setRequired(true);
$this->form->addItem($cer);
$cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'),'ca_cert');
$cer->setSize(60);
$cer->setValue($this->settings->getCACertPath());
$cer->setRequired(true);
$this->form->addItem($cer);
$ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial'));
$ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value'));
$this->form->addItem($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($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($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($this->settings->getApprovalRecipientsAsString());
$rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info'));
$this->form->addItem($rcp_app);
$this->form->addCommandButton('saveSettings',$this->lng->txt('save'));
$this->form->addCommandButton('settings',$this->lng->txt('cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettingsGUI::mappings ( )

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

public

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

References ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), initMappingsForm(), and ilUtil\sendInfo().

Referenced by saveMappings().

{
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$this->tabs_gui->setSubTabActive('ecs_mappings');
if(!count($fields))
{
ilUtil::sendInfo($this->lng->txt('ecs_no_adv_md'));
return true;
}
$this->initMappingsForm();
$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::prepareFieldSelection (   $fields)
protected

get options for field selection

Parameters
arrayarray of field objects protected

Definition at line 1103 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 1173 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 91 of file class.ilECSSettingsGUI.php.

References ilECSTaskScheduler\_getInstance(), 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');
try
{
include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
ilECSTaskScheduler::_getInstance()->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 977 of file class.ilECSSettingsGUI.php.

References ilECSExport\_getExportedIDs(), and settings().

{
global $ilUser;
$this->tabs_gui->setSubTabActive('ecs_released');
include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
$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::saveMappings ( )
protected

Save mappings.

protected

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

References $_POST, ilECSDataMappingSettings\_getInstance(), mappings(), and ilUtil\sendInfo().

{
include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
$mapping_settings->setMappings($_POST['mapping']);
$mapping_settings->save();
ilUtil::sendInfo($this->lng->txt('settings_saved'));
$this->mappings();
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::saveSettings ( )
protected

save settings

protected

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

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

{
$this->settings->setEnabledStatus((int) $_POST['active']);
$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']));
if(!$error = $this->settings->validate())
{
$this->settings->save();
ilUtil::sendInfo($this->lng->txt('settings_saved'));
}
else
{
ilUtil::sendInfo($this->lng->txt($error));
}
$this->setSubTabs('ecs_settings');
$this->settings();
return true;
}

+ Here is the call graph for this function:

ilECSSettingsGUI::setSubTabs ( )
protected

set sub tabs

protected

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

References settings().

Referenced by executeCommand(), and saveSettings().

{
$this->tabs_gui->clearSubTabs();
$this->tabs_gui->addSubTabTarget("ecs_settings",
$this->ctrl->getLinkTarget($this,'settings'),
"settings",get_class($this));
// Disable all other tabs, if server hasn't been configured.
if(!$this->settings->isEnabled())
{
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,'mappings'),
'mappings',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 129 of file class.ilECSSettingsGUI.php.

References initSettingsForm().

Referenced by imported(), initCategoryMappingForm(), initSettings(), initSettingsForm(), released(), saveSettings(), and setSubTabs().

{
$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 698 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::updateCategoryMapping ( )
protected

update category mapping

Returns

Definition at line 633 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 379 of file class.ilECSSettingsGUI.php.

References $_POST, $ilLog, $reader, $ref_id, ilECSExport\_deleteEContentIds(), ilObject\_getAllReferences(), ilECSParticipantSettings\_getInstance(), ilECSExport\_isRemote(), ilObjRemoteCourse\_lookupObjIdsByMID(), communities(), ilObjectFactory\getInstanceByRefId(), and ilUtil\sendInfo().

{
global $ilLog;
$mids = $_POST['mid'] ? $_POST['mid'] : array();
include_once('./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
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->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));
}
}
}
{
ilUtil::sendInfo('Cannot connect to ECS server: '.$e->getMessage());
$this->communities();
return false;
}
catch(ilException $e)
{
ilUtil::sendInfo('Update failed: '.$e1->getMessage());
$this->communities();
return false;
}
$part->setEnabledParticipants($_POST['mid'] ? $_POST['mid'] : array());
$part->save();
ilUtil::sendInfo($this->lng->txt('settings_saved'));
$this->communities();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilECSSettingsGUI::$ctrl
protected

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

ilECSSettingsGUI::$lng
protected

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

Referenced by __construct().

ilECSSettingsGUI::$tabs_gui
protected

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

ilECSSettingsGUI::$tpl
protected

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