Fixing email notifications for work and exercises

skala
Julio Montoya 12 years ago
parent a1aee062d7
commit 5e63a43af8
  1. 11
      main/announcements/announcement_email.class.php
  2. 234
      main/exercice/exercise.class.php
  3. 20
      main/exercice/exercise.lib.php
  4. 28
      main/exercice/exercise_result.php
  5. 16
      main/inc/lib/course.lib.php
  6. 7
      main/inc/lib/message.lib.php
  7. 93
      main/work/work.php

@ -255,20 +255,15 @@ class AnnouncementEmail
*/
public function send()
{
$sender = $this->sender();
$sender_name = api_get_person_name($sender['firstName'], $sender['lastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$sender_email = $sender['mail'];
$sender = $this->sender();
$subject = $this->subject();
$message = $this->message();
// Send email one by one to avoid antispam
$users = $this->sent_to();
foreach ($users as $user) {
MessageManager::send_message($user['user_id'], $subject, $message, null, null, null, null, null, null, $sender['user_id']);
//$recipient_name = api_get_person_name($user['firstname'], $user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
//$recipient_email = $user['email'];
//@api_mail_html($recipient_name, $recipient_email, $subject, $message, $sender_name, $sender_email, null, $attachement, true);
MessageManager::send_message_simple($user['user_id'], $subject, $message, $sender['user_id']);
}
$this->log_mail_sent();
}

@ -1858,7 +1858,9 @@ class Exercise {
if ($debug) error_log('manage_answer $learnpath_id: '.$learnpath_id);
if ($debug) error_log('manage_answer $learnpath_item_id: '.$learnpath_item_id);
$extra_data = array();
$extra_data = array();
$arrques = null;
$arrans = null;
$questionId = intval($questionId);
$exeId = intval($exeId);
@ -2300,8 +2302,8 @@ class Exercise {
} else {
$totalScore+=$questionScore;
}
$arrques[] = $questionName;
$arrans[] = $choice;
$arrques = $questionName;
$arrans = $choice;
} else {
$studentChoice = $choice;
if ($studentChoice) {
@ -2324,8 +2326,8 @@ class Exercise {
} else {
$totalScore+=$questionScore;
}
$arrques[] = $questionName;
$arrans[] = $choice;
$arrques = $questionName;
$arrans = $choice;
} else {
$studentChoice = $choice;
if ($studentChoice) {
@ -2495,18 +2497,13 @@ class Exercise {
if ($origin!='learnpath') {
ExerciseShowFunctions::display_fill_in_blanks_answer($answer,0,0);
}
} elseif($answerType == FREE_ANSWER) {
// to store the details of open questions in an array to be used in mail
$arrques[] = $questionName;
$arrans[] = $choice;
} elseif($answerType == FREE_ANSWER) {
if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice,0,0);
}
} elseif($answerType == ORAL_EXPRESSION) {
// to store the details of open questions in an array to be used in mail
$arrques[] = $questionName;
$arrans[] = $choice;
if($origin != 'learnpath') {
// to store the details of open questions in an array to be used in mail
if ($origin != 'learnpath') {
ExerciseShowFunctions::display_oral_expression_answer($choice, 0, 0, $nano);
}
} elseif($answerType == HOT_SPOT) {
@ -2744,8 +2741,7 @@ class Exercise {
$max_coord = poly_get_max($poly_user,$poly_answer);
$poly_user_compiled = poly_compile($poly_user,$max_coord);
$poly_answer_compiled = poly_compile($poly_answer,$max_coord);
$poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
$poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
$overlap = $poly_results['both'];
$poly_answer_area = $poly_results['s1'];
@ -3187,7 +3183,13 @@ class Exercise {
if ($debug) error_log($sql_update);
Database::query($sql_update);
}
$return_array = array('score'=>$questionScore, 'weight'=>$questionWeighting,'extra'=>$extra_data);
$return_array = array( 'score' => $questionScore,
'weight' => $questionWeighting,
'extra' => $extra_data,
'open_question' => $arrques,
'open_answer' => $arrans
);
return $return_array;
} //End function
@ -3195,148 +3197,88 @@ class Exercise {
* Sends a notification when a user ends an examn
*
*/
function send_notification($arrques, $arrans, $origin) {
function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) {
if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
return '';
}
return null;
}
// Email configuration settings
$coursecode = api_get_course_id();
$course_info = api_get_course_info(api_get_course_id());
$to = '';
$teachers = array();
if (api_get_session_id()) {
$teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id());
} else {
$teachers = CourseManager::get_teacher_list_from_course_code($coursecode);
}
$num = count($teachers);
if ($num > 1) {
$to = array();
foreach($teachers as $teacher) {
$to[] = $teacher['email'];
}
} elseif ($num>0){
foreach($teachers as $teacher) {
$to = $teacher['email'];
}
} else {
//this is a problem (it means that there is no admin for this course)
}
$url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$this->id;
$url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify';
$user_info = UserManager::get_user_info_by_id(api_get_user_id());
$mycharset = api_get_system_encoding();
$msg = '<html><head>
<link rel="stylesheet" href="'.api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/default.css" type="text/css">
<meta content="text/html; charset='.$mycharset.'" http-equiv="content-type"></head>';
if (count($arrques) > 0) {
$msg .= '<body>
<p>'.get_lang('OpenQuestionsAttempted').' :
</p>
<p>'.get_lang('AttemptDetails').' : <br />
</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="229" valign="top"><h2>&nbsp;&nbsp;'.get_lang('CourseName').'</h2></td>
<td width="469" valign="top"><h2>#course#</h2></td>
</tr>
<tr>
<td width="229" valign="top" class="outerframe">&nbsp;&nbsp;'.get_lang('TestAttempted').'</span></td>
<td width="469" valign="top" class="outerframe">#exercise#</td>
</tr>
<tr>
<td valign="top">&nbsp;&nbsp;<span class="style10">'.get_lang('StudentName').'</span></td>
<td valign="top" >#firstName# #lastName#</td>
</tr>
<tr>
<td valign="top" >&nbsp;&nbsp;'.get_lang('StudentEmail').' </td>
<td valign="top"> #mail#</td>
</tr></table>
<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
for($i=0;$i<sizeof($arrques);$i++) {
$msg.='
$msg = '<p>'.get_lang('OpenQuestionsAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;<span class="style10">'.get_lang('Question').'</span></td>
<td width="473" valign="top" bgcolor="#F3F3F3"><span class="style16"> #questionName#</span></td>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;<span class="style10">'.get_lang('Answer').' </span></td>
<td valign="top" bgcolor="#F3F3F3"><span class="style16"> #answer#</span></td>
</tr>';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'],$msg1);
$msg1 = str_replace("#lastName#", $user_info['lastname'],$msg);
$msg = str_replace("#mail#", $user_info['email'],$msg1);
$msg1 = str_replace("#questionName#",$arrques[$i],$msg);
$msg = str_replace("#answer#", $arrans[$i],$msg1);
$msg1 = str_replace("#i#", $i,$msg);
$msg = str_replace("#course#", $course_info['name'],$msg1);
}
$msg.='</table><br />';
if ($origin != 'learnpath') {
$msg.= '<span class="style16">'.get_lang('ClickToCommentAndGiveFeedback').',<br />
<a href="#url#">#url#</a></span>';
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#mail#</td>
</tr>
</table>';
$open_question_list = null;
foreach ($question_list_answers as $item) {
$question = $item['question'];
$answer = $item['answer'];
if (!empty($question) && !empty($answer)) {
$open_question_list.='<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>
<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>
<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>
</tr>';
}
}
$msg.= '</body></html>';
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
$subject = get_lang('OpenQuestionsAttempted');
if (!empty($open_question_list)) {
$msg .= '<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= $open_question_list;
$msg.='</table><br />';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'],$msg1);
$msg1 = str_replace("#lastName#", $user_info['lastname'],$msg);
$msg = str_replace("#mail#", $user_info['email'],$msg1);
$msg = str_replace("#course#", $course_info['name'],$msg1);
if ($origin != 'learnpath') {
$msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
$subject = get_lang('OpenQuestionsAttempted');
$teachers = array();
if (api_get_session_id()) {
$teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id());
} else {
$teachers = CourseManager::get_teacher_list_from_course_code($coursecode);
}
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
$result = @api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset));
} else {
$msg .= '<body>
<p>'.get_lang('ExerciseAttempted').'</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="229" valign="top"><h2>'.get_lang('CourseName').'</h2></td>
<td width="469" valign="top"><h2>#course#</h2></td>
</tr>
<tr>
<td width="229" valign="top" class="outerframe">&nbsp;&nbsp;'.get_lang('TestAttempted').'</span></td>
<td width="469" valign="top" class="outerframe">#exercise#</td>
</tr>
<tr>
<td valign="top">&nbsp;&nbsp;<span class="style10">'.get_lang('StudentName').'</span></td>
'.(api_is_western_name_order() ? '<td valign="top" >#firstName# #lastName#</td>' : '<td valign="top" >#lastName# #firstName#</td>').'
</tr>
<tr>
<td valign="top" >&nbsp;&nbsp;'.get_lang('StudentEmail').' </td>
<td valign="top"> #mail#</td>
</tr></table>';
$msg= str_replace("#exercise#", $this->exercise,$msg);
$msg= str_replace("#firstName#", $user_info['firstname'], $msg);
$msg= str_replace("#lastName#", $user_info['lastname'], $msg);
$msg= str_replace("#mail#", $user_info['email'], $msg);
$msg= str_replace("#course#", $course_info['name'], $msg);
if ($origin != 'learnpath') {
$msg.='<br />
<span class="style16">'.get_lang('ClickToCommentAndGiveFeedback').',<br />
<a href="#url#">#url#</a></span>';
}
$msg .= '</body></html>';
$msg = str_replace("#url#", $url_email, $msg);
$mail_content = $msg;
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
$subject = get_lang('ExerciseAttempted');
$result = @api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset));
}
foreach ($teachers as $user_id => $teacher_data) {
MessageManager::send_message_simple($user_id, $subject, $mail_content);
}
}
}
function show_exercise_result_header($user_data, $date = null) {

@ -1934,8 +1934,6 @@ function delete_chat_exercise_session($exe_id) {
}
}
function display_question_list_by_attempt($objExercise, $exe_id, $save_user_result = false) {
global $origin;
@ -1948,8 +1946,7 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
$counter = 1;
$total_score = $total_weight = 0;
$exercise_content = null;
$exercise_content = null;
//Hide results
$show_results = false;
@ -1981,7 +1978,8 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
echo "<div class='clear'>&nbsp;</div>";
}
}
$question_list_answers = array();
// Loop over all question to show results for each of them, one by one
if (!empty($question_list)) {
@ -2002,6 +2000,7 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
$total_score += $result['score'];
$total_weight += $result['weight'];
$question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer']);
$my_total_score = $result['score'];
$my_total_weight = $result['weight'];
@ -2068,19 +2067,20 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
echo $total_score_text;
if ($save_user_result) {
// Tracking of results
$learnpath_id = $exercise_stat_info['orig_lp_id'];
$learnpath_item_id = $exercise_stat_info['orig_lp_item_id'];
$learnpath_item_view_id = $exercise_stat_info['orig_lp_item_view_id'];
if (api_is_allowed_to_session_edit()) {
update_event_exercice($exercise_stat_info['exe_id'], $objExercise->selectId(), $total_score, $total_weight, api_get_session_id(), $learnpath_id, $learnpath_item_id, $learnpath_item_view_id, $exercise_stat_info['exe_duration'], $question_list, '', array(), $end_date);
}
// Send notification ..
if (!api_is_allowed_to_edit(null,true)) {
$objExercise->send_notification_for_open_questions($question_list_answers, $origin, $exe_id);
}
}
}

@ -135,7 +135,6 @@ Display :: display_normal_message(get_lang('Saved').'<br />',false);
display_question_list_by_attempt($objExercise, $exe_id, true);
//If is not valid
$session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
@ -152,23 +151,26 @@ delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
echo '<hr>';
echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-large'));
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');
Session::erase('exe_id');
}
Display::display_footer();
} else {
$lp_mode = $_SESSION['lp_mode'];
$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
//echo $total_score.','.$total_weight; exit;
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
echo '<script type="text/javascript">'.$href.'</script>'."\n";
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');
Session::erase('exe_id');
}
echo '<script type="text/javascript">'.$href.'</script>';
//record the results in the learning path, using the SCORM interface (API)
echo '<script type="text/javascript">window.parent.API.void_save_asset('.$total_score.','.$total_weight.');</script>'."\n";
echo '<script type="text/javascript">window.parent.API.void_save_asset('.$total_score.','.$total_weight.');</script>';
echo '</body></html>';
}
// Send notification..
if (!api_is_allowed_to_edit(null,true)) {
$objExercise->send_notification($arrques, $arrans, $origin);
}
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');
Session::erase('exe_id');
}

@ -1112,19 +1112,19 @@ class CourseManager {
* Return user info array of all users registered in the specified real or virtual course
* This only returns the users that are registered in this actual course, not linked courses.
*
* @param string $course_code the code of the course
* @param boolean $with_session determines if the course is used in a session or not
* @param integer $session_id the id of the session
* @param string $limit the LIMIT statement of the sql statement
* @param string $order_by the field to order the users by. Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement that starts with ORDER BY ...
* @param int 0 or 2 (student, coach) if using the session id, STUDENT or COURSEMANAGER if using session_id = 0
* @param string $course_code the code of the course
* @param boolean $with_session determines if the course is used in a session or not
* @param integer $session_id the id of the session
* @param string $limit the LIMIT statement of the sql statement
* @param string $order_by the field to order the users by. Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement that starts with ORDER BY ...
* @param int if using the session_id: 0 or 2 (student, coach), if using session_id = 0 STUDENT or COURSEMANAGER
* @return array
*/
public static function get_user_list_from_course_code($course_code, $session_id = 0, $limit = '', $order_by = '', $filter_by_status = null) {
// variable initialisation
$session_id = intval($session_id);
$course_code = Database::escape_string($course_code);
$where = array();
$course_code = Database::escape_string($course_code);
$where = array();
// if the $order_by does not contain 'ORDER BY' we have to check if it is a valid field that can be sorted on
if (!strstr($order_by,'ORDER BY')) {

@ -318,6 +318,13 @@ class MessageManager
return false;
}
/**
* A handy way to send message
*/
public static function send_message_simple($receiver_user_id, $subject, $message, $sender_id = null) {
return MessageManager::send_message($receiver_user_id, $subject, $message, null, null, null, null, null, null, $sender_id);
}
/**
* Update parent ids for other receiver user from current message in groups
* @author Christian Fasanando Flores

@ -680,88 +680,39 @@ switch ($action) {
//Bad token or can't add works
$error_message = get_lang('IsNotPosibleSaveTheDocument');
}
if (!empty($succeed) && !empty($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');
if ($send > 0) {
// Lets predefine some variables. Be sure to change the from address!
$emailto = array ();
// Lets predefine some variables. Be sure to change the from address!
if (empty($id_session)) {
$sql_resp = 'SELECT u.email as myemail FROM ' . $table_course_user . ' cu, ' . $table_user . ' u
WHERE cu.course_code = ' . "'" . api_get_course_id() . "'" . ' AND cu.status = 1 AND u.user_id = cu.user_id';
$res_resp = Database::query($sql_resp);
while ($row_email = Database :: fetch_array($res_resp)) {
if (!empty ($row_email['myemail'])) {
$emailto[$row_email['myemail']] = $row_email['myemail'];
}
}
//Teachers
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), null, null, null, COURSEMANAGER);
} else {
// coachs of the session
$sql_resp = 'SELECT user.email as myemail
FROM ' . $table_session . ' session INNER JOIN ' . $table_user . ' user
ON user.user_id = session.id_coach
WHERE session.id = ' . intval($id_session);
$res_resp = Database::query($sql_resp);
while ($row_email = Database :: fetch_array($res_resp)) {
if (!empty ($row_email['myemail'])) {
$emailto[$row_email['myemail']] = $row_email['myemail'];
}
}
//coach of the course
$sql_resp = 'SELECT user.email as myemail
FROM ' . $table_session_course_user . ' scu
INNER JOIN ' . $table_user . ' user
ON user.user_id = scu.id_user AND scu.status=2
WHERE scu.id_session = ' . intval($id_session);
$res_resp = Database::query($sql_resp);
while ($row_email = Database :: fetch_array($res_resp)) {
if (!empty ($row_email['myemail'])) {
$emailto[$row_email['myemail']] = $row_email['myemail'];
}
}
//Coaches
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id, null, null, 2);
}
if (count($emailto) > 0) {
$emailto = implode(',', $emailto);
$emailsubject = "[" . api_get_setting('siteName') . "] ";
$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
$email_admin = api_get_setting('emailAdministrator');
// The body can be as long as you wish, and any combination of text and variables
$emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n";
$emailbody .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n";
$emailbody .= get_lang('UserName')." : ".$currentUserFirstName .' '.$currentUserLastName ."\n";
$emailsubject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']." ";
foreach ($user_list as $user_data) {
$user_id = $user_data;
$emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n";
//$emailbody .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n";
$emailbody .= get_lang('UserName')." : ".api_get_person_name($user_data['firstname'], $user_data['lastname'])."\n";
$emailbody .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$emailbody .= get_lang('FileName')." : ".$title."\n\n".get_lang('DownloadLink')."\n";
$emailbody .= api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&amp;curdirpath=".$my_cur_dir_path."\n\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator');
$emailbody .= get_lang('WorkName')." : ".$title."\n\n".get_lang('DownloadLink')."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&amp;id=".$work_id;
$emailbody .= Display::url($url, $url)." \n\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator');
// Here we are forming one large header line
// Every header must be followed by a \n except the last
@api_mail('', $emailto, $emailsubject, $emailbody, $sender_name,$email_admin);
$emailbody_user = get_lang('Dear')." ".$currentUserFirstName .' '.$currentUserLastName .", \n\n";
$emailbody_user .= get_lang('MessageConfirmSendingOfTask')."\n".get_lang('CourseName')." : ".$_course['name']."\n";
$emailbody_user .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n";
$emailbody_user .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$emailbody_user .= get_lang('FileName')." : ".$title."\n\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator');;
//Mail to user
//var_dump($currentUserEmail, $emailsubject, $emailbody_user, $sender_name, $email_admin);
@api_mail('', $currentUserEmail, $emailsubject, $emailbody_user, $sender_name, $email_admin);
}
}
$message = get_lang('DocAdd');
//stats
if (!$Id) {
$Id = $insertId;
MessageManager::send_message_simple($user_id, $emailsubject, $emailbody);
}
}
event_upload($Id);
$message = get_lang('DocAdd');
event_upload($id);
Display :: display_confirmation_message(get_lang('DocAdd'), false);
} else {
if (!empty($error_message)) {

Loading…
Cancel
Save