WIP: Add config "send_notification_when_document_added" BT#13964

pull/2459/head
jmontoyaa 8 years ago
parent f2c62513b6
commit f12154c597
  1. 34
      main/inc/lib/message.lib.php
  2. 5
      main/install/configuration.dist.php

@ -2323,4 +2323,38 @@ class MessageManager
return $list; return $list;
} }
/**
* @param string $subject
* @param string $message
* @param array $courseInfo
* @param int $sessionId
*
* @return bool
*/
public static function sendMessageToAllUsersInCourse($subject, $message, $courseInfo, $sessionId = 0)
{
if (empty($courseInfo)) {
return false;
}
$senderId = api_get_user_id();
if (empty($senderId)) {
return false;
}
if (empty($sessionId)) {
// Course students and teachers
$users = CourseManager::get_user_list_from_course_code($courseInfo['code']);
} else {
// Course-session students and course session coaches
$users = CourseManager::get_user_list_from_course_code($courseInfo['code'], $sessionId);
}
if (empty($users)) {
return false;
}
foreach ($users as $userInfo) {
self::send_message_simple($userInfo['user_id'], $subject, $message, $senderId);
}
}
} }

@ -488,6 +488,8 @@ ALTER TABLE c_survey_question ADD is_required TINYINT(1) DEFAULT 0 NOT NULL;
//$_configuration['allow_career_diagram'] = false; //$_configuration['allow_career_diagram'] = false;
// Allow scheduled emails to session users. // Allow scheduled emails to session users.
//CREATE TABLE scheduled_announcements (id INT AUTO_INCREMENT NOT NULL, subject VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, date DATETIME DEFAULT NULL, sent TINYINT(1) NOT NULL, session_id INT NOT NULL, c_id INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; //CREATE TABLE scheduled_announcements (id INT AUTO_INCREMENT NOT NULL, subject VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, date DATETIME DEFAULT NULL, sent TINYINT(1) NOT NULL, session_id INT NOT NULL, c_id INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
// sudo mkdir app/upload/scheduled_announcement
// Add "attachment" file extra field in: main/admin/extra_fields.php?type=scheduled_announcement&action=add
//$_configuration['allow_scheduled_announcements'] = false; //$_configuration['allow_scheduled_announcements'] = false;
// Add the list of emails as a bcc when sending an email. // Add the list of emails as a bcc when sending an email.
/* /*
@ -658,6 +660,9 @@ $_configuration['gradebook_badge_sidebar'] = [
// Send email notification to admin when a user is created // Send email notification to admin when a user is created
//$_configuration['send_notification_when_user_added'] = ['admins' => [1] ]; //$_configuration['send_notification_when_user_added'] = ['admins' => [1] ];
// Send email notification to course members when document is added BT#13964
//$_configuration['send_notification_when_document_added'] = false;
// Hide email content forcing using to click in a link to visit the portal to check the message // Hide email content forcing using to click in a link to visit the portal to check the message
//$_configuration['messages_hide_mail_content'] = false; //$_configuration['messages_hide_mail_content'] = false;
// If you install plugin redirection you need to change to true // If you install plugin redirection you need to change to true

Loading…
Cancel
Save