diff --git a/main/work/work.lib.php b/main/work/work.lib.php index d7a57ec56c..3b13b68c04 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -773,7 +773,7 @@ function create_unexisting_work_directory($base_work_dir, $desired_dir_name) /** * Delete a work-tool directory - * @param int $id work id to delete + * @param int $id work directory id to delete * @return integer -1 on error */ function deleteDirWork($id) @@ -3535,6 +3535,8 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo } /** + * Send an e-mail to users related to this work (course teachers, usually, but + * might include other group members) * @param int $workId * @param array $courseInfo * @param int $session_id @@ -3542,7 +3544,8 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo function sendAlertToUsers($workId, $courseInfo, $session_id) { $user_list = array(); - $workData = get_work_assignment_by_id($workId, $courseInfo['real_id']); + //$workData = get_work_assignment_by_id($workId, $courseInfo['real_id']); + $workData = get_work_data_by_id($workId, $courseInfo['real_id'], $session_id); //last value is to check this is not "just" an edit //YW Tis part serve to send a e-mail to the tutors when a new file is sent $send = api_get_course_setting('email_alert_manager_on_new_doc'); @@ -3598,15 +3601,15 @@ function sendAlertToUsers($workId, $courseInfo, $session_id) null, PERSON_NAME_EMAIL_ADDRESS ); - $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']." "; + $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']." "; foreach ($user_list as $user_data) { $to_user_id = $user_data['user_id']; $user_info = api_get_user_info($to_user_id); $message = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']."\n"; $message .= get_lang('UserName')." : ".api_get_person_name($user_info['firstname'], $user_info['lastname'])."\n"; $message .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n"; - $message .= get_lang('WorkName')." : ".$workData['title']."\n\n".get_lang('DownloadLink')."\n"; $url = api_get_path(WEB_CODE_PATH)."work/work.php?cidReq=".$courseInfo['code']."&id_session=".$session_id."&id=".$workData['id']; + $message .= get_lang('WorkName')." : ".$workData['title']."\n\n".''.get_lang('DownloadLink')."\n"; $message .= $url; MessageManager::send_message_simple($to_user_id, $subject, $message); api_mail_html(