From: x2000habouzit
Date: Tue, 11 Jul 2006 18:33:46 +0000 (+0000)
Subject: migrate events submission
X-Git-Tag: xorg/0.9.11~463
X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=74e0093f098d33073f32793e5c7a54ff8ac0d8a5;p=platal.git
migrate events submission
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@435 839d8a87-29fc-0310-9880-83ba4fa771e5
---
diff --git a/htdocs/evenements.php b/htdocs/evenements.php
deleted file mode 100644
index f85daca..0000000
--- a/htdocs/evenements.php
+++ /dev/null
@@ -1,63 +0,0 @@
-assign('titre', $titre);
-$page->assign('texte', $texte);
-$page->assign('promo_min', $promo_min);
-$page->assign('promo_max', $promo_max);
-$page->assign('peremption', $peremption);
-$page->assign('validation_message', $validation_message);
-$page->assign('action', strtolower($action));
-
-if ($action=="Confirmer") {
- $texte = preg_replace( "/((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "\\0 ", $texte );
- $texte = preg_replace( "/([^,\s]+@[^,\s]+)/i", "\\0 ", $texte );
- require_once("validations.inc.php");
- $evtreq = new evtreq($titre, $texte, $promo_min, $promo_max,
- $peremption, $validation_message, Session::getInt('uid'));
- $evtreq->submit();
- $page->assign('ok', true);
-}
-
-$select = "";
-for ($i = 1 ; $i < 30 ; $i++) {
- $p_stamp=date("Ymd",time()+3600*24*$i);
- $year=substr($p_stamp,0,4);
- $month=substr($p_stamp,4,2);
- $day=substr($p_stamp,6,2);
-
- $select .= " ""))) ? " selected" : "")."> $day / $month / $year \n";
-}
-$page->assign('select',$select);
-$page->run();
-
-?>
diff --git a/modules/events.php b/modules/events.php
new file mode 100644
index 0000000..76ff087
--- /dev/null
+++ b/modules/events.php
@@ -0,0 +1,84 @@
+ $this->make_hook('submit', AUTH_MDP),
+ );
+ }
+
+ function handler_submit(&$page)
+ {
+ global $globals;
+ $page->changeTpl('evenements.tpl');
+
+ $titre = Post::get('titre');
+ $texte = Post::get('texte');
+ $promo_min = Post::getInt('promo_min');
+ $promo_max = Post::getInt('promo_max');
+ $peremption = Post::getInt('peremption');
+ $valid_mesg = Post::get('valid_mesg');
+ $action = Post::get('action');
+
+ $page->assign('titre', $titre);
+ $page->assign('texte', $texte);
+ $page->assign('promo_min', $promo_min);
+ $page->assign('promo_max', $promo_max);
+ $page->assign('peremption', $peremption);
+ $page->assign('valid_mesg', $valid_mesg);
+ $page->assign('action', strtolower($action));
+
+ if ($action == 'Confirmer') {
+ $texte = preg_replace('/((http|ftp)+(s)?:\/\/[^<>\s]+)/i',
+ '\\0 ', $texte);
+ $texte = preg_replace('/([^,\s]+@[^,\s]+)/i',
+ '\\0 ', $texte);
+ require_once 'validations.inc.php';
+ $evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
+ $peremption, $valid_mesg, Session::getInt('uid'));
+ $evtreq->submit();
+ $page->assign('ok', true);
+ }
+
+ $select = '';
+ for ($i = 1 ; $i < 30 ; $i++) {
+ $time = time() + 3600 * 24 * $i;
+ $p_stamp = date('Ymd', $time);
+ $year = date('Y', $time);
+ $month = date('m', $time);
+ $day = date('d', $time);
+
+ $select .= " ""))) {
+ $select .= " selected='selected'";
+ }
+ $select .= "> $day / $month / $year \n";
+ }
+ $page->assign('select',$select);
+
+ return PL_OK;
+ }
+}
+
+?>
diff --git a/templates/evenements.tpl b/templates/evenements.tpl
index c7f3c83..6287875 100644
--- a/templates/evenements.tpl
+++ b/templates/evenements.tpl
@@ -20,11 +20,7 @@
{* *}
{**************************************************************************}
-
-
- Proposition d'information événementielle
-
-
+Proposition d'information événementielle
{if $action eq "proposer"}
@@ -33,12 +29,8 @@ Voici ton annonce :
-
- {$titre|nl2br}
-
-
- {$texte|nl2br}
-
+ {$titre|nl2br}
+ {$texte|nl2br}
@@ -51,22 +43,22 @@ de toutes les promotions
et sera affiché sur la page d'accueil jusqu'au {$peremption|date_format}
-{if $validation_message}
+{if $valid_mesg}
-Tu as ajouté le message suivant à l'intention du validateur : {$validation_message|nl2br}
+Tu as ajouté le message suivant à l'intention du validateur : {$valid_mesg|nl2br}
{/if}
-
@@ -81,11 +73,12 @@ Ta proposition a bien
Merci pour ta contribution à la vie du site!
-Retour à la page d'accueil
+Retour à la page d'accueil
{else}
-Une erreur s'est produite pendant l'enregistrement de ta proposition. Merci de nous contacter !
+Une erreur s'est produite pendant l'enregistrement de ta proposition.
+Merci de nous contacter !
{/if}
diff --git a/templates/include/form.evenement.tpl b/templates/include/form.evenement.tpl
index 5e47da6..5f81353 100644
--- a/templates/include/form.evenement.tpl
+++ b/templates/include/form.evenement.tpl
@@ -20,8 +20,7 @@
{* *}
{**************************************************************************}
-
-