19declare(strict_types=1);
43 private \ILIAS\HTTP\Services
$http;
53 $this->tpl =
$DIC->ui()->mainTemplate();
54 $this->
lng = $DIC->language();
55 $this->
ctrl = $DIC->ctrl();
56 $this->tabs_gui =
$DIC->tabs();
57 $this->rbacreview =
$DIC->rbac()->review();
58 $this->log =
$DIC->logger()->wsrv();
59 $this->tree =
$DIC->repositoryTree();
60 $this->
access = $DIC->access();
61 $this->
toolbar = $DIC->toolbar();
62 $this->objDataCache =
$DIC[
'ilObjDataCache'];
63 $this->
user = $DIC->user();
64 $this->
http = $DIC->http();
66 $this->
lng->loadLanguageModule(
'ecs');
75 $next_class = $this->
ctrl->getNextClass($this);
76 $cmd = $this->
ctrl->getCmd();
79 switch ($next_class) {
80 case 'ilecsmappingsettingsgui':
82 $this->
ctrl->setReturn($this,
'communities');
83 $this->
ctrl->forwardCommand($mapset);
86 case 'ilecsparticipantsettingsgui':
88 (
int) $_REQUEST[
'server_id'],
89 (
int) $_REQUEST[
'mid']
91 $this->
ctrl->setReturn($this,
'communities');
92 $this->
ctrl->forwardCommand($part);
97 if ($cmd !==
"overview" && $cmd !==
"communities" && !$this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
98 $this->
ctrl->redirect($this,
"overview");
101 if (!$cmd || $cmd ===
'view') {
114 $this->tabs_gui->setSubTabActive(
'overview');
115 if ($this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
117 $this->
lng->txt(
'ecs_add_new_ecs'),
118 $this->ctrl->getLinkTarget($this,
'create')
126 $table->parse($servers);
127 $this->tpl->setContent($table->getHTML());
136 $this->
settings->setEnabledStatus(
true);
138 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
139 $this->
ctrl->redirect($this,
'overview');
148 $this->
settings->setEnabledStatus(
false);
150 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
151 $this->
ctrl->redirect($this,
'overview');
167 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'ecs_remote_imported'));
172 $this->tpl->setOnScreenMessage(
'info',
'Cannot connect to ECS server: ' . $e1->getMessage());
175 $this->tpl->setOnScreenMessage(
'info',
'Update failed: ' . $e2->getMessage());
188 $this->tabs_gui->clearTargets();
189 $this->tabs_gui->clearSubTabs();
190 $this->tabs_gui->setBackTarget($this->
lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'overview'));
193 $this->tabs_gui->setSubTabActive(
'ecs_settings');
195 $this->tpl->setContent($this->
form->getHTML());
201 protected function edit(): void
204 $this->
ctrl->saveParameter($this,
'server_id');
206 $this->tabs_gui->clearTargets();
207 $this->tabs_gui->clearSubTabs();
208 $this->tabs_gui->setBackTarget($this->
lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'overview'));
211 $this->tabs_gui->setSubTabActive(
'ecs_settings');
213 $this->tpl->setContent($this->
form->getHTML());
216 protected function cp(): void
223 $this->
ctrl->setParameter($this,
'server_id', $copy->getServerId());
224 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'ecs_settings_cloned'),
true);
225 $this->
ctrl->redirect($this,
'edit');
231 protected function delete():
void
235 $this->tabs_gui->clearTargets();
236 $this->tabs_gui->clearSubTabs();
237 $this->tabs_gui->setBackTarget($this->
lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'overview'));
240 $confirm->setFormAction($this->
ctrl->getFormAction($this));
241 $confirm->setConfirm($this->
lng->txt(
'delete'),
'doDelete');
242 $confirm->setCancel($this->
lng->txt(
'cancel'),
'overview');
243 $confirm->setHeaderText($this->
lng->txt(
'ecs_delete_setting'));
245 $confirm->addItem(
'',
'', $this->
settings->getServer());
246 $confirm->addHiddenItem(
'server_id', (
string) $this->
settings->getServerId());
248 $this->tpl->setContent($confirm->getHTML());
258 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'ecs_setting_deleted'),
true);
259 $this->
ctrl->redirect($this,
'overview');
269 $this->tabs_gui->setSubTabActive(
'ecs_settings');
271 $this->tpl->setContent($this->
form->getHTML());
279 if (isset($this->
form) && is_object($this->
form)) {
284 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'settings'));
285 $this->
form->setTitle($this->
lng->txt(
'ecs_connection_settings'));
288 $ena->setChecked($this->
settings->isEnabled());
290 $this->
form->addItem($ena);
292 $server_title =
new ilTextInputGUI($this->
lng->txt(
'ecs_server_title'),
'title');
293 $server_title->setValue($this->
settings->getTitle());
294 $server_title->setSize(80);
295 $server_title->setMaxLength(128);
296 $server_title->setRequired(
true);
297 $this->
form->addItem($server_title);
300 $ser->setValue((
string) $this->
settings->getServer());
301 $ser->setRequired(
true);
302 $this->
form->addItem($ser);
306 #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'),
307 # ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https')));
309 $pro->setValue($this->
settings->getProtocol());
310 $pro->setRequired(
true);
311 $this->
form->addItem($pro);
315 $por->setMaxLength(5);
316 $por->setValue((
string) $this->
settings->getPort());
317 $por->setRequired(
true);
318 $this->
form->addItem($por);
321 $tcer->setValue((
string) $this->
settings->getAuthType());
322 $this->
form->addItem($tcer);
326 $tcer->addOption($cert_based);
330 $cli->setValue((
string) $this->
settings->getClientCertPath());
331 $cli->setRequired(
true);
332 $cert_based->addSubItem($cli);
336 $key->setValue((
string) $this->
settings->getKeyPath());
337 $key->setRequired(
true);
338 $cert_based->addSubItem($key);
342 $cerp->setValue((
string) $this->
settings->getKeyPassword());
343 $cerp->setInputType(
'password');
344 $cerp->setRequired(
true);
345 $cert_based->addSubItem($cerp);
349 $cer->setValue((
string) $this->
settings->getCACertPath());
350 $cer->setRequired(
true);
351 $cert_based->addSubItem($cer);
355 $tcer->addOption($apa_based);
360 $user->setRequired(
true);
361 $apa_based->addSubItem(
$user);
364 $pass->setRetype(
false);
366 $pass->setMaxLength(128);
367 $pass->setValue($this->
settings->getAuthPass());
368 $pass->setRequired(
true);
369 $pass->setSkipSyntaxCheck(
true);
370 $apa_based->addSubItem($pass);
374 $ser->setValue($this->
settings->getCertSerialNumber() ?: $this->lng->txt(
'ecs_no_value'));
375 $cert_based->addSubItem($ser);
378 $loc->setTitle($this->
lng->txt(
'ecs_local_settings'));
379 $this->
form->addItem($loc);
382 $imp->setRequired(
true);
384 $tpl =
new ilTemplate(
'tpl.ecs_import_id_form.html',
true,
true,
'components/ILIAS/WebServices/ECS');
390 if ($this->
settings->getImportId()) {
393 $imp->setAlert($this->
lng->txt(
'err_check_input'));
400 $imp->setInfo($this->
lng->txt(
'ecs_import_id_info'));
401 $this->
form->addItem($imp);
404 $loc->setTitle($this->
lng->txt(
'ecs_remote_user_settings'));
405 $this->
form->addItem($loc);
409 $role->setValue($this->
settings->getGlobalRole());
410 $role->setInfo($this->
lng->txt(
'ecs_global_role_info'));
411 $role->setRequired(
true);
412 $this->
form->addItem($role);
415 $duration->setInfo($this->
lng->txt(
'ecs_account_duration_info'));
427 $loc->setTitle($this->
lng->txt(
'ecs_notifications'));
428 $this->
form->addItem($loc);
430 $rcp_user =
new ilTextInputGUI($this->
lng->txt(
'ecs_user_rcp'),
'user_recipients');
431 $rcp_user->setValue($this->
settings->getUserRecipientsAsString());
432 $rcp_user->setInfo($this->
lng->txt(
'ecs_user_rcp_info'));
433 $this->
form->addItem($rcp_user);
435 $rcp_econ =
new ilTextInputGUI($this->
lng->txt(
'ecs_econ_rcp'),
'econtent_recipients');
436 $rcp_econ->setValue($this->
settings->getEContentRecipientsAsString());
437 $rcp_econ->setInfo($this->
lng->txt(
'ecs_econ_rcp_info'));
438 $this->
form->addItem($rcp_econ);
440 $rcp_app =
new ilTextInputGUI($this->
lng->txt(
'ecs_approval_rcp'),
'approval_recipients');
441 $rcp_app->setValue($this->
settings->getApprovalRecipientsAsString());
442 $rcp_app->setInfo($this->
lng->txt(
'ecs_approval_rcp_info'));
443 $this->
form->addItem($rcp_app);
445 if ($a_mode ===
'update') {
446 $this->
form->addCommandButton(
'update', $this->
lng->txt(
'save'));
448 $this->
form->addCommandButton(
'save', $this->
lng->txt(
'save'));
450 $this->
form->addCommandButton(
'overview', $this->
lng->txt(
'cancel'));
461 if (!$error = $this->
settings->validate()) {
463 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'),
true);
465 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($error));
475 protected function save(): void
480 if (!$error = $this->
settings->validate()) {
483 #$this->updateTitle();
484 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'),
true);
486 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($error));
488 $this->
ctrl->redirect($this,
'overview');
499 foreach ($reader->getCommunities() as $community) {
500 foreach ($community->getParticipants() as $part) {
501 $this->log->dump($community);
502 if ($part->isSelf()) {
503 $this->
settings->setTitle($part->getParticipantName());
510 $this->tpl->setOnScreenMessage(
'failure', $exc->getMessage());
532 $this->
settings->setGlobalRole((
int) $_POST[
'global_role']);
533 $this->
settings->setDuration((
int) $_POST[
'duration'][
'MM']);
538 $this->
settings->setAuthType((
int) $_POST[
'auth_type']);
554 if (!$creader->getParticipantByMID($mid)) {
555 $this->log->notice(
'Deleting deprecated participant: ' .
$server->getServerId() .
' ' . $mid);
561 $this->tpl->setOnScreenMessage(
'failure',
$server->getServer() .
': ' .
$e->getMessage(),
true);
564 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
565 $this->
ctrl->redirect($this,
'communities');
573 $tpl = new \ilTemplate(
574 'tpl.ecs_communities.html',
577 'components/ILIAS/WebServices/ECS'
581 if ($this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
583 $this->
lng->txt(
'ecs_refresh_participants'),
584 $this->ctrl->getLinkTarget($this,
'refreshParticipants')
589 $this->tabs_gui->setSubTabActive(
'ecs_communities');
593 if ($this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
606 foreach ($reader->getCommunities() as $community) {
609 $table_gui->setTitle($community->getTitle() .
' (' . $community->getDescription() .
')');
610 $table_gui->parse($community->getParticipants());
625 $this->tpl->setContent(
$tpl->
get());
635 foreach ((array) $import_types as $sid =>
$server) {
636 foreach ((array)
$server as $mid => $import_type) {
648 foreach ((array) $import_types as $sid =>
$server) {
649 foreach ((array)
$server as $mid => $import_type) {
653 $new_types[$sid][$mid] = $import_type;
675 foreach ($cReader->getCommunities() as $community) {
677 $cCache->setCommunityName($community->getTitle());
678 $cCache->setMids($community->getMids());
679 $cCache->setOwnId($community->getOwnId());
682 }
catch (Exception
$e) {
683 $this->log->error(
'Cannot read ecs communities: ' .
$e->getMessage());
686 foreach ((array)
$_POST[
'sci_mid'] as $sid => $mids) {
687 $this->log->info(
"server id is " . print_r($sid,
true));
688 foreach ((array) $mids as $mid => $value) {
690 #$set->enableExport(array_key_exists($mid, (array) $_POST['export'][$sid]) ? true : false);
691 #$set->enableImport(array_key_exists($mid, (array) $_POST['import'][$sid]) ? true : false);
692 if ($validatedImportTypes) {
693 $set->setImportType((
int) $validatedImportTypes[$sid][$mid]);
695 $set->setImportType((
int)
$_POST[
'import_type'][$sid][$mid]);
702 $set->setTitle($part->getParticipantName());
706 $set->setCommunityName($com->getTitle());
708 }
catch (Exception
$e) {
709 $this->log->error(
'Cannot read ecs communities: ' .
$e->getMessage());
715 if ($validatedImportTypes) {
716 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'ecs_invalid_import_type_cms'),
true);
718 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
720 $this->
ctrl->redirect($this,
'communities');
730 $this->tabs_gui->clearTargets();
731 $this->tabs_gui->clearSubTabs();
733 $this->tabs_gui->setBackTarget(
734 $this->
lng->txt(
'ecs_settings'),
735 $this->ctrl->getLinkTarget($this,
'overview')
737 if ($this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
738 $this->tabs_gui->addTab(
740 $this->
lng->txt(
'ecs_tab_import'),
741 $this->ctrl->getLinkTarget($this,
'importMappings')
744 $this->tabs_gui->addTab(
746 $this->
lng->txt(
'ecs_tab_export'),
747 $this->ctrl->getLinkTarget($this,
'exportMappings')
753 $this->tabs_gui->activateTab(
'import');
757 $this->tabs_gui->activateTab(
'export');
770 if (!count($fields)) {
771 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'ecs_no_adv_md'));
777 $sel_srv = (
int) $_REQUEST[
"ecs_mapping_server"];
780 $options = array(0 => $this->
lng->txt(
"please_choose"));
784 $title =
"ECS (" .
$server->getServerId() .
")";
786 $options[
$server->getServerId()] = $title;
790 $sel->setOptions($options);
791 $sel->setValue($sel_srv);
792 $this->
toolbar->addInputItem($sel);
794 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
"importMappings"));
795 $this->
toolbar->addFormButton($this->
lng->txt(
"submit"),
"importMappings");
811 if (!count($fields)) {
812 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'ecs_no_adv_md'));
818 $sel_srv = (
int) $_REQUEST[
"ecs_mapping_server"];
821 $options = array(0 => $this->
lng->txt(
"please_choose"));
825 $title =
"ECS (" .
$server->getServerId() .
")";
827 $options[
$server->getServerId()] = $title;
831 $sel->setOptions($options);
832 $sel->setValue($sel_srv);
833 $this->
toolbar->addInputItem($sel);
835 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
"exportMappings"));
836 $this->
toolbar->addFormButton($this->
lng->txt(
"submit"),
"exportMappings");
849 foreach ((array)
$_POST[
'mapping'] as $mtype => $mappings) {
850 foreach ((array) $mappings as $ecs_field => $advmd_id) {
852 (
int) $_REQUEST[
'ecs_mapping_server'],
856 $map->setAdvMDId((
int) $advmd_id);
861 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'),
true);
862 $this->
ctrl->setParameter($this,
"ecs_mapping_server", (
int)
$_POST[
'ecs_mapping_server']);
863 $this->
ctrl->redirect($this,
'importMappings');
871 foreach ((array)
$_POST[
'mapping'] as $mtype => $mappings) {
872 foreach ((array) $mappings as $ecs_field => $advmd_id) {
874 (
int)
$_POST[
'ecs_mapping_server'],
878 $map->setAdvMDId((
int) $advmd_id);
883 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'),
true);
884 $this->
ctrl->setParameter($this,
"ecs_mapping_server", (
int)
$_POST[
'ecs_mapping_server']);
885 $this->
ctrl->redirect($this,
'exportMappings');
897 if ($mapping_type === self::MAPPING_IMPORT) {
902 $form->
setTitle($this->
lng->txt(
'ecs_mapping_exp_tbl'));
909 if ($mapping_type === self::MAPPING_IMPORT) {
919 foreach ($optional as $field_name) {
920 if ($mapping_type === self::MAPPING_IMPORT) {
922 $this->
lng->txt(
'ecs_field_' . $field_name),
927 $mapping_settings->getMappingByECSName(
932 $select->setOptions($options);
933 $assignments->addSubItem($select);
936 $this->
lng->txt(
'ecs_field_' . $field_name),
940 (
string) $mapping_settings->getMappingByECSName(
945 $select->setOptions($options);
951 $server->setValue((
string) $a_server_id);
956 if ($mapping_type === self::MAPPING_EXPORT) {
968 foreach ($optional as $field_name) {
970 $this->
lng->txt(
'ecs_field_' . $field_name),
974 $mapping_settings->getMappingByECSName(
979 $select->setOptions($options);
980 $rcrs->addSubItem($select);
990 $this->tabs_gui->setSubTabActive(
'ecs_category_mapping');
991 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.category_mapping.html',
'components/ILIAS/WebServices/ECS');
997 $this->tpl->setVariable(
'NEW_RULE_TABLE', $this->
form->getHTML());
999 $this->tpl->setVariable(
'RULES_TABLE', $html);
1011 if ($this->
form->checkInput()) {
1012 $this->rule->setContainerId((
int) $this->
form->getInput(
'import_id'));
1013 $this->rule->setFieldName($this->
form->getInput(
'field'));
1014 $this->rule->setMappingType((
int) $this->
form->getInput(
'type'));
1016 switch ($this->
form->getInput(
'type')) {
1018 $this->rule->setMappingValue($this->
form->getInput(
'mapping_value'));
1022 if ($this->
form->getItemByPostVar(
'dur_begin')) {
1023 $this->rule->setDateRangeStart($this->
form->getItemByPostVar(
'dur_begin')->getDate());
1025 if ($this->
form->getItemByPostVar(
'dur_end')) {
1026 $this->rule->setDateRangeEnd($this->
form->getItemByPostVar(
'dur_end')->getDate());
1031 $this->rule->setByType($this->
form->getInput(
'by_type'));
1035 if ($err = $this->rule->validate()) {
1036 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($err));
1037 $this->
form->setValuesByPost();
1042 $this->rule->save();
1043 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'));
1048 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'err_check_input'));
1049 $this->
form->setValuesByPost();
1059 if (!$_REQUEST[
'rule_id']) {
1060 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
1065 $this->tabs_gui->setSubTabActive(
'ecs_category_mapping');
1066 $this->
ctrl->saveParameter($this,
'rule_id');
1067 $this->
initRule((
int) $_REQUEST[
'rule_id']);
1070 $this->tpl->setContent($this->
form->getHTML());
1079 if (!$_REQUEST[
'rule_id']) {
1080 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
1084 $this->
ctrl->saveParameter($this,
'rule_id');
1085 $this->
initRule((
int) $_REQUEST[
'rule_id']);
1087 if ($this->
form->checkInput()) {
1088 $this->rule->setContainerId((
int) $this->
form->getInput(
'import_id'));
1089 $this->rule->setFieldName($this->
form->getInput(
'field'));
1090 $this->rule->setMappingType((
int) $this->
form->getInput(
'type'));
1093 switch ($this->
form->getInput(
'type')) {
1095 $this->rule->setMappingValue($this->
form->getInput(
'mapping_value'));
1099 if ($this->
form->getItemByPostVar(
'dur_begin')) {
1100 $this->rule->setDateRangeStart($this->
form->getItemByPostVar(
'dur_begin')->getDate());
1102 if ($this->
form->getItemByPostVar(
'dur_end')) {
1103 $this->rule->setDateRangeEnd($this->
form->getItemByPostVar(
'dur_end')->getDate());
1108 $this->rule->setByType($this->
form->getInput(
'by_type'));
1112 if ($err = $this->rule->validate()) {
1113 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($err));
1114 $this->
form->setValuesByPost();
1119 $this->rule->update();
1120 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'),
true);
1121 $this->
ctrl->redirect($this,
'categoryMapping');
1124 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'err_check_input'));
1125 $this->
form->setValuesByPost();
1136 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'));
1140 foreach (
$_POST[
'rules'] as $rule_id) {
1144 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'settings_saved'));
1156 return $rule_table->getHTML();
1165 if (isset($this->rule) && is_object($this->rule)) {
1177 if (is_object($this->
form)) {
1183 if ($a_mode ===
'add') {
1184 $this->
form->setTitle($this->
lng->txt(
'ecs_new_category_mapping'));
1185 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'categoryMapping'));
1186 $this->
form->addCommandButton(
'addCategoryMapping', $this->
lng->txt(
'save'));
1188 $this->
form->setTitle($this->
lng->txt(
'ecs_edit_category_mapping'));
1189 $this->
form->setFormAction($this->
ctrl->getFormAction($this,
'editCategoryMapping'));
1190 $this->
form->addCommandButton(
'updateCategoryMapping', $this->
lng->txt(
'save'));
1192 $this->
form->addCommandButton(
'categoryMapping', $this->
lng->txt(
'cancel'));
1195 $imp->setRequired(
true);
1197 $tpl =
new ilTemplate(
'tpl.ecs_import_id_form.html',
true,
true,
'components/ILIAS/WebServices/ECS');
1203 if ($this->rule->getContainerId()) {
1208 $imp->setInfo($this->
lng->txt(
'ecs_import_id_info'));
1209 $this->
form->addItem($imp);
1212 $select->setValue($this->rule->getFieldName());
1213 $select->setRequired(
true);
1215 $this->
form->addItem($select);
1219 $value->setValue((
string) $this->rule->getMappingType());
1220 $value->setRequired(
true);
1223 $fixed->setInfo($this->
lng->txt(
'ecs_cat_mapping_fixed_info'));
1225 $fixed_val =
new ilTextInputGUI($this->
lng->txt(
'ecs_cat_mapping_values'),
'mapping_value');
1226 $fixed_val->setValue($this->rule->getMappingValue());
1227 $fixed_val->setMaxLength(255);
1228 $fixed_val->setSize(40);
1229 $fixed_val->setRequired(
true);
1230 $fixed->addSubItem($fixed_val);
1232 $value->addOption($fixed);
1235 $duration->setInfo($this->
lng->txt(
'ecs_cat_mapping_duration_info'));
1238 $dur_start->setRequired(
true);
1239 $dur_start->setDate($this->rule->getDateRangeStart());
1243 $dur_end->setRequired(
true);
1244 $dur_end->setDate($this->rule->getDateRangeEnd());
1250 $type->setInfo($this->
lng->txt(
'ecs_cat_mapping_by_type_info'));
1255 $types->setOptions($options);
1256 $types->setValue($this->rule->getByType());
1257 $types->setRequired(
true);
1258 $type->addSubitem($types);
1260 $value->addOption($type);
1262 $this->
form->addItem($value);
1271 $this->tabs_gui->setSubTabActive(
'ecs_import');
1275 $this->
lng->txt(
'ecs_read_remote_links'),
1276 $this->ctrl->getLinkTarget($this,
'readAll')
1279 $this->
toolbar->addSeparator();
1283 $sel_type = $_REQUEST[
"otype"];
1291 $sel->setOptions($options);
1292 $sel->setValue($sel_type);
1293 $this->
toolbar->addInputItem($sel);
1295 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
"imported"));
1296 $this->
toolbar->addFormButton($this->
lng->txt(
"submit"),
"imported");
1299 if (count($robjs)) {
1300 $this->
toolbar->addSeparator();
1303 $this->
lng->txt(
'csv_export'),
1304 $this->ctrl->getLinkTarget($this,
'exportImported')
1308 $table_gui->setTitle($this->
lng->txt(
'ecs_imported_content'));
1309 $table_gui->parse($robjs);
1310 $this->tpl->setContent($table_gui->getHTML());
1332 $this->objDataCache->preloadReferenceCache($rcourses);
1334 foreach ($rcourses as $rcrs_ref_id) {
1335 $obj_id = $this->objDataCache->lookupObjId((
int) $rcrs_ref_id);
1336 $obj_ids[$obj_id] = $obj_id;
1341 $writer->addColumn($this->
lng->txt(
'title'));
1342 $writer->addColumn($this->
lng->txt(
'description'));
1343 $writer->addColumn($this->
lng->txt(
'ecs_imported_from'));
1344 $writer->addColumn($this->
lng->txt(
'ecs_field_courseID'));
1345 $writer->addColumn($this->
lng->txt(
'ecs_field_term'));
1346 $writer->addColumn($this->
lng->txt(
'ecs_field_lecturer'));
1347 $writer->addColumn($this->
lng->txt(
'ecs_field_courseType'));
1348 $writer->addColumn($this->
lng->txt(
'ecs_field_semester_hours'));
1349 $writer->addColumn($this->
lng->txt(
'ecs_field_credits'));
1350 $writer->addColumn($this->
lng->txt(
'ecs_field_room'));
1351 $writer->addColumn($this->
lng->txt(
'ecs_field_cycle'));
1352 $writer->addColumn($this->
lng->txt(
'ecs_field_begin'));
1353 $writer->addColumn($this->
lng->txt(
'ecs_field_end'));
1354 $writer->addColumn($this->
lng->txt(
'last_update'));
1359 foreach ($obj_ids as $obj_id) {
1367 $mid = $rcourse->getMID();
1368 if ($reader && ($participant = $reader->getParticipantByMID($mid))) {
1369 $writer->addColumn($participant->getParticipantName());
1372 $writer->addColumn($values[$field] ??
'');
1375 $writer->addColumn($values[$field] ??
'');
1378 $writer->addColumn($values[$field] ??
'');
1381 $writer->addColumn($values[$field] ??
'');
1384 $writer->addColumn($values[$field] ??
'');
1387 $writer->addColumn($values[$field] ??
'');
1390 $writer->addColumn($values[$field] ??
'');
1393 $writer->addColumn($values[$field] ??
'');
1397 if (isset($values[$field])) {
1401 $writer->addColumn($dt);
1405 if (isset($values[$field])) {
1409 $writer->addColumn($dt);
1411 $writer->addColumn($this->objDataCache->lookupLastUpdate((
int) $obj_id));
1415 $this->
http->saveResponse($this->
http
1417 ->withAddedHeader(
'Content-Type',
'text/csv')
1418 ->withAddedHeader(
'Content-Disposition',
'attachment; filename="' . date(
"Y_m_d") .
'_ecs_import.csv' .
'"')
1419 ->withBody($stream));
1420 $this->
http->sendResponse();
1421 $this->
http->close();
1429 $this->tabs_gui->setSubTabActive(
'ecs_released');
1431 if ($this->
settings->isEnabled()) {
1433 $this->
lng->txt(
'ecs_read_remote_links'),
1434 $this->ctrl->getLinkTarget($this,
'readAll')
1437 $this->
toolbar->addSeparator();
1440 $sel_type = $_REQUEST[
"otype"];
1448 $sel->setOptions($options);
1449 $sel->setValue($sel_type);
1450 $this->
toolbar->addInputItem($sel);
1452 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
"released"));
1453 $this->
toolbar->addFormButton($this->
lng->txt(
"submit"),
"released");
1456 if (count($exported)) {
1457 $this->
toolbar->addSeparator();
1460 $this->
lng->txt(
'csv_export'),
1461 $this->ctrl->getLinkTarget($this,
'exportReleased')
1466 $table_gui->setTitle($this->
lng->txt(
'ecs_released_content'));
1467 $table_gui->parse($exported);
1468 $this->tpl->setContent($table_gui->getHTML());
1477 $this->objDataCache->preloadObjectCache($exported);
1481 $writer->addColumn($this->
lng->txt(
'title'));
1482 $writer->addColumn($this->
lng->txt(
'description'));
1483 $writer->addColumn($this->
lng->txt(
'ecs_field_courseID'));
1484 $writer->addColumn($this->
lng->txt(
'ecs_field_term'));
1485 $writer->addColumn($this->
lng->txt(
'ecs_field_lecturer'));
1486 $writer->addColumn($this->
lng->txt(
'ecs_field_courseType'));
1487 $writer->addColumn($this->
lng->txt(
'ecs_field_semester_hours'));
1488 $writer->addColumn($this->
lng->txt(
'ecs_field_credits'));
1489 $writer->addColumn($this->
lng->txt(
'ecs_field_room'));
1490 $writer->addColumn($this->
lng->txt(
'ecs_field_cycle'));
1491 $writer->addColumn($this->
lng->txt(
'ecs_field_begin'));
1492 $writer->addColumn($this->
lng->txt(
'ecs_field_end'));
1493 $writer->addColumn($this->
lng->txt(
'last_update'));
1497 foreach ($exported as $obj_id) {
1504 $field =
$settings->getMappingByECSName(0,
'courseID');
1505 $writer->addColumn($values[$field] ??
'');
1507 $field =
$settings->getMappingByECSName(0,
'term');
1508 $writer->addColumn($values[$field] ??
'');
1510 $field =
$settings->getMappingByECSName(0,
'lecturer');
1511 $writer->addColumn($values[$field] ??
'');
1513 $field =
$settings->getMappingByECSName(0,
'courseType');
1514 $writer->addColumn($values[$field] ??
'');
1516 $field =
$settings->getMappingByECSName(0,
'semester_hours');
1517 $writer->addColumn($values[$field] ??
'');
1519 $field =
$settings->getMappingByECSName(0,
'credits');
1520 $writer->addColumn($values[$field] ??
'');
1522 $field =
$settings->getMappingByECSName(0,
'room');
1523 $writer->addColumn($values[$field] ??
'');
1525 $field =
$settings->getMappingByECSName(0,
'cycle');
1526 $writer->addColumn($values[$field] ??
'');
1528 $field =
$settings->getMappingByECSName(0,
'begin');
1530 if (isset($values[$field])) {
1534 $writer->addColumn($dt);
1536 $field =
$settings->getMappingByECSName(0,
'end');
1538 if (isset($values[$field])) {
1542 $writer->addColumn($dt);
1544 $writer->addColumn($this->objDataCache->lookupLastUpdate((
int) $obj_id));
1548 $this->
http->saveResponse($this->
http
1550 ->withAddedHeader(
'Content-Type',
'text/csv')
1551 ->withAddedHeader(
'Content-Disposition',
'attachment; filename="' . date(
"Y_m_d") .
'_ecs_export.csv' .
'"')
1552 ->withBody($stream));
1553 $this->
http->sendResponse();
1554 $this->
http->close();
1564 $options[0] = $this->
lng->txt(
'ecs_ignore_field');
1565 foreach ($fields as $field) {
1567 $options[$field->getFieldId()] = $title .
': ' . $field->getTitle();
1587 $this->tabs_gui->clearSubTabs();
1589 $this->tabs_gui->addSubTabTarget(
1591 $this->
ctrl->getLinkTarget($this,
'overview'),
1598 $this->tabs_gui->addSubTabTarget(
1600 $this->
ctrl->getLinkTarget($this,
'communities'),
1605 if ($this->
access->checkAccess(
'write',
'', (
int) $_REQUEST[
"ref_id"])) {
1606 $this->tabs_gui->addSubTabTarget(
1608 $this->
ctrl->getLinkTarget($this,
'importMappings'),
1613 $this->tabs_gui->addSubTabTarget(
1614 'ecs_category_mapping',
1615 $this->
ctrl->getLinkTarget($this,
'categoryMapping')
1618 $this->tabs_gui->addSubTabTarget(
1620 $this->
ctrl->getLinkTarget($this,
'imported')
1623 $this->tabs_gui->addSubTabTarget(
1625 $this->
ctrl->getLinkTarget($this,
'released')
1637 $this->rbacreview->getGlobalRoles(),
1643 $select[0] = $this->
lng->txt(
'links_select_one');
1644 foreach ($global_roles as $role_id) {
1652 if (!$this->tree->isInTree($a_ref_id) || $this->tree->isDeleted($a_ref_id)) {
1656 $loc->setTextOnly(
false);
1657 $loc->addContextItems($a_ref_id);
1659 return $loc->getHTML();
static ofString(string $string)
Creates a new stream with an initial value.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _lookupTitle(int $a_record_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
@classDescription Date and time handling
Defines a rule for the assignment of ECS remote courses to categories.
static getPossibleFields()
static getActiveRules()
get active rules
const MAPPING_IMPORT_RCRS
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
Reads ECS events and stores them in the database.
static getInstance()
Get the singelton instance of this ilECSExportManager.
Class for ECS node and directory mapping settings.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getInstance()
Get singleton instance.
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
initRule(int $a_rule_id=0)
Init rule.
updateCategoryMapping()
update category mapping
validateImportTypes(array $import_types)
Validate import types.
ilObjectDataCache $objDataCache
edit()
Edit server setting.
executeCommand()
Execute command.
initCategoryMappingForm($a_mode='add')
Init category mapping form.
editCategoryMapping()
Edit category mapping.
refreshParticipants()
Refresh participants.
create()
Create new settings.
overview()
List available servers.
released()
Show released materials.
saveExportMappings()
Save mappings.
updateTitle()
Update configuration title.
prepareFieldSelection($fields)
get options for field selection
activate()
activate server
communities()
show communities
exportMappings()
Show mapping settings (EContent-Data <-> (Remote)Course.
loadFromPost()
Load from post.
ilECSCategoryMappingRule $rule
readAll()
Read all importable econtent.
setMappingTabs(int $a_active)
Handle tabs for ECS data mapping.
prepareRoleSelect()
get global role array
updateCommunities()
update whitelist
ILIAS HTTP Services $http
initMappingsForm(int $a_server_id, int $mapping_type)
init mapping form
showRulesTable()
Show rules table.
initSettings(int $a_server_id=1)
Init settings.
ilGlobalTemplateInterface $tpl
exportImported()
csv export of imported remote courses
initSettingsForm($a_mode='update')
init settings form
addCategoryMapping()
save category mapping
deactivate()
activate server
imported()
Show imported materials.
importMappings()
Show mapping settings (EContent-Data <-> (Remote)Course.
saveImportMappings()
Save mappings.
exportReleased()
export released
deleteCategoryMappings()
Delete selected category mappings.
categoryMapping()
Category mappings.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
static getAdvancedMDValuesForObjId(int $a_obj_id)
Get advanced metadata values for object id.
static _getOptionalECourseFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
static _getOptionalEContentFields()
get optional econtent fields These fields might be mapped against AdvancedMetaData field definitions
static getPossibleReleaseTypes(bool $a_with_captions=false)
Get all possible release object types.
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
Base class for ILIAS Exception handling.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Component logger with individual log levels by component id.
This class represents a non editable value in a property form.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This class represents an option in a radio group.
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
static http()
Fetches the global http state from ILIAS.
form( $class_path, string $cmd, string $submit_caption="")