From 02d5e4dc5ff6477ba2430cd08492e351e65cd234 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 14 Jul 2009 13:16:41 +0200 Subject: [PATCH] Notifies when a action has been done throught a reminder box. --- include/reminder.inc.php | 14 +++++++++++++- modules/reminder.php | 6 ++++-- templates/reminder/base.tpl | 4 ++++ templates/reminder/notification.tpl | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 templates/reminder/notification.tpl diff --git a/include/reminder.inc.php b/include/reminder.inc.php index a28d839..bc1334b 100644 --- a/include/reminder.inc.php +++ b/include/reminder.inc.php @@ -101,13 +101,25 @@ abstract class Reminder // method below). abstract public function HandleAction($action); + // Displays a reduced version of the reminder and notifies that the action + // has been taken into account. + public function NotifiesAction(&$page) + { + header('Content-Type: text/html; charset=utf-8'); + $page->changeTpl('reminder/notification.tpl', NO_SKIN); + $page->assign('previous_reminder', $this->title()); + } + // Displays the reminder as a standalone html snippet. It should be used // when the reminder is the only output of a page. - public function DisplayStandalone(&$page) + public function DisplayStandalone(&$page, $previous_reminder = null) { header('Content-Type: text/html; charset=utf-8'); $page->changeTpl('reminder/base.tpl', NO_SKIN); $this->Prepare($page); + if ($previous_reminder) { + $page->assign('previous_reminder', $previous_reminder); + } } // Prepares the display by assigning template variables. diff --git a/modules/reminder.php b/modules/reminder.php index d35ef0c..2d68ef0 100644 --- a/modules/reminder.php +++ b/modules/reminder.php @@ -44,10 +44,12 @@ class ReminderModule extends PLModule // displayed. $reminder->HandleAction($action); + $previous_reminder = $reminder->title(); + if (($new_reminder = Reminder::GetCandidateReminder($user))) { - $new_reminder->DisplayStandalone($page); + $new_reminder->DisplayStandalone($page, $previous_reminder); } else { - exit; + $reminder->NotifiesAction($page); } } } diff --git a/templates/reminder/base.tpl b/templates/reminder/base.tpl index 404a306..477cbc8 100644 --- a/templates/reminder/base.tpl +++ b/templates/reminder/base.tpl @@ -21,6 +21,10 @@ {**************************************************************************}
+ {if $previous_reminder} + {include file="reminder/notification.tpl" previous_reminder=$previous_reminder} + {/if} +
{if $reminder->warning()}{icon name=error}{else}{icon name=information}{/if} diff --git a/templates/reminder/notification.tpl b/templates/reminder/notification.tpl new file mode 100644 index 0000000..f7fc9b4 --- /dev/null +++ b/templates/reminder/notification.tpl @@ -0,0 +1,32 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2009 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 *} +{* *} +{**************************************************************************} + +
+
+ + {icon name=information} {$previous_reminder} + + Ta demande a bien été prise en compte. +
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} -- 2.1.4