From 57cc5e633e763b14d3adfa4ec1b59f87613ea47a Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 3 Jan 2011 19:05:19 +0100 Subject: [PATCH] Notifies group admins and event creator when someone subscribes to it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- configs/mails.conf | 3 ++ modules/xnetevents.php | 13 ++++++++ templates/xnetevents/subscription-notif.mail.tpl | 38 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 templates/xnetevents/subscription-notif.mail.tpl diff --git a/configs/mails.conf b/configs/mails.conf index 059b0d9..6afd15b 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -71,3 +71,6 @@ replyto=registration+watch@staff.m4x.org from="Polytechnique.org" cc="Polytechnique.org" +[xnet_notification] +from="Polytechnique.org" + diff --git a/modules/xnetevents.php b/modules/xnetevents.php index bae5758..6bc99b1 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -267,6 +267,19 @@ class XnetEventsModule extends PLModule if ($updated !== false) { $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.'); subscribe_lists_event(S::i('uid'), $evt, ($total > 0 ? 1 : 0), 0); + + $mailer = new PlMailer('xnetevents/subscription-notif.mail.tpl'); + $admins = $globals->asso()->iterAdmins(); + while ($admin = $admins->next()) { + $mailer->addTo($admin); + } + $mailer->addTo($evt['organizer']); + $mailer->assign('group', $globals->asso('nom')); + $mailer->assign('event', $evt['intitule']); + $mailer->assign('subs', $subs); + $mailer->assign('moments', $evt['moments']); + $mailer->assign('name', S::user()->fullName('promo')); + $mailer->send(); } $page->assign('event', get_event_detail($eid)); } diff --git a/templates/xnetevents/subscription-notif.mail.tpl b/templates/xnetevents/subscription-notif.mail.tpl new file mode 100644 index 0000000..4b09166 --- /dev/null +++ b/templates/xnetevents/subscription-notif.mail.tpl @@ -0,0 +1,38 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2010 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="xnet_notification"} +{if $mail_part eq 'head'} +{from full=#from#} +{subject text="[`$group`] $event"} +{elseif $mail_part eq 'wiki'} +Chers organisateurs, + +{$name} a mis a jour son inscription à cet événement. En voici le détail : +{foreach from=$subs item=count key=i} +{assign var=j value=$i-1} +* {$moments.$j.titre} : {$count} personne{if $count > 1}s{/if} +{/foreach} + +{include file="include/signature.mail.tpl"} +{/if} +{* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4