From: x2000habouzit Date: Sat, 24 Jul 2004 16:06:56 +0000 (+0000) Subject: trombipromo X-Git-Tag: xorg/old~1785 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e4b906c87335c73dc4f97eb412d0ab5f4a6308f1;p=platal.git trombipromo --- diff --git a/etat_migration b/etat_migration index 871353d..6b506c1 100644 --- a/etat_migration +++ b/etat_migration @@ -28,7 +28,6 @@ Etat | Ancien nom | Nouveau nom ; | fiche_referent.php | ; | recherche.php | ; | trombino.php | -; | trombipromo.php | ; | x.php | ------+-[ listes ]--------------------------------+---------------- ; | listes/creation.php | \ @@ -180,6 +179,7 @@ xx | services.php | docs/services.php xx | skins.php | - xx | trezo/gere_operations.php | - xx | trezo/index.php | - +xx | trombipromo.php | xx | vcard.php | - ------+-------------------------------------------+---------------- x!! | admin/correction_adr.php | diff --git a/htdocs/css/default.css b/htdocs/css/default.css index 3849010..348a840 100644 --- a/htdocs/css/default.css +++ b/htdocs/css/default.css @@ -55,6 +55,11 @@ p.error, span.error, p.erreur, span.erreur { margin-bottom: 0.5em; } +.erreur a:link, .erreur a:visited, .erreur a:active, .erreur a:hover { + color: #ff3333; + background: inherit; +} + div.rubrique { color: #555555; background: url('/images/sk_default_titre.gif'); @@ -413,4 +418,4 @@ div.conteneur_tab { font-size: 95% } /* vim: set et ts=4 sts=4 sw=4: */ -/* $Id: default.css,v 1.27 2004-07-17 12:28:10 x2000habouzit Exp $ */ +/* $Id: default.css,v 1.28 2004-07-24 16:06:57 x2000habouzit Exp $ */ diff --git a/htdocs/trombipromo.php b/htdocs/trombipromo.php new file mode 100644 index 0000000..4dda470 --- /dev/null +++ b/htdocs/trombipromo.php @@ -0,0 +1,42 @@ +assign('limit', $limit); + + +if (!ereg("(19|20)[0-9]{2}",$_REQUEST['xpromo']) && ($_REQUEST['xpromo']!="all" && $_SESSION['perms']!="admin")) { + $page->assign('erreur', "La promotion doit être saisie au format YYYY. Recommence."); +} + +if(!isset($_REQUEST['xpromo'])) $page->run(); + +$offset = (empty($_REQUEST['offset']) ? 0 : $_REQUEST['offset']); + +$where = ( $_REQUEST['xpromo']!="all" ? "WHERE promo='{$_REQUEST['xpromo']}'" : "" ); + +$res = $globals->db->query("SELECT COUNT(*) + FROM auth_user_md5 AS u + RIGHT JOIN photo AS p ON u.user_id=p.uid + $where"); +list($pnb) = mysql_fetch_row($res); +$page->assign('pnb', $pnb); + +$sql = "SELECT promo,user_id,username,nom,prenom + FROM auth_user_md5 AS u + RIGHT JOIN photo AS p ON u.user_id=p.uid + $where + ORDER BY promo,nom,prenom LIMIT $offset,$limit"; + +$links = Array(); +if($offset>0) { $links[] = Array($offset-$limit, 'précédent'); } +for($i = 0; $i < $pnb / $limit ; $i++) $links[] = Array($i*$limit, $i+1); +if($offset+$limit < $pnb) { $links[] = Array ($offset+$limit, 'suivant'); } +$page->assign('links',$links); + +$page->mysql_assign($sql,'photos'); +$page->run(); + +?> diff --git a/templates/trombipromo.tpl b/templates/trombipromo.tpl new file mode 100644 index 0000000..7c794e1 --- /dev/null +++ b/templates/trombipromo.tpl @@ -0,0 +1,105 @@ +{* $Id: trombipromo.tpl,v 1.1 2004-07-24 16:06:57 x2000habouzit Exp $ *} + +{dynamic} + +{if !$smarty.request.xpromo || $erreur} +
+ Trombinoscope promo +
+

+Cette page te permet de voir l'album photo d'une promotion +donnée. +

+

+Fais attention, si tu as une connexion à internet lente (par +exemple si tu es sur un vieux modem), la page que tu vas télécharger +en validant peut être longue à afficher. Pour te donner une +idée de la taille, chaque photo est limitée à 30 ko, et +chaque page affiche au plus {$limit} photos. +

+{if $erreur}

{$erreur}

{/if} + +
+ + + + + + + + +
+ Trombinoscope +
+ Promotion + + +   +
+
+ +{else} + +
+ {if $smarty.request.xpromo eq 'all'} + Album photo Polytechnique.org + {else} + Album photo promotion {$smarty.request.xpromo} + {/if} +
+ +{if $pnb} +

+{$pnb} polytechnicien{if $pnb gt 1}s de la promotion {$smarty.request.xpromo} ont +{else} de la promotion {$smarty.request.xpromo} a {/if} une photo dans l'album photo : +

+ + + {foreach from=$photos item=p} + {cycle values="1,2,3" assign="loop"} + {if $loop eq "1"} + + {/if} + + {if $loop eq "3"} + + {/if} + {/foreach} + {if $loop eq "1"} + + {else if $loop eq "2"} + + {/if} +
+ +  [ PHOTO ] + + {mailto address="`$p.username`@polytechnique.org" text="`$p.prenom` `$p.nom`"} + {if $smarty.request.xpromo eq 'all'}{$p.promo}{/if} + {if $smarty.session.perms eq 'admin'}
[admin]{/if} +
+ +{foreach from=$links item=l} +{if $l[0] eq $smarty.request.offset} + + {$l[1]} + +{else} +{$l[1]} +{/if} +{/foreach} + +{else} + +
+ Il n'y a aucune photo de camarade de cette promotion sur nos serveurs. +
+ +{/if} + +{/if} + +{/dynamic} + + +{* vim:set et sw=2 sts=2 sws=2: *}