|
@@ -1405,3 +1405,54 @@ function event_course_login($course_code, $user_id, $session_id) {
|
|
|
//Course catalog stats modifications see #4191
|
|
|
CourseManager::update_course_ranking(null, null, null, null, true, false);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ *
|
|
|
+ * Filter EventEmailTemplate Filters see the main/inc/conf/events.conf.dist.php
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * user_registration - send_mail filter
|
|
|
+ * @param array $values (passing by reference)
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
+function user_registration_event_send_mail_filter_func(&$values) {
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * For the sake of genericity, this function is a switch.
|
|
|
+ * It's called by EventsDispatcher and fires the good function
|
|
|
+ * with the good require_once.
|
|
|
+ *
|
|
|
+ * @param string $event_name
|
|
|
+ * @param array $params
|
|
|
+ */
|
|
|
+function event_send_mail($event_name, $params) {
|
|
|
+ EventsMail::send_mail($event_name, $params);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Internal function checking if the mail was already sent from that user to that user
|
|
|
+ * @param string $event_name
|
|
|
+ * @param int $user_from
|
|
|
+ * @param int $user_to
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
+function check_if_mail_already_sent($event_name, $user_from, $user_to = null) {
|
|
|
+ if ($user_to == null) {
|
|
|
+ $sql = 'SELECT COUNT(*) as total FROM ' . Database::get_main_table(TABLE_EVENT_SENT) . '
|
|
|
+ WHERE user_from = '.$user_from.' AND event_type_name = "'.$event_name.'"';
|
|
|
+ } else {
|
|
|
+ $sql = 'SELECT COUNT(*) as total FROM ' . Database::get_main_table(TABLE_EVENT_SENT) . '
|
|
|
+ WHERE user_from = '.$user_from.' AND user_to = '.$user_to.' AND event_type_name = "'.$event_name.'"';
|
|
|
+ }
|
|
|
+ $result = Database::store_result(Database::query($sql), 'ASSOC');
|
|
|
+ return $result[0]["total"];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/* End of filters */
|