|
|
|
|
@ -981,29 +981,19 @@ function edit_advalvas_item($id,$emailTitle,$newContent,$to,$file = array(), $fi |
|
|
|
|
*/ |
|
|
|
|
function send_announcement_email($user_list, $course_code, $_course, $mail_title, $mail_content) |
|
|
|
|
{ |
|
|
|
|
global $charset; |
|
|
|
|
global $_user; |
|
|
|
|
|
|
|
|
|
foreach ($user_list as $this_user) { |
|
|
|
|
/* Header : Bericht van uw lesgever - GES ($course_code) - Morgen geen les! ($mail_title) |
|
|
|
|
Body : John Doe (prenom + nom) <john_doe@hotmail.com> (email) |
|
|
|
|
Morgen geen les! ($mail_title) |
|
|
|
|
Morgen is er geen les, de les wordt geschrapt wegens vergadering (newContent) |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
$mail_subject = get_lang('professorMessage').' - '.$_course['official_code'].' - '.$mail_title; |
|
|
|
|
|
|
|
|
|
$mail_body = '['.$_course['official_code'].'] - ['.$_course['name']."]\n"; |
|
|
|
|
$mail_body .= api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).' <'.$this_user["email"]."> \n\n".stripslashes($mail_title)."\n\n".trim(stripslashes(api_html_entity_decode(strip_tags(str_replace(array('<p>','</p>','<br />'),array('',"\n","\n"),$mail_content)), ENT_QUOTES, $charset)))." \n\n-- \n"; |
|
|
|
|
$mail_body .= api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).' <'.$this_user["email"]."> \n\n".stripslashes($mail_title)."\n\n".trim(stripslashes(api_html_entity_decode(strip_tags(str_replace(array('<p>','</p>','<br />'),array('',"\n","\n"),$mail_content)), ENT_QUOTES, api_get_system_encoding())))." \n\n-- \n"; |
|
|
|
|
$mail_body .= api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS).' '; |
|
|
|
|
$mail_body .= '<'.$_user['mail'].">\n"; |
|
|
|
|
$mail_body .= $_course['official_code'].' '.$_course['name']; |
|
|
|
|
|
|
|
|
|
//set the charset and use it for the encoding of the email - small fix, not really clean (should check the content encoding origin first) |
|
|
|
|
//here we use the encoding used for the webpage where the text is encoded (ISO-8859-1 in this case) |
|
|
|
|
if(empty($charset)){$charset='ISO-8859-1';} |
|
|
|
|
$encoding = 'Content-Type: text/plain; charset='. $charset; |
|
|
|
|
|
|
|
|
|
$newmail = api_mail(api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $this_user['email'], $mail_subject, $mail_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail'], $encoding); |
|
|
|
|
api_mail(api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $this_user['email'], $mail_subject, $mail_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1108,7 +1098,7 @@ function add_announcement_attachment_file($announcement_id, $file_comment, $file |
|
|
|
|
$announcement_id = intval($announcement_id); |
|
|
|
|
|
|
|
|
|
if (is_array($file) && $file['error'] == 0 ) { |
|
|
|
|
$courseDir = $_course['path'].'/upload/announcements'; |
|
|
|
|
$courseDir = $_course['path'].'/upload/announcements'; // TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
|
|
|
|
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
|
|
|
$updir = $sys_course_path.$courseDir; |
|
|
|
|
|
|
|
|
|
@ -1150,7 +1140,7 @@ function edit_announcement_attachment_file($id_attach, $file, $file_comment) { |
|
|
|
|
$return = 0; |
|
|
|
|
|
|
|
|
|
if (is_array($file) && $file['error'] == 0 ) { |
|
|
|
|
$courseDir = $_course['path'].'/upload/announcements'; |
|
|
|
|
$courseDir = $_course['path'].'/upload/announcements'; // TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
|
|
|
|
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
|
|
|
$updir = $sys_course_path.$courseDir; |
|
|
|
|
|
|
|
|
|
|