From: x2000habouzit Date: Mon, 19 Jul 2004 11:12:50 +0000 (+0000) Subject: no more pure admin pages ... X-Git-Tag: xorg/old~1791 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9b78e2be24ca7ab697a1ae64d0f53a89ef8395fd;p=platal.git no more pure admin pages ... 2 marketing page left 4 docs left 1 mail routing 2 submitting pages 8 misc pages + lists stuff --- diff --git a/etat_migration b/etat_migration index 7e19069..408fff4 100644 --- a/etat_migration +++ b/etat_migration @@ -15,8 +15,6 @@ ------+-------------------------------------------+---------------- Etat | Ancien nom | Nouveau nom -------+-[ admin ]---------------------------------+---------------- -; | admin/evenements.php | ------+-[ marketing ]-----------------------------+---------------- ; | admin/utilisateurs_identification.php | marketing/ ; | admin/utilisateurs_marketing.php | marketing/ @@ -95,6 +93,7 @@ xx | admin/admin_trombino.php | xx | admin/ax-xorg.php | - xx | admin/deces_promo.php | - xx | admin/envoidirect.php | marketing/envoidirect.php +xx | admin/evenements.php | xx | admin/FormatePrenomNOM2.php | scripts/ xx | admin/FormatePrenomNOM.php | scripts/ xx | admin/gerer_applis.php | - diff --git a/htdocs/admin/evenements.php b/htdocs/admin/evenements.php new file mode 100644 index 0000000..fccb390 --- /dev/null +++ b/htdocs/admin/evenements.php @@ -0,0 +1,110 @@ +assign('arch', $arch); + +$action = isset($_POST['action']) ? $_POST['action'] : ""; + +$err = Array(); + +switch($action) { + case "Proposer": + $req = "UPDATE evenements + SET titre='{$_POST['titre']}', texte='{$_POST['texte']}', peremption='{$_POST['peremption']}', + promo_min = {$_POST['promo_min']}, promo_max = {$_POST['promo_max']} + WHERE id = {$_POST['evt_id']} + LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Valider": + // le 'creation_date = creation_date' est indispensable pour que + // creation_date conserve sa valeur. + $req="UPDATE evenements + SET creation_date = creation_date, validation_user_id ='{$_SESSION['uid']}', + validation_date = NULL, flags = CONCAT(flags,',valide') + WHERE id ='{$_POST['evt_id']}' + LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Invalider": + // le 'creation_date = creation_date' est indispensable pour que + // creation_date conserve sa valeur. + $req="UPDATE evenements + SET creation_date = creation_date, validation_user_id = ".$_SESSION['uid'].", + validation_date = NULL, flags = REPLACE(flags, 'valide','') + WHERE id = ".$_POST['evt_id']." + LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Supprimer": + $req="DELETE from evenements WHERE id = ".$_POST['evt_id']." LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Archiver": + $req="UPDATE evenements SET flags = CONCAT(flags,',archive')WHERE id = ".$_POST['evt_id']." LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Desarchiver": + $req="UPDATE evenements SET flags = REPLACE(flags,'archive','')WHERE id = ".$_POST['evt_id']." LIMIT 1"; + $result = $globals->db->query ($req); + $err[] = "Requete effectuée : $req"; + break; + + case "Editer": + $evt_req = $globals->db->query("SELECT titre, texte, peremption, promo_min, promo_max, validation_message FROM evenements WHERE id=".$_POST["evt_id"]); + list($titre, $texte, $peremption, $promo_min, $promo_max, $validation_message) = mysql_fetch_row($evt_req) ; + $page->assign('mode', 'edit'); + $page->assign('titre',$titre); + $page->assign('texte',$texte); + $page->assign('promo_min',$promo_min); + $page->assign('promo_max',$promo_max); + $page->assign('validation_message',$validation_message); + $page->assign('peremption',$peremption); + + $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 .= "\n"; + } + $page->assign('select',$select); + + break; +} + +if ($action != "Editer") { + + $sql = "SELECT e.id, e.titre, e.texte, + DATE_FORMAT(e.creation_date,'%d/%m/%Y %T') AS creation_date, + DATE_FORMAT(e.validation_date,'%d/%m/%Y %T') AS validation_date, + DATE_FORMAT(e.peremption,'%d/%m/%Y') AS peremption, + e.promo_min, e.promo_max, e.validation_message, e.validation_user_id, + FIND_IN_SET('valide', e.flags) AS fvalide, + FIND_IN_SET('archive', e.flags) AS farch, + a.promo, a.nom, a.prenom, a.username + FROM evenements AS e + INNER JOIN auth_user_md5 AS a ON(e.user_id = a.user_id) + WHERE ".($arch ? "" : "!")."FIND_IN_SET('archive',e.flags) + ORDER BY FIND_IN_SET('valide',e.flags), peremption"; + $page->mysql_assign($sql, 'evs'); +} + +$page->assign('err', $err); +$page->run(); +?> diff --git a/templates/admin/evenements.tpl b/templates/admin/evenements.tpl new file mode 100644 index 0000000..fa6ae3c --- /dev/null +++ b/templates/admin/evenements.tpl @@ -0,0 +1,144 @@ +{* $Id: evenements.tpl,v 1.1 2004-07-19 11:12:50 x2000habouzit Exp $ *} + +{dynamic} + +
+ Gestion des événements : + {if $arch} + [ Actualités | Archives ] + {else} + [ Actualités | Archives ] + {/if} +
+ +{foreach from=$err item=e} +

{$e|nl2br}

+{/foreach} + +{if $mode} + +
+ + + + + + + + + + + + + +
Contenu du message
Titre + +
Texte
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Informations complémentaires
+ Promo min * (incluse) + + +  0 signifie pas de minimum +
+ Promo max * (incluse) + + +  0 signifie pas de maximum +
+ * sert à limiter l'affichage de l'annonce aux camarades appartenant à certaines promos seulement. +
+ Dernier jour d'affichage + + +
Message pour le validateur
+ +
+ +
+ +
+ +
+ + +{else} + +{foreach from=$evs item=ev} + + + + + + + + + + +
+ Posté par {$ev.prenom} {$ev.nom} (X{$ev.promo}) + lui écrire +
+ {$ev.titre}
+ {$ev.texte|nl2br}
+ Création : {$ev.creation_date}
+ {if $ev.fvalide} + Validation : {$ev.validation_date}
+ {/if} + Péremption : {$ev.peremption}
+ Promos : {$ev.promo_min} - {$ev.promo_max}
+ Message : {$ev.validation_message} +
+
+ + + {if $ev.farch} + + {else} + + {if $ev.fvalide} + + {else} + + + {/if} + + {/if} +
+
+ +
+{/foreach} + +{/if} + +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *}