var $__hooks;
var $path;
- var $args;
+ var $argv;
function Platal()
{
$globals->menu->addPrivateEntry(XOM_CUSTOM, 40, 'Mon mot de passe', 'password');
$globals->menu->addPrivateEntry(XOM_CUSTOM, 50, 'Mes préférences', 'prefs');
- $globals->menu->addPrivateEntry(XOM_GROUPS, 10, 'Trombi/Site promo', 'trombipromo.php');
+ $globals->menu->addPrivateEntry(XOM_GROUPS, 10, 'Trombi promo', 'trombi');
$globals->menu->addPrivateEntry(XOM_GROUPS, 20, 'Conseil Pro.', 'referent.php');
if ($globals->geoloc->use_map())
$globals->menu->addPrivateEntry(XOM_GROUPS, 10, 'Planisphère', 'geoloc/');
+++ /dev/null
-<?php
-/***************************************************************************
- * 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 *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('trombipromo.tpl', AUTH_COOKIE);
-require_once("trombi.inc.php");
-$page->assign('xorg_title','Polytechnique.org - Trombi Promo');
-
-function getList($offset,$limit) {
- global $globals;
-
- $xpromo = Env::getInt('xpromo');
- $where = ( $xpromo>0 ? "WHERE promo='$xpromo'" : "" );
-
- $res = $globals->xdb->query(
- "SELECT COUNT(*)
- FROM auth_user_md5 AS u
- RIGHT JOIN photo AS p ON u.user_id=p.uid
- $where");
- $pnb = $res->fetchOneCell();
-
- $res = $globals->xdb->query(
- "SELECT promo,user_id,a.alias AS forlife,IF(nom_usage='', nom, nom_usage) AS nom,prenom
- FROM photo AS p
- INNER JOIN auth_user_md5 AS u ON u.user_id=p.uid
- INNER JOIN aliases AS a ON ( u.user_id=a.id AND a.type='a_vie' )
- $where
- ORDER BY promo,nom,prenom LIMIT {?}, {?}", $offset*$limit, $limit);
-
- return Array($pnb, $res->fetchAllAssoc());
-}
-
-if (Env::has('xpromo')) {
- $xpromo = Env::getInt('xpromo');
-
- if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && Session::get('perms')!="admin") ) {
- $page->trig("Promotion incorrecte (saisir au format YYYY). Recommence.");
- $page->assign('error', true);
- } else {
- $trombi = new Trombi('getList');
- $trombi->hidePromo();
- $trombi->setAdmin();
- $page->assign_by_ref('trombi',$trombi);
- }
-} else {
- $tmp = new Trombi();
- $page->assign("limit", $tmp->limit);
-}
-
-$page->run();
-
-?>
// Liens apparaissant de façon aléatoire
$pub_rnd = array(
- 'newsletter/show.php?nid=last' => 'Afficher la dernière newsletter' ,
- 'http://www.polytechnique.net' => 'Vers les autres sites polytechniciens' ,
- "trombipromo.php?xpromo={$_SESSION["promo"]}" => "Voir le trombi de ma promo" ,
- 'banana/' => 'Un petit tour du côté des forums !!'
+ 'newsletter/show.php?nid=last' => 'Afficher la dernière newsletter' ,
+ 'http://www.polytechnique.net' => 'Vers les autres sites polytechniciens' ,
+ "trombi/{$_SESSION["promo"]}" => "Voir le trombi de ma promo" ,
+ 'banana' => 'Un petit tour du côté des forums !!'
) ;
?>
class Trombi extends XOrgPlugin
{
// {{{ properties
-
- var $_get_vars = Array('offset');
+
+ var $_get_vars = array('offset');
var $limit = 24;
var $admin = false;
var $showpromo = true;
// }}}
// {{{ function setNbRows()
-
+
function setNbRows($row)
{ $this->limit = $row*3; }
// }}}
// {{{ function setAdmin()
-
+
function setAdmin()
{ $this->admin = true; }
// }}}
// {{{ function hidePromo()
-
+
function hidePromo()
{ $this->showpromo = false; }
// }}}
// {{{ function show()
-
+
function show()
{
/* this point is nasty... but since show() is called from the template ...
$page->assign('trombi_admin', $this->admin);
return $page->fetch('include/trombi.tpl');
}
-
+
// }}}
}
class XOrgPlugin
{
// {{{ properties
-
+
/** have to override, contents the fields names used to drive the plugin */
- var $_get_vars = Array();
+ var $_get_vars = array();
/** some polymorphism at low cost, may be used, or not */
var $_callback;
// }}}
// {{{ function XOrgPlugin()
-
+
/** constructor.
* the constructor override $_get_vars settings by prefixing the names with $prefix
*/
// }}}
// {{{ function get_value()
-
+
/** transparent access to $_GET, wrt the right $prefix
*/
function get_value($key)
// }}}
// {{{ function make_url()
-
+
/** construct an url with the given parameters to drive the plugin.
* leave all other GET params alone
*/
$args = isset($params) ? $params : Array();
if (!is_array($args)) {
- if (count($this->_get_vars)!=1) {
- return "<p class='erreur'>params should be an array</p>";
- } else {
- $args = Array($this->_get_vars[0]=>$params);
- }
+ $args = array($this->_get_vars[0]=>$params);
}
foreach ($_GET as $key=>$val) {
- if (in_array($key,$this->_get_vars) && array_key_exists($key,$args)) {
+ if ($key == 'p') {
+ continue;
+ }
+ if (in_array($key, $this->_get_vars) && array_key_exists($key, $args)) {
continue;
}
$get[] = urlencode($key) . '=' . urlencode($val);
}
foreach ($this->_get_vars as $key) {
- if (array_key_exists($key,$args)) {
+ if (array_key_exists($key, $args)) {
if ($args[$key]) {
$get[] = urlencode($key) . '=' . urlencode($args[$key]);
}
}
}
- return $_SERVER['PHP_SELF'] . '?' . join('&',$get);
+ return '?' . join('&', $get);
}
// }}}
{* *}
{**************************************************************************}
-
-
-{if !$smarty.request.xpromo || $error}
<h1>
Trombinoscope promo
</h1>
<p>
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.
+en validant peut être longue à afficher.
</p>
-<form action="{$smarty.server.PHP_SELF}" method="get">
+<form action="{rel}/trombi/" method="post">
<table class="tinybicol" cellpadding="3" summary="Saisie promo" style="width: 30%; margin-left:35%">
<tr>
<th colspan="2">
</td>
<td>
<input type="text" name="xpromo" size="4" maxlength="4" />
- <input type="hidden" name="offset" value="0" /> <input type="submit" value="Ok" />
+ <input type="submit" value="Ok"
+ onclick='this.form.action = this.form.action + this.form.xpromo.value' />
</td>
</tr>
</table>
</form>
-<h1>Site web promo</h1>
-<p>Pour accéder à la liste des sites web promo, clique <a href="http://www.polytechnique.net/groupes.php?cat=promotions">ici</a>.</p>
-
-{else}
+{if $trombi}
<h1>
- {if $smarty.request.xpromo eq 'all'}
- Album photo Polytechnique.org
+ Album photo
+ {if $platal->argv[1] eq -1}
+ Polytechnique.org
{else}
- Album photo promotion {$smarty.request.xpromo}
+ promotion {$platal->argv[1]}
{/if}
</h1>
{/if}
-
-
{* vim:set et sw=2 sts=2 sws=2: *}