52 $this->lng->loadLanguageModule(
'ecs');
54 $this->tabs_gui = $ilTabs;
68 $next_class = $this->ctrl->getNextClass($this);
69 $cmd = $this->ctrl->getCmd();
93 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
94 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
95 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
101 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
132 $this->tabs_gui->setSubTabActive(
'ecs_settings');
134 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ecs_settings.html',
'Services/WebServices/ECS');
135 $this->tpl->setVariable(
'SETTINGS_TABLE',$this->form->getHTML());
145 if(is_object($this->form))
149 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
152 $this->form->setFormAction($this->ctrl->getFormAction($this,
'settings'));
153 $this->form->setTitle($this->lng->txt(
'ecs_connection_settings'));
158 $this->form->addItem($ena);
160 $ser =
new ilTextInputGUI($this->lng->txt(
'ecs_server_url'),
'server');
162 $ser->setRequired(
true);
163 $this->form->addItem($ser);
167 #$pro->setOptions(array(ilECSSettings::PROTOCOL_HTTP => $this->lng->txt('http'),
168 # ilECSSettings::PROTOCOL_HTTPS => $this->lng->txt('https')));
170 $pro->setValue($this->
settings->getProtocol());
171 $pro->setRequired(
true);
172 $this->form->addItem($pro);
176 $por->setMaxLength(5);
177 $por->setValue($this->
settings->getPort());
178 $por->setRequired(
true);
179 $this->form->addItem($por);
181 $cer =
new ilTextInputGUI($this->lng->txt(
'ecs_client_cert'),
'client_cert');
183 $cer->setValue($this->
settings->getClientCertPath());
184 $cer->setRequired(
true);
185 $this->form->addItem($cer);
187 $cer =
new ilTextInputGUI($this->lng->txt(
'ecs_cert_key'),
'key_path');
189 $cer->setValue($this->
settings->getKeyPath());
190 $cer->setRequired(
true);
191 $this->form->addItem($cer);
193 $cer =
new ilTextInputGUI($this->lng->txt(
'ecs_key_password'),
'key_password');
195 $cer->setValue($this->
settings->getKeyPassword());
196 $cer->setInputType(
'password');
197 $cer->setRequired(
true);
198 $this->form->addItem($cer);
200 $cer =
new ilTextInputGUI($this->lng->txt(
'ecs_ca_cert'),
'ca_cert');
202 $cer->setValue($this->
settings->getCACertPath());
203 $cer->setRequired(
true);
204 $this->form->addItem($cer);
207 $ser->
setValue($this->
settings->getCertSerialNumber() ? $this->
settings->getCertSerialNumber() : $this->lng->txt(
'ecs_no_value'));
208 $this->form->addItem($ser);
211 $loc->setTitle($this->lng->txt(
'ecs_local_settings'));
212 $this->form->addItem($loc);
216 $pol->setShowHours(
false);
217 $pol->setShowMinutes(
true);
218 $pol->setShowSeconds(
true);
219 $pol->setSeconds($this->
settings->getPollingTimeSeconds());
220 $pol->setMinutes($this->
settings->getPollingTimeMinutes());
221 $pol->setRequired(
true);
222 $pol->setInfo($this->lng->txt(
'ecs_polling_info'));
223 $this->form->addItem($pol);
228 $tpl =
new ilTemplate(
'tpl.ecs_import_id_form.html',
true,
true,
'Services/WebServices/ECS');
229 $tpl->setVariable(
'SIZE',5);
230 $tpl->setVariable(
'MAXLENGTH',11);
231 $tpl->setVariable(
'POST_VAR',
'import_id');
232 $tpl->setVariable(
'PROPERTY_VALUE',$this->
settings->getImportId());
239 $imp->setHTML(
$tpl->get());
240 $imp->setInfo($this->lng->txt(
'ecs_import_id_info'));
241 $this->form->addItem($imp);
244 $loc->setTitle($this->lng->txt(
'ecs_remote_user_settings'));
245 $this->form->addItem($loc);
249 $role->setValue($this->
settings->getGlobalRole());
250 $role->setInfo($this->lng->txt(
'ecs_global_role_info'));
251 $role->setRequired(
true);
252 $this->form->addItem($role);
254 $duration =
new ilDurationInputGUI($this->lng->txt(
'ecs_account_duration'),
'duration');
255 $duration->
setInfo($this->lng->txt(
'ecs_account_duration_info'));
256 $duration->setMonths($this->
settings->getDuration());
257 $duration->setShowSeconds(
false);
258 $duration->setShowMinutes(
false);
259 $duration->setShowHours(
false);
260 $duration->setShowDays(
false);
261 $duration->setShowMonths(
true);
262 $duration->setRequired(
true);
263 $this->form->addItem($duration);
267 $loc->setTitle($this->lng->txt(
'ecs_notifications'));
268 $this->form->addItem($loc);
270 $rcp_user =
new ilTextInputGUI($this->lng->txt(
'ecs_user_rcp'),
'user_recipients');
272 $rcp_user->setInfo($this->lng->txt(
'ecs_user_rcp_info'));
273 $this->form->addItem($rcp_user);
275 $rcp_econ =
new ilTextInputGUI($this->lng->txt(
'ecs_econ_rcp'),
'econtent_recipients');
277 $rcp_econ->setInfo($this->lng->txt(
'ecs_econ_rcp_info'));
278 $this->form->addItem($rcp_econ);
280 $rcp_app =
new ilTextInputGUI($this->lng->txt(
'ecs_approval_rcp'),
'approval_recipients');
282 $rcp_app->setInfo($this->lng->txt(
'ecs_approval_rcp_info'));
283 $this->form->addItem($rcp_app);
285 $this->form->addCommandButton(
'saveSettings',$this->lng->txt(
'save'));
286 $this->form->addCommandButton(
'settings',$this->lng->txt(
'cancel'));
296 $this->
settings->setEnabledStatus((
int) $_POST[
'active']);
305 $this->
settings->setPollingTimeMS((
int) $_POST[
'polling'][
'mm'],(
int) $_POST[
'polling'][
'ss']);
307 $this->
settings->setGlobalRole((
int) $_POST[
'global_role']);
308 $this->
settings->setDuration((
int) $_POST[
'duration'][
'MM']);
314 if(!$error = $this->
settings->validate())
337 $this->tabs_gui->setSubTabActive(
'ecs_communities');
339 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ecs_communities.html',
'Services/WebServices/ECS');
341 $this->tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this,
'updateCommunities'));
343 $this->tpl->setVariable(
'TXT_SAVE',$this->lng->txt(
'ecs_enable_participant'));
345 include_once(
'Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
346 include_once(
'Services/WebServices/ECS/classes/class.ilECSCommunityTableGUI.php');
352 foreach(
$reader->getCommunities() as $community)
354 $this->tpl->setCurrentBlock(
'table_community');
357 $table_gui->
setTitle($community->getTitle().
' ('.$community->getDescription().
')');
358 #$table_gui->parse($community->getParticipants());
359 $table_gui->parse($community->getParticipants());
361 #$table_gui->setSelectAllCheckbox("mid");
362 $this->tpl->setVariable(
'TABLE_COMM',$table_gui->getHTML());
363 $this->tpl->parseCurrentBlock();
384 $mids = $_POST[
'mid'] ? $_POST[
'mid'] : array();
386 include_once(
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
389 foreach($part->getEnabledParticipants() as $mid)
391 if(!in_array($mid,$mids))
394 include_once(
'./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
400 $to_delete->delete();
410 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
411 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnector.php');
412 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
416 $all_content =
$reader->getEContent();
419 foreach($all_content as $content)
423 $ilLog->write(__METHOD__.
': Ignoring remote EContent: '.$content->getTitle());
427 $members = array_intersect($mids,$content->getEligibleMembers());
430 $ilLog->write(__METHOD__.
': Deleting EContent: '.$content->getTitle());
432 $connector->deleteResource($content->getEContentId());
436 elseif(count($members) != count($content->getEligibleMembers()))
438 $ilLog->write(__METHOD__.
': Update eligible members for EContent: '.$content->getTitle());
439 $content->setEligibleMembers($members);
441 $connector->updateResource($content->getEContentId(),json_encode($content));
458 $part->setEnabledParticipants($_POST[
'mid'] ? $_POST[
'mid'] : array());
473 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
475 $this->tabs_gui->setSubTabActive(
'ecs_mappings');
485 $this->tpl->setContent($this->form->getHTML());
497 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
499 $mapping_settings->setMappings($_POST[
'mapping']);
500 $mapping_settings->save();
514 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
516 if(is_object($this->form))
521 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
524 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
532 $this->form->setTitle($this->lng->txt(
'ecs_mapping_tbl'));
533 $this->form->setFormAction($this->ctrl->getFormAction($this,
'saveMappings'));
534 $this->form->addCommandButton(
'saveMappings',$this->lng->txt(
'save'));
535 $this->form->addCommandButton(
'mappings',$this->lng->txt(
'cancel'));
538 include_once(
'./Services/WebServices/ECS/classes/class.ilECSUtils.php');
541 foreach($optional as $field_name)
543 $select =
new ilSelectInputGUI($this->lng->txt(
'ecs_field_'.$field_name),
'mapping['.$field_name.
']');
544 $select->setValue($mapping_settings->getMappingByECSName($field_name));
545 $select->setOptions($options);
546 $this->form->addItem($select);
559 $this->tabs_gui->setSubTabActive(
'ecs_import');
565 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
566 $this->tpl->setCurrentBlock(
"btn_cell");
567 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"exportImported"));
568 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"csv_export"));
569 $this->tpl->parseCurrentBlock();
573 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ecs_imported.html',
'Services/WebServices/ECS');
574 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
578 $this->tpl->setCurrentBlock(
"btn_cell");
579 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,
'readAll'));
580 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
'ecs_read_remote_links'));
581 $this->tpl->parseCurrentBlock();
585 include_once(
'Services/WebServices/ECS/classes/class.ilECSImportedContentTableGUI.php');
587 $this->tpl->setCurrentBlock(
'table_community');
590 $table_gui->setTitle($this->lng->txt(
'ecs_imported_content'));
591 $table_gui->parse($rcourses);
592 $this->tpl->setVariable(
'TABLE_IMP',$table_gui->getHTML());
593 $this->tpl->parseCurrentBlock();
606 global $ilObjDataCache,$ilUser;
611 include_once(
'./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
612 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
623 $ilObjDataCache->preloadReferenceCache($rcourses);
625 foreach($rcourses as $rcrs_ref_id)
627 $obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
628 $obj_ids[$obj_id] = $obj_id;
631 include_once(
'Services/Utilities/classes/class.ilCSVWriter.php');
634 $writer->addColumn($this->lng->txt(
'title'));
635 $writer->addColumn($this->lng->txt(
'description'));
636 $writer->addColumn($this->lng->txt(
'ecs_imported_from'));
637 $writer->addColumn($this->lng->txt(
'ecs_field_courseID'));
638 $writer->addColumn($this->lng->txt(
'ecs_field_term'));
639 $writer->addColumn($this->lng->txt(
'ecs_field_lecturer'));
640 $writer->addColumn($this->lng->txt(
'ecs_field_courseType'));
641 $writer->addColumn($this->lng->txt(
'ecs_field_semester_hours'));
642 $writer->addColumn($this->lng->txt(
'ecs_field_credits'));
643 $writer->addColumn($this->lng->txt(
'ecs_field_room'));
644 $writer->addColumn($this->lng->txt(
'ecs_field_cycle'));
645 $writer->addColumn($this->lng->txt(
'ecs_field_begin'));
646 $writer->addColumn($this->lng->txt(
'ecs_field_end'));
647 $writer->addColumn($this->lng->txt(
'last_update'));
649 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
652 foreach($obj_ids as $obj_id)
654 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
662 if(
$reader and ($participant =
$reader->getParticipantByMID($mid)))
664 $writer->addColumn($participant->getParticipantName());
666 $field = $settings->getMappingByECSName(
'courseID');
667 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
669 $field = $settings->getMappingByECSName(
'term');
670 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
672 $field = $settings->getMappingByECSName(
'lecturer');
673 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
675 $field = $settings->getMappingByECSName(
'courseType');
676 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
678 $field = $settings->getMappingByECSName(
'semester_hours');
679 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
681 $field = $settings->getMappingByECSName(
'credits');
682 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
684 $field = $settings->getMappingByECSName(
'room');
685 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
687 $field = $settings->getMappingByECSName(
'cycle');
688 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
690 $field = $settings->getMappingByECSName(
'begin');
693 $field = $settings->getMappingByECSName(
'end');
696 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
711 $this->tabs_gui->setSubTabActive(
'ecs_released');
713 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
716 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ecs_released.html',
'Services/WebServices/ECS');
720 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
721 $this->tpl->setCurrentBlock(
"btn_cell");
722 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"exportReleased"));
723 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"csv_export"));
724 $this->tpl->parseCurrentBlock();
729 $this->tpl->setCurrentBlock(
"btn_cell");
730 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,
'readAll'));
731 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
'ecs_read_remote_links'));
732 $this->tpl->parseCurrentBlock();
736 include_once(
'Services/WebServices/ECS/classes/class.ilECSReleasedContentTableGUI.php');
739 $table_gui->setTitle($this->lng->txt(
'ecs_released_content'));
740 $table_gui->parse($exported);
741 $this->tpl->setVariable(
'TABLE_REL',$table_gui->getHTML());
755 global $ilObjDataCache;
757 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
759 $ilObjDataCache->preloadObjectCache($exported);
761 include_once(
'Services/Utilities/classes/class.ilCSVWriter.php');
764 $writer->addColumn($this->lng->txt(
'title'));
765 $writer->addColumn($this->lng->txt(
'description'));
766 $writer->addColumn($this->lng->txt(
'ecs_field_courseID'));
767 $writer->addColumn($this->lng->txt(
'ecs_field_term'));
768 $writer->addColumn($this->lng->txt(
'ecs_field_lecturer'));
769 $writer->addColumn($this->lng->txt(
'ecs_field_courseType'));
770 $writer->addColumn($this->lng->txt(
'ecs_field_semester_hours'));
771 $writer->addColumn($this->lng->txt(
'ecs_field_credits'));
772 $writer->addColumn($this->lng->txt(
'ecs_field_room'));
773 $writer->addColumn($this->lng->txt(
'ecs_field_cycle'));
774 $writer->addColumn($this->lng->txt(
'ecs_field_begin'));
775 $writer->addColumn($this->lng->txt(
'ecs_field_end'));
776 $writer->addColumn($this->lng->txt(
'last_update'));
778 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
781 foreach($exported as $obj_id)
783 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
790 $field = $settings->getMappingByECSName(
'courseID');
791 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
793 $field = $settings->getMappingByECSName(
'term');
794 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
796 $field = $settings->getMappingByECSName(
'lecturer');
797 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
799 $field = $settings->getMappingByECSName(
'courseType');
800 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
802 $field = $settings->getMappingByECSName(
'semester_hours');
803 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
805 $field = $settings->getMappingByECSName(
'credits');
806 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
808 $field = $settings->getMappingByECSName(
'room');
809 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
811 $field = $settings->getMappingByECSName(
'cycle');
812 $writer->addColumn(isset($values[$field]) ? $values[$field] :
'');
814 $field = $settings->getMappingByECSName(
'begin');
817 $field = $settings->getMappingByECSName(
'end');
820 $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
834 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
836 $options[0] = $this->lng->txt(
'ecs_ignore_field');
837 foreach($fields as $field)
841 $options[$field->getFieldId()] =
$title.
': '.$field->getTitle();
855 include_once(
'Services/WebServices/ECS/classes/class.ilECSSettings.php');
866 $this->tabs_gui->clearSubTabs();
868 $this->tabs_gui->addSubTabTarget(
"ecs_settings",
869 $this->ctrl->getLinkTarget($this,
'settings'),
870 "settings",get_class($this));
878 $this->tabs_gui->addSubTabTarget(
"ecs_communities",
879 $this->ctrl->getLinkTarget($this,
'communities'),
880 "communities",get_class($this));
882 $this->tabs_gui->addSubTabTarget(
'ecs_mappings',
883 $this->ctrl->getLinkTarget($this,
'mappings'),
884 'mappings',get_class($this));
886 $this->tabs_gui->addSubTabTarget(
'ecs_import',
887 $this->ctrl->getLinkTarget($this,
'imported'));
889 $this->tabs_gui->addSubTabTarget(
'ecs_released',
890 $this->ctrl->getLinkTarget($this,
'released'));
901 global $rbacreview,$ilObjDataCache;
908 $select[0] = $this->lng->txt(
'links_select_one');
909 foreach($global_roles as $role_id)
919 include_once
'./classes/class.ilLocatorGUI.php';
922 $loc->setTextOnly(
false);
923 $loc->addContextItems($a_ref_id);
925 return $loc->getHTML();