Adding validation email_alert_manager_on_new_quiz

skala
Julio Montoya 15 years ago
parent 5d2831cb0d
commit f6079493c0
  1. 53
      main/exercice/exercise_result.php
  2. 6
      main/exercice/exercise_show.php

@ -1,24 +1,5 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2008 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /chamilo_license.txt */
/**
* Exercise result
* This script gets informations from the script "exercise_submit.php",
@ -1102,15 +1083,18 @@ if($num>1) {
}
//------
if ($origin != 'learnpath')
if(count($arrques)>0) {
// we are able to send emails to the teachers?
if (api_get_course_setting('email_alert_manager_on_new_quiz') == 1 ) {
// only for "simple tests"
if ($origin != 'learnpath') {
//has a unique answer?
$mycharset = api_get_setting('platform_charset');
$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">';
$msg .= '</head>
<meta content="text/html; charset='.$mycharset.'" http-equiv="content-type"></head>';
if(count($arrques)>0) {
$msg .= '
<body><br />
<p>'.get_lang('OpenQuestionsAttempted').' :
</p>
@ -1167,15 +1151,9 @@ if(count($arrques)>0) {
$email_admin = api_get_setting('emailAdministrator');
$subject = get_lang('OpenQuestionsAttempted');
echo $mail_content;
$result = api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset));
} else {
$mycharset = api_get_setting('platform_charset');
$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">';
$msg .= '</head>
<body>
} else {
$msg .= '<body>
<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>
@ -1204,7 +1182,6 @@ if(count($arrques)>0) {
<span class="style16">'.get_lang('ClickToCommentAndGiveFeedback').',<br />
<a href="#url#">#url#</a></span></body></html>';
$msg= str_replace("#url#",$url,$msg);
$mail_content = $msg;
@ -1212,10 +1189,8 @@ if(count($arrques)>0) {
$email_admin = api_get_setting('emailAdministrator');
$subject = get_lang('ExerciseAttempted');
var_dump($to);
echo ($mail_content);
$result = api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset));
var_dump($result);
}
}
}
?>

@ -1,5 +1,5 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
*
* @package dokeos.exercise
@ -1267,6 +1267,10 @@ function send_notification($arrques, $arrans, $to) {
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
$user_info = UserManager::get_user_info_by_id(api_get_user_id());
if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
return '';
}
$mycharset = api_get_setting('platform_charset');
$msg = '<html><head>
<link rel="stylesheet" href="'.api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/default.css" type="text/css">

Loading…
Cancel
Save