Fix message with survey invitations sent - refs BT#12554

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent 739bc758ab
commit ba5fc44f12
  1. 20
      main/survey/surveyUtil.class.php
  2. 19
      main/survey/survey_invite.php

@ -2054,22 +2054,28 @@ class SurveyUtil
* This function saves all the invitations of course users and additional users in the database * This function saves all the invitations of course users and additional users in the database
* and sends the invitations by email * and sends the invitations by email
* *
* @param array Users array can be both a list of course uids AND a list of additional emailaddresses * @param $users_array Users $array array can be both a list of course uids AND a list of additional emailaddresses
* @param string Title of the invitation, used as the title of the mail * @param $invitation_title Title $string of the invitation, used as the title of the mail
* @param string Text of the invitation, used as the text of the mail. * @param $invitation_text Text $string of the invitation, used as the text of the mail.
* The text has to contain a **link** string or this will automatically be added to the end * The text has to contain a **link** string or this will automatically be added to the end
* @param int $reminder
* @param bool $sendmail
* @param int $remindUnAnswered
* @return int * @return int
* @internal param
* @internal param
* @internal param
* The text has to contain a **link** string or this will automatically be added to the end
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Julio Montoya - Adding auto-generated link support * @author Julio Montoya - Adding auto-generated link support
* @version January 2007 * @version January 2007
*
*/ */
public static function saveInvitations( public static function saveInvitations(
$users_array, $users_array,
$invitation_title, $invitation_title,
$invitation_text, $invitation_text,
$reminder = 0, $reminder = 0,
$sendmail = 0, $sendmail = false,
$remindUnAnswered = 0 $remindUnAnswered = 0
) { ) {
if (!is_array($users_array)) { if (!is_array($users_array)) {
@ -2163,7 +2169,7 @@ class SurveyUtil
} }
// Send the email if checkboxed // Send the email if checkboxed
if (($new_user || $reminder == 1) && $sendmail != 0) { if (($new_user || $reminder == 1) && $sendmail) {
// Make a change for absolute url // Make a change for absolute url
if (isset($invitation_text)) { if (isset($invitation_text)) {
$invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES); $invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES);

@ -171,7 +171,12 @@ $form->addElement('label', null, $auto_survey_link);
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
if (isset($values['send_mail']) && $values['send_mail'] == 1) {
$resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : '';
$sendMail = isset($values['send_mail']) ? $values['send_mail'] : '';
$remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : '';
if ($sendMail) {
if (empty($values['mail_title']) || empty($values['mail_text'])) { if (empty($values['mail_title']) || empty($values['mail_text'])) {
Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete')); Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete'));
// Getting the invited users // Getting the invited users
@ -197,10 +202,6 @@ if ($form->validate()) {
!empty($survey_data['invite_mail']) !empty($survey_data['invite_mail'])
); );
$resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : '';
$sendMail = isset($values['send_mail']) ? $values['send_mail'] : '';
$remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : '';
// Saving the invitations for the course users // Saving the invitations for the course users
$count_course_users = SurveyUtil::saveInvitations( $count_course_users = SurveyUtil::saveInvitations(
$values['users'], $values['users'],
@ -248,8 +249,12 @@ if ($form->validate()) {
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'. $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
$total_invited.'</a> '; $total_invited.'</a> ';
$message .= get_lang('WereInvited'); $message .= get_lang('WereInvited');
Display::display_normal_message($message, false);
Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend')); echo Display::return_message($message, 'normal', false);
if ($sendMail) {
echo Display::return_message($total_count.' '.get_lang('InvitationsSend'), 'success', false);
}
} }
} else { } else {
// Getting the invited users // Getting the invited users

Loading…
Cancel
Save