From: x2003bruneau Date: Tue, 1 Aug 2006 15:48:28 +0000 (+0000) Subject: Add a new marketing on users who have no valid redirection X-Git-Tag: xorg/0.9.11~145 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d216d84a490a18e7549774c23cea0b3746d0b049;p=platal.git Add a new marketing on users who have no valid redirection git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@770 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/search/classes.inc.php b/include/search/classes.inc.php index 9ed011c..57f1d7d 100644 --- a/include/search/classes.inc.php +++ b/include/search/classes.inc.php @@ -35,7 +35,8 @@ $globals->search->result_fields = ' ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type, ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type, es.label AS secteur, ef.fonction_fr AS fonction, - IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,'; + IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166, + COUNT(em.email) > 0 AS actif,'; // hide private information if not logged if (S::logged()) $globals->search->result_fields .=' @@ -64,7 +65,8 @@ $globals->search->result_where_statement = ' LEFT JOIN geoloc_pays AS n ON (u.nationalite = n.a2) LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut)) LEFT JOIN geoloc_pays AS gp ON (adr.country = gp.a2) - LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region)'; + LEFT JOIN geoloc_region AS gr ON (adr.country = gr.a2 AND adr.region = gr.region) + LEFT JOIN emails AS em ON (em.uid = u.user_id AND em.flags = \'active\')'; // }}} // {{{ function display_lines() diff --git a/modules/marketing.php b/modules/marketing.php index 68541b0..b9e4710 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -32,6 +32,7 @@ class MarketingModule extends PLModule 'marketing/private' => $this->make_hook('private', AUTH_MDP, 'admin'), 'marketing/public' => $this->make_hook('public', AUTH_COOKIE), + 'marketing/broken' => $this->make_hook('broken', AUTH_COOKIE), ); } @@ -158,6 +159,42 @@ class MarketingModule extends PLModule } } + function handler_broken(&$page, $uid = null) + { + $page->changeTpl('marketing/broken.tpl'); + + if (is_null($uid)) { + return; + } + + $res = Xdb::query("SELECT u.nom, u.prenom, u.promo, a.alias AS forlife + FROM auth_user_md5 AS u + INNER JOIN aliases AS a ON a.id = u.user_id + WHERE u.user_id = {?}", S::i('uid')); + if (!$res->numRows()) { + return; + } + $user = $res->fetchOneAssoc(); + $page->assign('user', $user); + + $email = trim(Post::v('mail')); + if (Post::has('valide') && strlen($email) > 0) { + require_once('diogenes/diogenes.hermes.inc.php'); + $mailer = new HermesMailer(); + $mailer->setFrom(S::v('bestalias') . '@polytechnique.org'); + $mailer->addTo('resetpass@polytechnique.org'); + $mailer->setSubject("Proposition d'adresse mail pour " . $user['forlife']); + + $message = S::v('nom') . ' ' . S::v('prenom') . ' (X' . S::v('promo') . ') ' + . 'propose l\'adresse suivante pour un camarade qui n\'a plus de ' + . 'redirections actives :' . "\n\n" + . '* ' . $user['forlife'] . ' => ' . $email . "\n"; + $mailer->setTxtBody(wordwrap($message, 78)); + $mailer->send(); + $page->assign('sent', true); + } + } + function handler_promo(&$page, $promo = null) { $page->changeTpl('marketing/promo.tpl'); diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index f02c3e3..8ec3227 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -87,7 +87,7 @@
{if $c.wasinscrit} - {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext} + {if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext || (!$c.dcd && !$c.actif )} {if $c.web} @@ -122,6 +122,16 @@ {/if} + {if !$c.dcd && !$c.actif && $c.wasinscrit} + + + + {/if}
{$c.freetext|nl2br}
+ Ce camarade n'a plus d'adresse redirection valide. + + Si tu en connais une, n'hésite pas à nous la transmettre + +
{/if} {/if} diff --git a/templates/marketing/broken.tpl b/templates/marketing/broken.tpl new file mode 100644 index 0000000..4fd9ee0 --- /dev/null +++ b/templates/marketing/broken.tpl @@ -0,0 +1,67 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + + +{if $sent} + +

+ Merci de nous avoir communiqué cette information ! +

+ +{elseif $user} + +

+ Recherche d'adresses pour {$user.nom} {$user.prenom} (X{$user.promo}) +

+ +

+ Avec le temps toutes les adresses de redirection de notre camarade sont devenues invalides et produisent + des erreurs lorsqu'on lui envoie un mail. Nous sommes donc à la recherche d'adresses valides où nous pourrions + contacter ce camarade. +

+

+ Les adresses emails qui tu pourras nous donner ne seront pas ajouter directement aux redirections de {$user.prenom}. +

+

+ Merci de participer à cette recherche. +

+ +
+ + + + + + + + +
Nom :{$user.nom}
Prénom :{$user.prenom}
Promo :{$user.promo}
Adresse email : + +
+
+ +
+
+{/if} + + +{* vim:set et sw=2 sts=2 sws=2: *}