@ -77,8 +77,8 @@ class enrol_apply_plugin extends enrol_plugin {
$applicationinfo->userenrolmentid = $userenrolment->id;
$applicationinfo->userenrolmentid = $userenrolment->id;
$applicationinfo->comment = $applydescription;
$applicationinfo->comment = $applydescription;
$DB->insert_record('enrol_apply_applicationinfo', $applicationinfo, false);
$DB->insert_record('enrol_apply_applicationinfo', $applicationinfo, false);
sendConfirmMailToTeachers($instance, $data, $applydescription);
$this-> sendConfirmMailToTeachers($instance, $data, $applydescription);
sendConfirmMailToManagers($instance, $data, $applydescription);
$this-> sendConfirmMailToManagers($instance, $data, $applydescription);
// Deprecated fixed by Shiro < gigashiro @ gmail . com >
// Deprecated fixed by Shiro < gigashiro @ gmail . com >
//add_to_log($instance->courseid, 'course', 'enrol', '../enrol/users.php?id='.$instance->courseid, $instance->courseid); //there should be userid somewhere!
//add_to_log($instance->courseid, 'course', 'enrol', '../enrol/users.php?id='.$instance->courseid, $instance->courseid); //there should be userid somewhere!
@ -224,9 +224,9 @@ class enrol_apply_plugin extends enrol_plugin {
$this->update_user_enrol($instance, $userenrolment->userid, ENROL_USER_ACTIVE);
$this->update_user_enrol($instance, $userenrolment->userid, ENROL_USER_ACTIVE);
$info = getRelatedInfo($enrol);
$info = $this-> getRelatedInfo($enrol);
$DB->delete_records('enrol_apply_applicationinfo', array('userenrolmentid' => $enrol));
$DB->delete_records('enrol_apply_applicationinfo', array('userenrolmentid' => $enrol));
sendConfirmMail($info);
$this-> sendConfirmMail($info);
}
}
}
}
@ -246,8 +246,8 @@ class enrol_apply_plugin extends enrol_plugin {
$this->update_user_enrol($instance, $userenrolment->userid, ENROL_APPLY_USER_WAIT);
$this->update_user_enrol($instance, $userenrolment->userid, ENROL_APPLY_USER_WAIT);
$info = getRelatedInfo($enrol);
$info = $this-> getRelatedInfo($enrol);
sendWaitMail($info);
$this-> sendWaitMail($info);
}
}
}
}
}
}
@ -273,11 +273,10 @@ class enrol_apply_plugin extends enrol_plugin {
continue;
continue;
}
}
$info = getRelatedInfo($enrol);
$info = $this-> getRelatedInfo($enrol);
$this->unenrol_user($instance, $userenrolment->userid);
$this->unenrol_user($instance, $userenrolment->userid);
$DB->delete_records('enrol_apply_applicationinfo', array('userenrolmentid' => $enrol));
$DB->delete_records('enrol_apply_applicationinfo', array('userenrolmentid' => $enrol));
sendCancelMail($info);
$this->sendCancelMail($info);
}
}
}
}
}
@ -287,7 +286,7 @@ function sendCancelMail($info){
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$body = get_config('enrol_apply', 'cancelmailcontent');
$body = get_config('enrol_apply', 'cancelmailcontent');
$body = updateMailContent($body,$replace);
$body = $this-> updateMailContent($body,$replace);
$contact = core_user::get_support_user();
$contact = core_user::get_support_user();
email_to_user($info, $contact, get_config('enrol_apply', 'cancelmailsubject'), html_to_text($body), $body);
email_to_user($info, $contact, get_config('enrol_apply', 'cancelmailsubject'), html_to_text($body), $body);
}
}
@ -298,7 +297,7 @@ function sendConfirmMail($info){
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$body = get_config('enrol_apply', 'confirmmailcontent');
$body = get_config('enrol_apply', 'confirmmailcontent');
$body = updateMailContent($body,$replace);
$body = $this-> updateMailContent($body,$replace);
$contact = core_user::get_support_user();
$contact = core_user::get_support_user();
email_to_user($info, $contact, get_config('enrol_apply', 'confirmmailsubject'), html_to_text($body), $body);
email_to_user($info, $contact, get_config('enrol_apply', 'confirmmailsubject'), html_to_text($body), $body);
}
}
@ -310,7 +309,7 @@ function sendWaitMail($info){
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$replace = array('firstname'=>$info->firstname,'content'=>format_string($info->coursename),'lastname'=>$info->lastname,'username'=>$info->username);
$body = get_config('enrol_apply', 'waitmailcontent');
$body = get_config('enrol_apply', 'waitmailcontent');
$body = updateMailContent($body,$replace);
$body = $this-> updateMailContent($body,$replace);
$contact = get_admin();
$contact = get_admin();
//confirm mail will sent by the admin
//confirm mail will sent by the admin
//$contact = $USER;
//$contact = $USER;
@ -417,3 +416,4 @@ function updateMailContent($content,$replace){
}
}
return $content;
return $content;
}
}
}