|
@ -397,8 +397,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
$renderer = $PAGE->get_renderer('enrol_apply'); |
|
|
$renderer = $PAGE->get_renderer('enrol_apply'); |
|
|
|
|
|
|
|
|
$course = get_course($instance->courseid); |
|
|
$course = get_course($instance->courseid); |
|
|
$user = core_user::get_user($userid); |
|
|
$applicant = core_user::get_user($userid); |
|
|
$contact = core_user::get_support_user(); |
|
|
|
|
|
|
|
|
|
|
|
// Include standard user profile fields? |
|
|
// Include standard user profile fields? |
|
|
$standarduserfields = null; |
|
|
$standarduserfields = null; |
|
@ -411,8 +410,8 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
$extrauserfields = null; |
|
|
$extrauserfields = null; |
|
|
if ($instance->customint2) { |
|
|
if ($instance->customint2) { |
|
|
require_once($CFG->dirroot.'/user/profile/lib.php'); |
|
|
require_once($CFG->dirroot.'/user/profile/lib.php'); |
|
|
profile_load_custom_fields($user); |
|
|
profile_load_custom_fields($applicant); |
|
|
$extrauserfields = $user->profile; |
|
|
$extrauserfields = $applicant->profile; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Send notification to users with manageapplications in course context (instance depending)? |
|
|
// Send notification to users with manageapplications in course context (instance depending)? |
|
@ -421,7 +420,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
$manageurl = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id)); |
|
|
$manageurl = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id)); |
|
|
$content = $renderer->application_notification_mail_body( |
|
|
$content = $renderer->application_notification_mail_body( |
|
|
$course, |
|
|
$course, |
|
|
$user, |
|
|
$applicant, |
|
|
$manageurl, |
|
|
$manageurl, |
|
|
$data->applydescription, |
|
|
$data->applydescription, |
|
|
$standarduserfields, |
|
|
$standarduserfields, |
|
@ -429,7 +428,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
foreach ($courseuserstonotify as $user) { |
|
|
foreach ($courseuserstonotify as $user) { |
|
|
$message = new enrol_apply_notification( |
|
|
$message = new enrol_apply_notification( |
|
|
$user, |
|
|
$user, |
|
|
$contact, |
|
|
$applicant, |
|
|
'application', |
|
|
'application', |
|
|
get_string('mailtoteacher_suject', 'enrol_apply'), |
|
|
get_string('mailtoteacher_suject', 'enrol_apply'), |
|
|
$content, |
|
|
$content, |
|
@ -448,7 +447,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
$manageurl = new moodle_url('/enrol/apply/manage.php'); |
|
|
$manageurl = new moodle_url('/enrol/apply/manage.php'); |
|
|
$content = $renderer->application_notification_mail_body( |
|
|
$content = $renderer->application_notification_mail_body( |
|
|
$course, |
|
|
$course, |
|
|
$user, |
|
|
$applicant, |
|
|
$manageurl, |
|
|
$manageurl, |
|
|
$data->applydescription, |
|
|
$data->applydescription, |
|
|
$standarduserfields, |
|
|
$standarduserfields, |
|
@ -456,7 +455,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
foreach ($globaluserstonotify as $user) { |
|
|
foreach ($globaluserstonotify as $user) { |
|
|
$message = new enrol_apply_notification( |
|
|
$message = new enrol_apply_notification( |
|
|
$user, |
|
|
$user, |
|
|
$contact, |
|
|
$applicant, |
|
|
'application', |
|
|
'application', |
|
|
get_string('mailtoteacher_suject', 'enrol_apply'), |
|
|
get_string('mailtoteacher_suject', 'enrol_apply'), |
|
|
$content, |
|
|
$content, |
|
@ -475,7 +474,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
* @return array Array of user IDs. |
|
|
* @return array Array of user IDs. |
|
|
*/ |
|
|
*/ |
|
|
public function get_notifycoursebased_users($instance) { |
|
|
public function get_notifycoursebased_users($instance) { |
|
|
$value = $instance->customtext2; |
|
|
$value = $instance->customtext3; |
|
|
if (empty($value) or $value === '$@NONE@$') { |
|
|
if (empty($value) or $value === '$@NONE@$') { |
|
|
return array(); |
|
|
return array(); |
|
|
} |
|
|
} |
|
@ -508,7 +507,7 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
* @return array Array of user IDs. |
|
|
* @return array Array of user IDs. |
|
|
*/ |
|
|
*/ |
|
|
public function get_notifyglobal_users() { |
|
|
public function get_notifyglobal_users() { |
|
|
return get_users_from_config($this->get_config('notifyglobal'), 'enrol/apply:manageapplications'); |
|
|
return get_users_from_config($this->get_config('notifyglobal'), 'enrol/apply:manageapplications', false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private function update_mail_content($content, $course, $user, $userenrolment) { |
|
|
private function update_mail_content($content, $course, $user, $userenrolment) { |
|
|