Following coding standards -refs #6803

1.9.x
unknown 11 years ago
parent 939325c9e0
commit 1dbe51557d
  1. 2
      main/announcements/announcement_email.class.php
  2. 24
      main/announcements/announcements.inc.php

@ -199,7 +199,7 @@ class AnnouncementEmail
$content = $this->announcement('content');
$content = stripslashes($content);
$content = AnnouncementManager::parse_content_email($content, $this->course('code'));
$content = AnnouncementManager::parseContentEmail($content, $this->course('code'));
$user_email = $this->sender('mail');
$course_param = api_get_cidreq();

@ -56,25 +56,25 @@ class AnnouncementManager {
* @return string with the parsed content
*/
public static function parse_content_email($content, $course_code) {
$reader_info = api_get_user_info(api_get_user_id());
$course_info = api_get_course_info($course_code);
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_info['code']);
public static function parseContentEmail($content, $courseCode) {
$readerInfo = api_get_user_info(api_get_user_id());
$courseInfo = api_get_course_info($courseCode);
$teacherList = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
$teacher_name = '';
if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher_data) {
$teacher_name = api_get_person_name($teacher_data['firstname'], $teacher_data['lastname']);
$teacher_email = $teacher_data['email'];
$teacherName = '';
if (!empty($teacherList)) {
foreach ($teacherList as $teacherData) {
$teacherName = api_get_person_name($teacherData['firstname'], $teacherData['lastname']);
$teacherEmail = $teacherData['email'];
break;
}
}
$data['user_name'] = '((user_name))';
$data['user_firstname'] = '((user_firstname))';
$data['user_lastname'] = '((user_lastname))';
$data['teacher_name'] = $teacher_name;
$data['teacher_email'] = $teacher_email;
$data['course_title'] = $course_info['name'];
$data['teacher_name'] = $teacherName;
$data['teacher_email'] = $teacherEmail;
$data['course_title'] = $courseInfo['name'];
$data['course_link'] = Display::url($course_link, $course_link);
$content = str_replace(self::get_tags(), $data, $content);

Loading…
Cancel
Save