diff options
| author | Arne Schröder, M. A. <schroeder@data-quest.de> | 2025-10-22 11:15:24 +0000 |
|---|---|---|
| committer | Rasmus Fuhse <fuhse@data-quest.de> | 2025-10-22 11:15:24 +0000 |
| commit | 3112b8ff9dd5e8c335cffb940d3cd7a2f3b8cbd7 (patch) | |
| tree | 727bb72991b7af3e1dd18802ad14c7137eec669c | |
| parent | 2a1d58f4e011c1118a6a034fc0677d8bbc44cb5d (diff) | |
Resolve "ILIAS-Schnittstelle: Kategoriename lässt sich nach erster Eingabe nicht mehr anpassen"
Closes #5901
Merge request studip/studip!4497
| -rw-r--r-- | app/views/admin/ilias_interface/edit_content.php | 8 | ||||
| -rw-r--r-- | app/views/admin/ilias_interface/edit_permissions.php | 2 | ||||
| -rw-r--r-- | app/views/my_ilias_accounts/index.php | 2 | ||||
| -rw-r--r-- | lib/ilias_interface/ConnectedIlias.php | 43 |
4 files changed, 24 insertions, 31 deletions
diff --git a/app/views/admin/ilias_interface/edit_content.php b/app/views/admin/ilias_interface/edit_content.php index 5cd2b89..b7e3e5b 100644 --- a/app/views/admin/ilias_interface/edit_content.php +++ b/app/views/admin/ilias_interface/edit_content.php @@ -12,8 +12,8 @@ <input type="hidden" name="ilias_content_settings" size="50" maxlength="255" value="1"> <label> <span class="required"><?= _('Name oder ID der Wurzelkategorie für Stud.IP-Daten') ?></span> - <? if (!empty($ilias_config['root_category_name'])) : ?> - <div><?= htmlReady($ilias_config['root_category_name']) ?></div> + <? if (!empty($ilias_config['root_category'])) : ?> + <div><?= htmlReady($ilias_config['root_category_name']) ?> <?= htmlReady(sprintf(_('(ID %s)'), $ilias_config['root_category']))?></div> <? else : ?> <input type="text" name="ilias_root_category_name" size="50" maxlength="255" value="<?= empty($ilias_config['root_category_name']) ? '' : htmlReady($ilias_config['root_category_name']) ?>" required> <? endif ?> @@ -24,7 +24,7 @@ <div><?= _('User_daten').' (ID '.htmlReady($ilias_config['user_data_category']).')'?></div> </label> <? endif ?> - <? if ($ilias_interface_config['create_category']) : ?> + <? if (!empty($ilias_interface_config['create_category'])) : ?> <label> <input type="checkbox" name="ilias_category_create_on_add_module" value="1" <?= !empty($ilias_config['category_create_on_add_module']) ? 'checked' : '' ?>> <span><?= _('Persönliche ILIAS-Kategorie erst erzeugen, wenn Lernobjekte angelegt werden') ?></span> @@ -126,7 +126,7 @@ <span><?= _('Kategorie mit Arbeitsbereichen') ?> <?=!empty($ilias_config['workgroup_category']) ? htmlReady(sprintf(_('(ID %s)'), $ilias_config['workgroup_category'])) : ''?></span> <input type="text" name="ilias_workgroup_category_name" size="50" maxlength="255" value="<?= empty($ilias_config['workgroup_category_name']) ? '' : htmlReady($ilias_config['workgroup_category_name']) ?>"> </label> - <? if ($ilias_interface_config['create_objects']) : ?> + <? if (!empty($ilias_interface_config['create_objects'])) : ?> <label> <span> <?= _('Module') ?></span> </label> diff --git a/app/views/admin/ilias_interface/edit_permissions.php b/app/views/admin/ilias_interface/edit_permissions.php index 629592cb..b6b6f21 100644 --- a/app/views/admin/ilias_interface/edit_permissions.php +++ b/app/views/admin/ilias_interface/edit_permissions.php @@ -13,7 +13,7 @@ </legend> <label> <span class="required"><?= _('Name oder ID des Rollen-Templates zum Erstellen von Lernobjekten') ?></span> - <input type="text" name="ilias_author_role_name" size="50" maxlength="255" value="<?= $ilias_config['author_role_name'] ? htmlReady($ilias_config['author_role_name']) : 'Author' ?>" required> + <input type="text" name="ilias_author_role_name" size="50" maxlength="255" value="<?= !empty($ilias_config['author_role']) ? htmlReady($ilias_config['author_role_name']) : 'Author' ?>" required> </label> <label> <span class="required"><?= _('Erforderliche Rechtestufe zum Erstellen von Lernobjekten') ?></span> diff --git a/app/views/my_ilias_accounts/index.php b/app/views/my_ilias_accounts/index.php index 76668be..d50271b 100644 --- a/app/views/my_ilias_accounts/index.php +++ b/app/views/my_ilias_accounts/index.php @@ -4,7 +4,7 @@ <table class="default"> <caption> <?= sprintf(_('Meine Lernobjekte in %s'), $ilias->getName()) ?> - <? if ($ilias_interface_config['create_objects']) : ?> + <? if (!empty($ilias_interface_config['create_objects'])) : ?> <span class="actions"> <a href="<?= $controller->url_for('my_ilias_accounts/add_object/'.$ilias_index) ?>" data-dialog="size=auto"> <?= Icon::create('add', Icon::ROLE_CLICKABLE, tooltip2(_('Neues Lernobjekt anlegen'))) ?> diff --git a/lib/ilias_interface/ConnectedIlias.php b/lib/ilias_interface/ConnectedIlias.php index 440db21..057a70b 100644 --- a/lib/ilias_interface/ConnectedIlias.php +++ b/lib/ilias_interface/ConnectedIlias.php @@ -360,22 +360,20 @@ class ConnectedIlias // if an ID was entered, simply use it; else get the ID by title/name if ($this->ilias_config['root_category_name'] !== null) { if (is_numeric($this->ilias_config['root_category_name'])) { - $category = $this->ilias_config['root_category_name']; + $cat_object = $this->soap_client->getObjectByReference($this->ilias_config['root_category_name']); } else { - $category = $this->soap_client->getReferenceByTitle($this->ilias_config['root_category_name'], 'cat'); + $temp_category = $this->soap_client->getReferenceByTitle($this->ilias_config['root_category_name'], 'cat'); + $cat_object = $this->soap_client->getObjectByReference($temp_category); + } + if (!empty($cat_object['ref_id']) && $cat_object['type'] === 'cat') { + $category = $cat_object['ref_id']; + $this->ilias_config['root_category_name'] = $cat_object['title']; } } if (!$category) { $this->error[] = sprintf(_('Die Kategorie „%s“ wurde nicht gefunden.'), $this->ilias_config['root_category_name']); return false; } else { - // no ID entered manually - if ($this->ilias_config['root_category'] == null) { - $this->ilias_config['root_category'] = $category; - } else { - $this->ilias_config['root_category_name'] = $category['title']; - } - $this->ilias_config['root_category'] = $category; // check user data category if (! $this->ilias_config['user_data_category']) { @@ -425,31 +423,26 @@ class ConnectedIlias public function getPermissionsSettingsStatus() { // check role template - if (!$this->ilias_config['author_role_name']) { + if (empty($this->ilias_config['author_role_name'])) { $this->error[] = _("Das Rollen-Template für die persönliche Kategorie wurde noch nicht festgelegt."); - return false; - } - // if an ID was entered, simply use it; else check for title - if (!is_numeric($this->ilias_config['author_role_name'])) { - + } elseif (is_numeric($this->ilias_config['author_role_name'])) { + // if an ID was entered, simply use it; else check for title + $this->ilias_config['author_role'] = $this->ilias_config['author_role_name']; + $this->storeSettings(); + return true; + } else { $role_template = $this->soap_client->getObjectByTitle($this->ilias_config['author_role_name'], 'rolt'); if ($role_template == false) { $this->error[] = sprintf(_('Das Rollen-Template mit dem Namen „%1$s“ wurde im System %2$s nicht gefunden.'), htmlReady($this->ilias_config['author_role_name']), htmlReady($this->getName())); - return false; - } - if (is_array($role_template)) - { + } else if (is_array($role_template)) { $this->ilias_config['author_role'] = $role_template["obj_id"]; + $this->ilias_config['author_role_name'] = $role_template['title']; $this->storeSettings(); + return true; } - return true; - } else { - $this->ilias_config['author_role'] = 'object_id_' . $this->ilias_config['author_role_name']; - $this->storeSettings(); - return true; } - + return false; } /** |
