From 95ab6c39f277b2a8aca98dfa463855bac0cec4ee Mon Sep 17 00:00:00 2001 From: Christoph Ludolf Date: Fri, 16 Jan 2026 09:03:45 +0100 Subject: [PATCH] Membership: Attendance list user defined fields are selected according to settings of parent group/course --- .../Membership/classes/class.ilAttendanceList.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/ILIAS/Membership/classes/class.ilAttendanceList.php b/components/ILIAS/Membership/classes/class.ilAttendanceList.php index 5a59245fa8a8..08b02216a4fb 100755 --- a/components/ILIAS/Membership/classes/class.ilAttendanceList.php +++ b/components/ILIAS/Membership/classes/class.ilAttendanceList.php @@ -37,6 +37,7 @@ class ilAttendanceList protected ilObject $parent_obj; protected ?ilParticipants $participants; protected ?ilWaitingList $waiting_list; + protected ilTree $tree; /** * @var ?callable */ @@ -67,7 +68,7 @@ public function __construct( $this->ctrl = $DIC->ctrl(); $this->tpl = $DIC->ui()->mainTemplate(); $this->profile = $DIC['user']->getProfile(); - + $this->tree = $DIC->repositoryTree(); $this->parent_gui = $a_parent_gui; $this->parent_obj = $a_parent_obj; $this->participants = $a_participants_object; @@ -137,10 +138,14 @@ protected function readOrderedExportableFields(): bool ); } + $parent_obj_type = $this->tree->checkForParentType($this->parent_obj->getRefId(), 'crs') ? 'crs' : ''; + $parent_obj_type = $this->tree->checkForParentType($this->parent_obj->getRefId(), 'grp') ? 'grp' : $parent_obj_type; + $user_defined_fields = $parent_obj_type === '' + ? $this->profile->getAllUserDefinedFields() + : $this->profile->getVisibleUserDefinedFields(Context::buildFromObjectType($parent_obj_type)); + // add udf fields - foreach ($this->profile->getVisibleUserDefinedFields( - Context::buildFromObjectType($this->parent_obj->getType()) - ) as $field) { + foreach ($user_defined_fields as $field) { $this->presets['udf_' . $field->getIdentifier()] = array( $field->getLabel($this->lng), false