Browse Source

[svn r12195] Debug mails in dokeos (language vars, etc...)

Julian Prud'homme 18 years ago
parent
commit
d99b8c54a1
3 changed files with 22 additions and 27 deletions
  1. 12 13
      main/exercice/exercise_result.php
  2. 5 6
      main/forum/forumfunction.inc.php
  3. 5 8
      main/survey/survey_invite.php

+ 12 - 13
main/exercice/exercise_result.php

@@ -27,7 +27,7 @@
 *	@package dokeos.exercise
 *	@author Olivier Brouckaert, main author
 *	@author Roan Embrechts, some refactoring
-* 	@version $Id: exercise_result.php 12050 2007-04-18 13:05:09Z elixir_julian $
+* 	@version $Id: exercise_result.php 12195 2007-04-30 12:30:38Z elixir_julian $
 *
 *	@todo	split more code up in functions, move functions to library?
 */
@@ -651,7 +651,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
 					$firstName =   $_SESSION['_user']['firstName'];
 					$lastName =   $_SESSION['_user']['lastName'];
 					$mail =  $_SESSION['_user']['mail'];
-					$coursecode =  $_SESSION['_course']['official_code'];
+					$coursecode =  $_SESSION['_course']['id'];
 					$query1 = "SELECT user_id from $main_course_user_table where course_code= '$coursecode' and status = '1' LIMIT 0,1";
 					$result1 = api_sql_query($query1, __FILE__, __LINE__);
 					$temp = mysql_result($result1,0,"user_id");
@@ -907,25 +907,25 @@ color: #000000;
 	//
 	$msg .= "</head>
 <body><br>
-<p>".get_lang('OpenQuestionsAttempted')."
+<p>".get_lang('OpenQuestionsAttempted')." : 
 </p>
-<p>Attempt Details : ><br>
+<p>".get_lang('AttemptDetails')." : ><br>
 </p>
 <table width='730' height='136' border='0' cellpadding='3' cellspacing='3'>
 					<tr>
-    <td width='229' valign='top'  class='mybody'>&nbsp;&nbsp;Course Name</td>
+    <td width='229' valign='top'  class='mybody'>&nbsp;&nbsp;".get_lang('CourseName')."</td>
     <td width='469' valign='top'  class='mybody'>#course#</td>
   </tr>
   <tr>
-    <td width='229' valign='top' class='outerframe'>&nbsp;&nbsp;".get_lang('TestAttempted')."Test Attempted</span></td>
+    <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'>Student's Name </span></td>
+    <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;Student's Email ID </td>
+    <td valign='top' >&nbsp;&nbsp;".get_lang('StudentEmail')." </td>
     <td valign='top'> #mail#</td>
 </tr></table>
 <p><br>
@@ -936,11 +936,11 @@ color: #000000;
   {
   $msg.="
 	<tr>
-    <td width='220' valign='top' bgcolor='E5EDF8'>&nbsp;&nbsp;<span class='style10'>Question</span></td>
+    <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>
   	</tr>
   	<tr>
-    <td width='220' valign='top' bgcolor='E5EDF8'>&nbsp;&nbsp;<span class='style10'>Answer </span></td>
+    <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>";
 
@@ -955,7 +955,7 @@ color: #000000;
 
 	}
 	$msg.="</table><br>
- 	<span class='style16'>Click the following links tp check the answer and give feedbacks,<br>
+ 	<span class='style16'>".get_lang('ClickToCommentAndGiveFeedback').",<br>
 <a href='#url#'>#url#</a></span></body></html>";
 
 
@@ -963,7 +963,6 @@ color: #000000;
 	$mail_content = stripslashes($msg1);
 	$student_name = $_SESSION[_user][firstName].' '.$_SESSION[_user][lastName];
 	$subject = get_lang('OpenQuestionsAttempted');
-	$headers="From:$from_name\r\nReply-to: $to\r\nContent-type: text/html; charset=iso-8859-15";
-	api_mail($student_name, $to, $subject, $mail_content, $from_name, $from, $headers);
+	api_mail_html($student_name, $to, $subject, $mail_content, $from_name, $from);
 }
 ?>

+ 5 - 6
main/forum/forumfunction.inc.php

@@ -2327,20 +2327,19 @@ function send_mail($user_info=array(), $thread_information=array())
 		$thread_link= api_get_path('WEB_CODE_PATH').'forum/viewthread.php?forum='.$thread_information['forum_id'].'&thread='.$thread_information['thread_id'];
 		//http://157.193.57.110/dokeos_cvs/claroline/forum/viewthread.php?forum=12&thread=49
 	}
-	$email_body=get_lang('Dear')." ".$user_info['firstname']." ".$user_info['lastname']."\n\r";
-	$email_body .= '['.$_course['official_code'].'] - ['.$_course['name']."]\n";
+	$email_body= $user_info['firstname']." ".$user_info['lastname']."\n\r";
+	$email_body .= '['.$_course['official_code'].'] - ['.$_course['name']."]<br>\n";
 	$email_body .= get_lang('NewForumPost')."\n";
-	$email_body .= get_lang('YouWantedToStayInformed')."\n";
-	$email_body .= get_lang('ThreadCanBeFoundHere').":".$thread_link."\n";
+	$email_body .= get_lang('YouWantedToStayInformed')."<br><br>\n";
+	$email_body .= get_lang('ThreadCanBeFoundHere')." : <a href=\"".$thread_link."\">".$thread_link."</a>\n";
 
 	//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/html; charset='. $charset;
 	if ($user_info['user_id']<>$_user['user_id'])
 	{
-		$newmail = api_mail($user_info["lastname"].' '.$user_info["firstname"], $user_info["email"], $email_subject, $email_body, $_SESSION['_user']['lastName'].' '.$_SESSION['_user']['firstName'], $_SESSION['_user']['mail'],$encoding);
+		$newmail = api_mail_html($user_info["lastname"].' '.$user_info["firstname"], $user_info["email"], $email_subject, $email_body, $_SESSION['_user']['lastName'].' '.$_SESSION['_user']['firstName'], $_SESSION['_user']['mail']);
 	}
 }
 

+ 5 - 8
main/survey/survey_invite.php

@@ -233,7 +233,9 @@ function save_invitations($users_array, $invitation_title, $invitation_text, $re
 		{
 			// generating the unique code
 			$invitation_code = md5($value.microtime());
-
+			$survey_link = '';
+			$full_invitation_text= '';
+						
 			// storing the invitation (only if the user_id is not in $already_invited['course_users'] OR email is not in $already_invited['additional_users']
 			if ((is_numeric($value) AND !in_array($value,$already_invited['course_users'])) OR (!is_numeric($value) AND !strstr($already_invited['additional_users'], $value)) AND !empty($value))
 			{
@@ -243,11 +245,7 @@ function save_invitations($users_array, $invitation_title, $invitation_text, $re
 
 				// replacing the **link** part with a valid link for the user
 				$survey_link = $_configuration['root_web'].$_configuration['code_append'].'survey/'.'fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$invitation_code;
-				$invitation_text = str_ireplace('**link**', $survey_link ,$invitation_text, $replace_count);
-				if ($replace_count < 1)
-				{
-					$invitation_text = $invitation_text . $survey_link;
-				}
+				$full_invitation_text = $invitation_text . $survey_link;
 
 				// optionally: finding the e-mail of the course user
 				if (is_numeric($value))
@@ -267,9 +265,8 @@ function save_invitations($users_array, $invitation_title, $invitation_text, $re
 				// sending the mail
 				$sender_name  = $_user['firstName'].' '.$_user['lastName'];
 				$sender_email = $_user['mail'];
-				//echo $recipient_name.'-'.$recipient_email.'-'.$invitation_title.'-'.$invitation_text.'-'.$sender_name.'-'.$sender_email.'-';
 				
-				api_mail_html($recipient_name, $recipient_email, $invitation_title, $invitation_text, $sender_name, $sender_email, '');
+				api_mail_html($recipient_name, $recipient_email, $invitation_title, $full_invitation_text, $sender_name, $sender_email, '');
 				//mail($recipient_email, strip_tags($invitation_title), strip_tags($invitation_text));
 				$counter++;
 			}