From a571d3a1808030b0fe84f88d129b401898732d46 Mon Sep 17 00:00:00 2001 From: Sagun Karki Date: Mon, 9 Mar 2026 16:52:38 +0100 Subject: [PATCH] feat: Send welcome mail via SOAP call --- .../class.ilSoapCourseAdministration.php | 61 +++++++++++-------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php b/components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php index 2303f952b5e8..5ee22de949dc 100755 --- a/components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php +++ b/components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php @@ -130,14 +130,14 @@ public function deleteCourse(string $sid, int $course_id) * @return bool|soap_fault|SoapFault|null */ public function assignCourseMember( - string $sid, int $course_id, + string $sid, + int $course_id, int $user_id, string $type, - ?bool $notification = null, + ?bool $notification = null, ?bool $contact_person = null, ?bool $blocked = null - ) - { + ) { $this->initAuth($sid); $this->initIlias(); @@ -188,7 +188,12 @@ public function assignCourseMember( $course_members->add($tmp_user->getId(), $valid_roles[$type]); - if($type === 'Admin' || $type === 'Tutor') { + $course_members->sendNotification( + ilCourseMembershipMailNotification::TYPE_ADMISSION_MEMBER, + $tmp_user->getId() + ); + + if ($type === 'Admin' || $type === 'Tutor') { if ($notification !== null) { $course_members->updateNotification($tmp_user->getId(), $notification); } @@ -196,7 +201,7 @@ public function assignCourseMember( if ($contact_person !== null) { $course_members->updateContact($tmp_user->getId(), $contact_person); } - }elseif( $type === "Member" && $blocked !== null) { + } elseif ($type === "Member" && $blocked !== null) { $course_members->updateBlocked($tmp_user->getId(), $blocked); } return true; @@ -419,9 +424,11 @@ public function getCoursesForUser(string $sid, string $parameters) $ref_ids = array(); - if (self::MEMBER == ($status & self::MEMBER) || + if ( + self::MEMBER == ($status & self::MEMBER) || self::TUTOR == ($status & self::TUTOR) || - self::ADMIN == ($status & self::ADMIN)) { + self::ADMIN == ($status & self::ADMIN) + ) { foreach ($rbacreview->assignedRoles($user_id) as $role_id) { if ($role = ilObjectFactory::getInstanceByObjId($role_id, false)) { #echo $role->getType(); @@ -438,23 +445,29 @@ public function getCoursesForUser(string $sid, string $parameters) continue; } - if (self::MEMBER == ($status & self::MEMBER) && strpos( - $role_title, - "member" - ) !== false) { - $ref_ids [] = $ref_id; - } elseif (self::TUTOR == ($status & self::TUTOR) && strpos( - $role_title, - "tutor" - ) !== false) { - $ref_ids [] = $ref_id; - } elseif (self::ADMIN == ($status & self::ADMIN) && strpos( - $role_title, - "admin" - ) !== false) { - $ref_ids [] = $ref_id; + if ( + self::MEMBER == ($status & self::MEMBER) && strpos( + $role_title, + "member" + ) !== false + ) { + $ref_ids[] = $ref_id; + } elseif ( + self::TUTOR == ($status & self::TUTOR) && strpos( + $role_title, + "tutor" + ) !== false + ) { + $ref_ids[] = $ref_id; + } elseif ( + self::ADMIN == ($status & self::ADMIN) && strpos( + $role_title, + "admin" + ) !== false + ) { + $ref_ids[] = $ref_id; } elseif (($status & self::OWNER) == self::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id) { - $ref_ids [] = $ref_id; + $ref_ids[] = $ref_id; } } }