Skip to content

Commit

Permalink
Membership/Session: container in participant table title (41893)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmitz-ilias committed Dec 13, 2024
1 parent e9cbfbb commit 2ef08fd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
27 changes: 27 additions & 0 deletions Modules/Session/classes/class.ilSessionMembershipGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,33 @@ protected function initParticipantTableGUI(): ilSessionParticipantsTableGUI
return $table;
}

protected function getParticipantTableTitle(): string
{
/*
* TODO this exact logic is also in ilSessionParticipantsTableGUI and ilMembershipGUI,
* should be centralized.
*/
if ($member_ref = $this->tree->checkForParentType(
$this->getParentObject()->getRefId(),
'grp'
)) {
$member_ref_id = $member_ref;
} elseif ($member_ref = $this->tree->checkForParentType(
$this->getParentObject()->getRefId(),
'crs'
)) {
$member_ref_id = $member_ref;
} else {
$this->logger->warning('Cannot find parent course or group for ref_id: ' . $this->getParentObject()->getRefId());
$member_ref_id = $this->getParentObject()->getRefId();
}

return sprintf(
$this->lng->txt('sess_mem_tbl_header'),
ilObjectFactory::getInstanceByRefId($member_ref_id)->getTitle(),
);
}

protected function initSubscriberTable(): ilSubscriberTableGUI
{
$subscriber = new ilSubscriberTableGUI($this, $this->getParentObject(), true, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public function __construct(object $a_parent_gui, ilObjSession $a_parent_obj, st
$this->getRepositoryObject()->getRefId()
);

/*
* TODO this exact logic is also in ilSessionMembershipGUI and ilMembershipGUI,
* should be centralized.
*/
if ($member_ref = $this->tree->checkForParentType($this->parent_ref_id, 'grp')) {
$this->member_ref_id = $member_ref;
} elseif ($member_ref = $this->tree->checkForParentType($this->parent_ref_id, 'crs')) {
Expand Down
11 changes: 10 additions & 1 deletion Services/Membership/classes/class.ilMembershipGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ protected function participants(): void

// show member table
$table = $this->initParticipantTableGUI();
$table->setTitle($this->lng->txt($this->getParentObject()->getType() . '_mem_tbl_header'));
$table->setTitle($this->getParticipantTableTitle());
$table->setFormAction($this->ctrl->getFormAction($this));
$table->parse();

Expand All @@ -418,6 +418,11 @@ protected function participants(): void
$this->tpl->setVariable('MEMBERS', $table->getHTML());
}

protected function getParticipantTableTitle(): string
{
return $this->lng->txt($this->getParentObject()->getType() . '_mem_tbl_header');
}

public function getAttendanceListUserData(int $user_id, array $filters = []): array
{
return [];
Expand Down Expand Up @@ -1582,6 +1587,10 @@ protected function initAttendanceList(bool $a_for_members = false): ?ilAttendanc
$waiting_list = $this->initWaitingList();

if ($this instanceof ilSessionMembershipGUI) {
/*
* TODO this exact logic is also in ilSessionParticipantsTableGUI and ilSessionMembershipGUI,
* should be centralized.
*/
$member_id = $DIC->repositoryTree()->checkForParentType(
$this->getParentObject()->getRefId(),
'grp'
Expand Down
2 changes: 1 addition & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15311,7 +15311,7 @@ sess#:#sess_material_not_assigned#:#Nicht zugeordnet
sess#:#sess_max_members_needed#:#Für die Warteliste wird eine maximale Anzahl Mitglieder benötigt.
sess#:#sess_mem_contacts#:#Kontaktperson
sess#:#sess_mem_send_mail#:#Mail verschicken
sess#:#sess_mem_tbl_header#:#Teilnahmen in Sitzung
sess#:#sess_mem_tbl_header#:#Mitglieder aus %s
sess#:#sess_member_administration#:#Verwalten
sess#:#sess_members#:#Teilnahmen
sess#:#sess_members_gallery#:#Galerie
Expand Down
2 changes: 1 addition & 1 deletion lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15311,7 +15311,7 @@ sess#:#sess_material_not_assigned#:#Not Assigned
sess#:#sess_max_members_needed#:#A maximum number of members is needed for the waiting list feature.
sess#:#sess_mem_contacts#:#Tutorial Support
sess#:#sess_mem_send_mail#:#Send Mail
sess#:#sess_mem_tbl_header#:#Session Participants
sess#:#sess_mem_tbl_header#:#Participants From %s
sess#:#sess_member_administration#:#Edit Participants
sess#:#sess_members#:#Participants
sess#:#sess_members_gallery#:#Session Gallery
Expand Down

0 comments on commit 2ef08fd

Please sign in to comment.