Skip to content

Commit 190e499

Browse files
authored
feat: Send welcome mail via SOAP call (ILIAS-eLearning#11236)
1 parent 5a340ee commit 190e499

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ public function deleteCourse(string $sid, int $course_id)
130130
* @return bool|soap_fault|SoapFault|null
131131
*/
132132
public function assignCourseMember(
133-
string $sid, int $course_id,
133+
string $sid,
134+
int $course_id,
134135
int $user_id,
135136
string $type,
136-
?bool $notification = null,
137+
?bool $notification = null,
137138
?bool $contact_person = null,
138139
?bool $blocked = null
139-
)
140-
{
140+
) {
141141
$this->initAuth($sid);
142142
$this->initIlias();
143143

@@ -188,15 +188,20 @@ public function assignCourseMember(
188188

189189
$course_members->add($tmp_user->getId(), $valid_roles[$type]);
190190

191-
if($type === 'Admin' || $type === 'Tutor') {
191+
$course_members->sendNotification(
192+
ilCourseMembershipMailNotification::TYPE_ADMISSION_MEMBER,
193+
$tmp_user->getId()
194+
);
195+
196+
if ($type === 'Admin' || $type === 'Tutor') {
192197
if ($notification !== null) {
193198
$course_members->updateNotification($tmp_user->getId(), $notification);
194199
}
195200

196201
if ($contact_person !== null) {
197202
$course_members->updateContact($tmp_user->getId(), $contact_person);
198203
}
199-
}elseif( $type === "Member" && $blocked !== null) {
204+
} elseif ($type === "Member" && $blocked !== null) {
200205
$course_members->updateBlocked($tmp_user->getId(), $blocked);
201206
}
202207
return true;
@@ -419,9 +424,11 @@ public function getCoursesForUser(string $sid, string $parameters)
419424

420425
$ref_ids = array();
421426

422-
if (self::MEMBER == ($status & self::MEMBER) ||
427+
if (
428+
self::MEMBER == ($status & self::MEMBER) ||
423429
self::TUTOR == ($status & self::TUTOR) ||
424-
self::ADMIN == ($status & self::ADMIN)) {
430+
self::ADMIN == ($status & self::ADMIN)
431+
) {
425432
foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
426433
if ($role = ilObjectFactory::getInstanceByObjId($role_id, false)) {
427434
#echo $role->getType();
@@ -438,23 +445,29 @@ public function getCoursesForUser(string $sid, string $parameters)
438445
continue;
439446
}
440447

441-
if (self::MEMBER == ($status & self::MEMBER) && strpos(
442-
$role_title,
443-
"member"
444-
) !== false) {
445-
$ref_ids [] = $ref_id;
446-
} elseif (self::TUTOR == ($status & self::TUTOR) && strpos(
447-
$role_title,
448-
"tutor"
449-
) !== false) {
450-
$ref_ids [] = $ref_id;
451-
} elseif (self::ADMIN == ($status & self::ADMIN) && strpos(
452-
$role_title,
453-
"admin"
454-
) !== false) {
455-
$ref_ids [] = $ref_id;
448+
if (
449+
self::MEMBER == ($status & self::MEMBER) && strpos(
450+
$role_title,
451+
"member"
452+
) !== false
453+
) {
454+
$ref_ids[] = $ref_id;
455+
} elseif (
456+
self::TUTOR == ($status & self::TUTOR) && strpos(
457+
$role_title,
458+
"tutor"
459+
) !== false
460+
) {
461+
$ref_ids[] = $ref_id;
462+
} elseif (
463+
self::ADMIN == ($status & self::ADMIN) && strpos(
464+
$role_title,
465+
"admin"
466+
) !== false
467+
) {
468+
$ref_ids[] = $ref_id;
456469
} elseif (($status & self::OWNER) == self::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id) {
457-
$ref_ids [] = $ref_id;
470+
$ref_ids[] = $ref_id;
458471
}
459472
}
460473
}

0 commit comments

Comments
 (0)