Feature #2099 -Course validation: Implementing e-mail requests for additional information about future courses/trainings.

skala
Ivan Tcholakov 15 years ago
parent 6eb7e7eef3
commit d9355b3263
  1. 57
      main/inc/lib/course_request.lib.php
  2. 1
      main/lang/bulgarian/create_course.inc.php
  3. 1
      main/lang/english/create_course.inc.php

@ -307,11 +307,64 @@ class CourseRequestManager {
public static function ask_for_additional_info($id) {
$id = (int)$id;
// Retrieve request's data
$course_request_info = CourseRequestManager::get_course_request_info($id);
if (!is_array($course_request_info)) {
return false;
}
$user_id = intval($course_request_info['user_id']);
if ($user_id <= 0) {
return false;
}
$user_info = api_get_user_info($user_id);
if (!is_array($user_info)) {
return false;
}
$code = $course_request_info['code'];
$info = intval($course_request_info['info']);
// Error is to be returned on a repeated attempt for asking additional information.
if (!empty($info)) {
return false;
}
// E-mail notification.
// E-mail language: The platform language seems to be the best choice.
//$email_language = $course_language;
//$email_language = api_get_interface_language();
$email_language = api_get_setting('platformLanguage');
$email_subject = sprintf(get_lang('CourseRequestAskInfoEmailSubject', null, $email_language), '['.api_get_setting('siteName').']', $code);
$email_body = get_lang('Dear', null, $email_language).' ';
$email_body .= api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, $email_language).",\n\n";
$email_body .= sprintf(get_lang('CourseRequestAskInfoEmailText', null, $email_language), $code)."\n";
$email_body .= "\n".get_lang('Formula', null, $email_language)."\n";
$email_body .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, null, $email_language)."\n";
$email_body .= get_lang('Manager', null, $email_language).' '.api_get_setting('siteName')."\n";
$email_body .= get_lang('Phone', null, $email_language).': '.api_get_setting('administratorTelephone')."\n";
$email_body .= get_lang('Email', null, $email_language).': '.api_get_setting('emailAdministrator', null, $email_language)."\n";
$email_body .= "\n".get_lang('CourseRequestLegalNote', null, $email_language)."\n";
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$sender_email = get_setting('emailAdministrator');
$recipient_name = api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$recipient_email = $user_info['mail'];
$extra_headers = 'Bcc: '.$sender_email;
$result = @api_mail($recipient_name, $recipient_email, $email_subject, $email_body, $sender_name, $sender_email);
if (!$result) {
return false;
}
// Marking the fact that additional information about the request has been asked.
$sql = "UPDATE ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." SET info = 1 WHERE id = ".$id;
$result = Database::query($sql) !== false;
// TODO: Send the e-mail.
return $result;
}

@ -137,4 +137,5 @@ $CourseRequestPageForApproval = "Тази заявка може да бъде о
$PleaseActivateCourseValidationFeature = "Функцията \"Одобряване на курсове\" не е активна в момента. За да я активирате използвайте настройката %s.";
$CourseRequestLegalNote = "Информацията в тази заявка е защитена; тя може да служи само за обслужване на процедурата по откриване на нов учебен курс в нашия учебен портал; тя не може да бъде разкривана пред трети страни.";
$CourseRequestAskInfoEmailSubject = "%s Искане за допълнителна информация относно заявката за нов курс %s";
$CourseRequestAskInfoEmailText = "Получихме вашата заявка за нов курс с код %s. За да я разгледаме за одобрение, ние се нуждаем от допълнителна информация.\n\nМоля, изпратете ни информация относно съдържанието на курса (описание), относно целите на курса и относно курсистите (целевата аудитория). Ако е приложимо, споменете институцията или организационното звено, от чието име сте подали заявката.";
?>

@ -137,4 +137,5 @@ $CourseRequestPageForApproval = "This training request can be accepted (approved
$PleaseActivateCourseValidationFeature = "The \"Training validation\" feature is not active at the moment. In order to use this feature, please, activate it by using the setting %s.";
$CourseRequestLegalNote = "The information of this training request is considered as protected; it can be used only for serving the procedure of opening a new training within our training portal; it should not be revealed to third parties.";
$CourseRequestAskInfoEmailSubject = "%s A request for additional information about the training request %s";
$CourseRequestAskInfoEmailText = "We have received your request for a new training with code %s. But before we consider it for approval we need some additional information.\n\nPlease, provide brief information about the training content (description), the objectives, the students or the users that are to be involved in the proposed training. If it is applicable, mention the name of the institution or the unit on which behalf you made the training request.";
?>
Loading…
Cancel
Save