24 include_once(
'./Services/Membership/classes/class.ilParticipants.php');
49 $this->NOTIFY_DISMISS_SUBSCRIBER = 1;
50 $this->NOTIFY_ACCEPT_SUBSCRIBER = 2;
51 $this->NOTIFY_DISMISS_MEMBER = 3;
52 $this->NOTIFY_BLOCK_MEMBER = 4;
53 $this->NOTIFY_UNBLOCK_MEMBER = 5;
54 $this->NOTIFY_ACCEPT_USER = 6;
55 $this->NOTIFY_ADMINS = 7;
56 $this->NOTIFY_STATUS_CHANGED = 8;
57 $this->NOTIFY_SUBSCRIPTION_REQUEST = 9;
59 $this->NOTIFY_REGISTERED = 10;
60 $this->NOTIFY_UNSUBSCRIBE = 11;
61 $this->NOTIFY_WAITING_LIST = 12;
76 if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
78 return self::$instances[$a_obj_id];
91 $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
92 $lrol = $rbacreview->getRolesOfRoleFolder($rolf[
'ref_id'],
false);
95 foreach($lrol as $role)
124 $this->participants_status[$a_usr_id][
'passed'] = (int) $a_passed;
126 $query =
"SELECT * FROM crs_members ".
127 "WHERE obj_id = ".$ilDB->quote($this->obj_id,
'integer').
" ".
128 "AND usr_id = ".$ilDB->quote($a_usr_id,
'integer');
132 $query =
"UPDATE crs_members SET ".
133 "passed = ".$ilDB->quote((
int) $a_passed,
'integer').
" ".
134 "WHERE obj_id = ".$ilDB->quote($this->obj_id,
'integer').
" ".
135 "AND usr_id = ".$ilDB->quote($a_usr_id,
'integer');
139 $query =
"INSERT INTO crs_members (passed,obj_id,usr_id,notification,blocked) ".
141 $ilDB->quote((
int) $a_passed,
'integer').
", ".
142 $ilDB->quote($this->obj_id,
'integer').
", ".
143 $ilDB->quote($a_usr_id,
'integer').
", ".
144 $ilDB->quote(0,
'integer').
", ".
145 $ilDB->quote(0,
'integer').
" ".
160 include_once
'./Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
162 global $ilObjDataCache,$ilUser;
166 case $this->NOTIFY_DISMISS_SUBSCRIBER:
169 $mail->setRefId($this->ref_id);
170 $mail->setRecipients(array($a_usr_id));
174 case $this->NOTIFY_ACCEPT_SUBSCRIBER:
177 $mail->setRefId($this->ref_id);
178 $mail->setRecipients(array($a_usr_id));
182 case $this->NOTIFY_DISMISS_MEMBER:
185 $mail->setRefId($this->ref_id);
186 $mail->setRecipients(array($a_usr_id));
190 case $this->NOTIFY_BLOCK_MEMBER:
193 $mail->setRefId($this->ref_id);
194 $mail->setRecipients(array($a_usr_id));
198 case $this->NOTIFY_UNBLOCK_MEMBER:
201 $mail->setRefId($this->ref_id);
202 $mail->setRecipients(array($a_usr_id));
206 case $this->NOTIFY_ACCEPT_USER:
209 $mail->setRefId($this->ref_id);
210 $mail->setRecipients(array($a_usr_id));
214 case $this->NOTIFY_STATUS_CHANGED:
217 $mail->setRefId($this->ref_id);
218 $mail->setRecipients(array($a_usr_id));
222 case $this->NOTIFY_UNSUBSCRIBE:
225 $mail->setRefId($this->ref_id);
226 $mail->setRecipients(array($a_usr_id));
230 case $this->NOTIFY_REGISTERED:
233 $mail->setRefId($this->ref_id);
234 $mail->setRecipients(array($a_usr_id));
238 case $this->NOTIFY_WAITING_LIST:
239 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
241 $pos = $wl->getPosition($a_usr_id);
245 $mail->setRefId($this->ref_id);
246 $mail->setRecipients(array($a_usr_id));
247 $mail->setAdditionalInformation(array(
'position' => $pos));
251 case $this->NOTIFY_SUBSCRIPTION_REQUEST:
255 case $this->NOTIFY_ADMINS:
265 global
$ilDB,$ilObjDataCache;
267 include_once
'./Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
270 $mail->setAdditionalInformation(array(
'usr_id' => $a_usr_id));
271 $mail->setRefId($this->ref_id);
280 global
$ilDB,$ilObjDataCache;
282 include_once
'./Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
285 $mail->setAdditionalInformation(array(
'usr_id' => $a_usr_id));
286 $mail->setRefId($this->ref_id);
295 global
$ilDB,$ilObjDataCache;
297 include_once
'./Modules/Course/classes/class.ilCourseMembershipMailNotification.php';
300 $mail->setAdditionalInformation(array(
'usr_id' => $a_usr_id));
301 $mail->setRefId($this->ref_id);
312 $body = $this->lng->txt(
'crs_status_changed_body').
"\n";
313 $body .= $this->lng->txt(
'login').
': '.$user_obj->getLogin().
"\n";
314 $body .= $this->lng->txt(
'role').
': ';
316 if($this->
isAdmin($user_obj->getId()))
318 $body .= $this->lng->txt(
'crs_admin').
"\n";
320 if($this->
isTutor($user_obj->getId()))
322 $body .= $this->lng->txt(
'crs_tutor').
"\n";
324 if($this->
isMember($user_obj->getId()))
326 $body .= $this->lng->txt(
'crs_member').
"\n";
328 $body .= $this->lng->txt(
'status').
': ';
332 $body .= $this->lng->txt(
"crs_notify").
"\n";
336 $body .= $this->lng->txt(
"crs_no_notify").
"\n";
340 $body .= $this->lng->txt(
"crs_blocked").
"\n";
344 $body .= $this->lng->txt(
"crs_unblocked").
"\n";
346 $passed = $this->
hasPassed($user_obj->getId()) ? $this->lng->txt(
'yes') : $this->lng->txt(
'no');
347 $body .= $this->lng->txt(
'crs_passed').
': '.$passed.
"\n";