|
@ -82,9 +82,15 @@ class enrol_apply_plugin extends enrol_plugin { |
|
|
$applydescription = $userInfo->applydescription; |
|
|
$applydescription = $userInfo->applydescription; |
|
|
unset($userInfo->applydescription); |
|
|
unset($userInfo->applydescription); |
|
|
$userInfo->id = $USER->id; |
|
|
$userInfo->id = $USER->id; |
|
|
|
|
|
|
|
|
|
|
|
$apply_setting = $DB->get_records_sql("select name,value from ".$CFG->prefix."config_plugins where plugin='enrol_apply'"); |
|
|
|
|
|
if($apply_setting['show_standard_user_profile']->value == 1 && $apply_setting['show_extra_user_profile']->value == 0){ |
|
|
|
|
|
profile_save_data($userInfo); |
|
|
|
|
|
//$res = $DB->update_record('user',$userInfoProfile); |
|
|
|
|
|
}else{ |
|
|
|
|
|
profile_save_data($userInfo); |
|
|
$res = $DB->update_record('user',$userInfo); |
|
|
$res = $DB->update_record('user',$userInfo); |
|
|
//echo "<pre>";print_r($userInfo);exit; |
|
|
} |
|
|
//var_dump($res);exit; |
|
|
|
|
|
$enrol = enrol_get_plugin('self'); |
|
|
$enrol = enrol_get_plugin('self'); |
|
|
$timestart = time(); |
|
|
$timestart = time(); |
|
|
if ($instance->enrolperiod) { |
|
|
if ($instance->enrolperiod) { |
|
@ -286,9 +292,10 @@ function sendConfirmMailToTeachers($courseid,$instanceid,$info,$applydescription |
|
|
foreach($teachers as $teacher){ |
|
|
foreach($teachers as $teacher){ |
|
|
$editTeacher = $DB->get_record('user',array('id'=>$teacher->userid)); |
|
|
$editTeacher = $DB->get_record('user',array('id'=>$teacher->userid)); |
|
|
$body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>'; |
|
|
$body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>'; |
|
|
$body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$info->firstname.' '.$info->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$USER->firstname.' '.$USER->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>'; |
|
|
$body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>'; |
|
|
|
|
|
|
|
|
|
|
|
if($apply_setting['show_standard_user_profile']->value == 0){ |
|
|
$body .= '<p><strong>'. get_string('user_profile', 'enrol_apply').'</strong></p>'; |
|
|
$body .= '<p><strong>'. get_string('user_profile', 'enrol_apply').'</strong></p>'; |
|
|
$body .= '<p>'. get_string('firstname') .': '.$info->firstname.'</p>'; |
|
|
$body .= '<p>'. get_string('firstname') .': '.$info->firstname.'</p>'; |
|
|
$body .= '<p>'. get_string('lastname') .': '.$info->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('lastname') .': '.$info->lastname.'</p>'; |
|
@ -314,6 +321,16 @@ function sendConfirmMailToTeachers($courseid,$instanceid,$info,$applydescription |
|
|
$body .= '<p>'. get_string('phone') .': '.$info->phone1.'</p>'; |
|
|
$body .= '<p>'. get_string('phone') .': '.$info->phone1.'</p>'; |
|
|
$body .= '<p>'. get_string('phone2') .': '.$info->phone2.'</p>'; |
|
|
$body .= '<p>'. get_string('phone2') .': '.$info->phone2.'</p>'; |
|
|
$body .= '<p>'. get_string('address') .': '.$info->address.'</p>'; |
|
|
$body .= '<p>'. get_string('address') .': '.$info->address.'</p>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($apply_setting['show_extra_user_profile']->value == 0){ |
|
|
|
|
|
require_once($CFG->dirroot.'/user/profile/lib.php'); |
|
|
|
|
|
$user = $DB->get_record('user',array('id'=>$USER->id)); |
|
|
|
|
|
profile_load_custom_fields($user); |
|
|
|
|
|
foreach ($user->profile as $key => $value) { |
|
|
|
|
|
$body .= '<p>'. $key .': '.$value.'</p>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$body .= '<p>'. html_writer::link(new moodle_url("/enrol/apply/apply.php", array('id'=>$courseid,'enrolid'=>$instanceid)), get_string('applymanage', 'enrol_apply')).'</p>'; |
|
|
$body .= '<p>'. html_writer::link(new moodle_url("/enrol/apply/apply.php", array('id'=>$courseid,'enrolid'=>$instanceid)), get_string('applymanage', 'enrol_apply')).'</p>'; |
|
|
$contact = core_user::get_support_user(); |
|
|
$contact = core_user::get_support_user(); |
|
@ -338,8 +355,9 @@ function sendConfirmMailToManagers($courseid,$info,$applydescription){ |
|
|
foreach($managers as $manager){ |
|
|
foreach($managers as $manager){ |
|
|
$userWithManagerRole = $DB->get_record('user',array('id'=>$manager->userid)); |
|
|
$userWithManagerRole = $DB->get_record('user',array('id'=>$manager->userid)); |
|
|
$body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>'; |
|
|
$body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>'; |
|
|
$body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$info->firstname.' '.$info->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$USER->firstname.' '.$USER->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>'; |
|
|
$body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>'; |
|
|
|
|
|
if($apply_setting['show_standard_user_profile']->value == 0){ |
|
|
$body .= '<p><strong>'. get_string('user_profile', 'enrol_apply').'</strong></p>'; |
|
|
$body .= '<p><strong>'. get_string('user_profile', 'enrol_apply').'</strong></p>'; |
|
|
$body .= '<p>'. get_string('firstname') .': '.$info->firstname.'</p>'; |
|
|
$body .= '<p>'. get_string('firstname') .': '.$info->firstname.'</p>'; |
|
|
$body .= '<p>'. get_string('lastname') .': '.$info->lastname.'</p>'; |
|
|
$body .= '<p>'. get_string('lastname') .': '.$info->lastname.'</p>'; |
|
@ -365,6 +383,17 @@ function sendConfirmMailToManagers($courseid,$info,$applydescription){ |
|
|
$body .= '<p>'. get_string('phone') .': '.$info->phone1.'</p>'; |
|
|
$body .= '<p>'. get_string('phone') .': '.$info->phone1.'</p>'; |
|
|
$body .= '<p>'. get_string('phone2') .': '.$info->phone2.'</p>'; |
|
|
$body .= '<p>'. get_string('phone2') .': '.$info->phone2.'</p>'; |
|
|
$body .= '<p>'. get_string('address') .': '.$info->address.'</p>'; |
|
|
$body .= '<p>'. get_string('address') .': '.$info->address.'</p>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($apply_setting['show_extra_user_profile']->value == 0){ |
|
|
|
|
|
require_once($CFG->dirroot.'/user/profile/lib.php'); |
|
|
|
|
|
$user = $DB->get_record('user',array('id'=>$USER->id)); |
|
|
|
|
|
profile_load_custom_fields($user); |
|
|
|
|
|
foreach ($user->profile as $key => $value) { |
|
|
|
|
|
$body .= '<p>'. $key .': '.$value.'</p>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$body .= '<p>'. html_writer::link(new moodle_url('/enrol/apply/manage.php'), get_string('applymanage', 'enrol_apply')).'</p>'; |
|
|
$body .= '<p>'. html_writer::link(new moodle_url('/enrol/apply/manage.php'), get_string('applymanage', 'enrol_apply')).'</p>'; |
|
|
$contact = core_user::get_support_user(); |
|
|
$contact = core_user::get_support_user(); |
|
|
$info = $userWithManagerRole; |
|
|
$info = $userWithManagerRole; |
|
|