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;
72 if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
74 return self::$instances[$a_obj_id];
94 $this->participants_status[$a_usr_id][
'passed'] = (int) $a_passed;
96 $query =
"SELECT * FROM crs_members ".
97 "WHERE obj_id = ".$ilDB->quote($this->obj_id).
" ".
98 "AND usr_id = ".$ilDB->quote($a_usr_id);
99 $res = $ilDB->query($query);
102 $query =
"UPDATE crs_members SET ".
103 "passed = ".$ilDB->quote((
int) $a_passed).
" ".
104 "WHERE obj_id = ".$ilDB->quote($this->obj_id).
" ".
105 "AND usr_id = ".$ilDB->quote($a_usr_id);
109 $query =
"INSERT INTO crs_members SET ".
110 "passed = ".$ilDB->quote((
int) $a_passed).
", ".
111 "obj_id = ".$ilDB->quote($this->obj_id).
", ".
112 "usr_id = ".$ilDB->quote($a_usr_id);
115 $res = $ilDB->query($query);
126 global $ilObjDataCache,$ilUser;
130 $link = (
"\n\n".$this->lng->txt(
'crs_mail_permanent_link'));
131 $link .= (
"\n\n".ILIAS_HTTP_PATH.
"/goto.php?target=crs_".$this->ref_id.
"&client_id=".CLIENT_ID);
135 case $this->NOTIFY_DISMISS_SUBSCRIBER:
136 $subject = $this->lng->txt(
"crs_reject_subscriber");
137 $body = $this->lng->txt(
"crs_reject_subscriber_body");
140 case $this->NOTIFY_ACCEPT_SUBSCRIBER:
141 $subject = $this->lng->txt(
"crs_accept_subscriber");
142 $body = $this->lng->txt(
"crs_accept_subscriber_body");
145 case $this->NOTIFY_DISMISS_MEMBER:
146 $subject = $this->lng->txt(
"crs_dismiss_member");
147 $body = $this->lng->txt(
"crs_dismiss_member_body");
149 case $this->NOTIFY_BLOCK_MEMBER:
150 $subject = $this->lng->txt(
"crs_blocked_member");
151 $body = $this->lng->txt(
"crs_blocked_member_body");
153 case $this->NOTIFY_UNBLOCK_MEMBER:
154 $subject = $this->lng->txt(
"crs_unblocked_member");
155 $body = $this->lng->txt(
"crs_unblocked_member_body");
158 case $this->NOTIFY_ACCEPT_USER:
159 $subject = $this->lng->txt(
"crs_added_member");
160 $body = $this->lng->txt(
"crs_added_member_body");
163 case $this->NOTIFY_STATUS_CHANGED:
164 $subject = $this->lng->txt(
"crs_status_changed");
169 case $this->NOTIFY_SUBSCRIPTION_REQUEST:
174 case $this->NOTIFY_ADMINS:
180 $subject = sprintf($subject,$ilObjDataCache->lookupTitle($this->obj_id));
181 $body = sprintf($body,$ilObjDataCache->lookupTitle($this->obj_id));
183 include_once(
"Services/Mail/classes/class.ilMail.php");
184 $mail =
new ilMail($ilUser->getId());
185 $mail->
sendMail($tmp_user->getLogin(),
'',
'',$subject,$body,array(),array(
'system'));
193 global
$ilDB,$ilObjDataCache;
196 include_once(
"Services/Mail/classes/class.ilFormatMail.php");
199 $subject = sprintf($this->lng->txt(
"crs_cancel_subscription"),$ilObjDataCache->lookupTitle($this->obj_id));
200 $body = sprintf($this->lng->txt(
"crs_cancel_subscription_body"),$ilObjDataCache->lookupTitle($this->obj_id));
201 $body .= (
"\n\n".$this->lng->txt(
'crs_mail_permanent_link'));
202 $body .= (
"\n\n".ILIAS_HTTP_PATH.
"/goto.php?target=crs_".$this->ref_id.
"&client_id=".CLIENT_ID);
208 $message = $mail->sendMail($tmp_user->getLogin(),
'',
'',$subject,$body,array(),array(
'system'));
217 global
$ilDB,$ilObjDataCache,$ilUser;
219 include_once(
"Services/Mail/classes/class.ilMail.php");
221 $mail =
new ilMail($ilUser->getId());
222 $subject = sprintf($this->lng->txt(
"crs_new_subscription_request"),$ilObjDataCache->lookupTitle($this->obj_id));
223 $body = sprintf($this->lng->txt(
"crs_new_subscription_request_body"),$ilObjDataCache->lookupTitle($this->obj_id));
224 $body .= (
"\n\n".$this->lng->txt(
'crs_new_subscription_request_body2'));
225 $body .= (
"\n\n".ILIAS_HTTP_PATH.
"/goto.php?target=crs_".$this->ref_id.
"&client_id=".CLIENT_ID);
230 $message = $mail->sendMail($tmp_user->getLogin(),
'',
'',$subject,$body,array(),array(
'system'));
238 global
$ilDB,$ilObjDataCache;
240 include_once(
"Services/Mail/classes/class.ilFormatMail.php");
243 $subject = sprintf($this->lng->txt(
"crs_new_subscription"),$ilObjDataCache->lookupTitle($this->obj_id));
244 $body = sprintf($this->lng->txt(
"crs_new_subscription_body"),$ilObjDataCache->lookupTitle($this->obj_id));
245 $body .= (
"\n\n".ILIAS_HTTP_PATH.
"/goto.php?target=crs_".$this->ref_id.
"&client_id=".CLIENT_ID);
252 $message = $mail->sendMail($tmp_user->getLogin(),
'',
'',$subject,$body,array(),array(
'system'));
266 $body = $this->lng->txt(
'crs_status_changed_body').
"\n";
267 $body .= $this->lng->txt(
'login').
': '.$user_obj->getLogin().
"\n";
268 $body .= $this->lng->txt(
'role').
': ';
270 if($this->
isAdmin($user_obj->getId()))
272 $body .= $this->lng->txt(
'crs_admin').
"\n";
274 if($this->
isTutor($user_obj->getId()))
276 $body .= $this->lng->txt(
'crs_tutor').
"\n";
278 if($this->
isMember($user_obj->getId()))
280 $body .= $this->lng->txt(
'crs_member').
"\n";
282 $body .= $this->lng->txt(
'status').
': ';
286 $body .= $this->lng->txt(
"crs_notify").
"\n";
290 $body .= $this->lng->txt(
"crs_no_notify").
"\n";
294 $body .= $this->lng->txt(
"crs_blocked").
"\n";
298 $body .= $this->lng->txt(
"crs_unblocked").
"\n";
300 $passed = $this->
hasPassed($user_obj->getId()) ? $this->lng->txt(
'yes') : $this->lng->txt(
'no');
301 $body .= $this->lng->txt(
'crs_passed').
': '.$passed.
"\n";