cotizlast.php 3.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?php
/* Copyright 2011 Jérémie Laval <jeremie dot laval at gmail dot com>
 *
 * Ce fichier fait partie du site de l'Association des Étudiants de
 * l'UTBM, http://ae.utbm.fr.
 *
 * 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.
 */

$topdir = "../";

require_once($topdir. 'include/site.inc.php');
require_once($topdir. 'include/entities/cotisation.inc.php');
jlaval's avatar
Fixup  
jlaval committed
27
require_once($topdir. "include/cts/user.inc.php");
28 29 30 31 32 33 34 35
require_once($topdir. 'include/cts/gallery.inc.php');
require_once($topdir. 'include/cts/special.inc.php');
require_once($topdir. 'include/entities/uv.inc.php');
require_once($topdir. 'include/entities/ville.inc.php');
require_once($topdir. 'include/entities/pays.inc.php');

$site = new site ();

jlaval's avatar
Fixup  
jlaval committed
36 37
$site->allow_only_logged_users();

38 39 40 41
if (!$site->user->is_in_group('gestion_ae'))
    $site->error_forbidden('services');

$site->start_page ('services', 'Dernières cotisations');
jlaval's avatar
Fixup  
jlaval committed
42 43
$site->add_css("css/mmt.css");

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
$cts = new contents ("Dernières cotisations");

$user = new utilisateur ($site->db);
$gallery = new gallery ();

$req = new requete ($site->db, "SELECT `utilisateurs`.*, `utl_etu`.citation,
        `utl_etu`.adresse_parents, `utl_etu`.ville_parents,
        `utl_etu`.cpostal_parents, `utl_etu`.pays_parents, `utl_etu`.tel_parents,
        `utl_etu`.nom_ecole_etudiant, `utl_etu`.visites, `utl_etu`.id_ville,
        `utl_etu`.id_pays, `utl_etu_utbm`.semestre_utbm,
        `utl_etu_utbm`.branche_utbm, `utl_etu_utbm`.filiere_utbm,
        `utl_etu_utbm`.surnom_utbm, `utl_etu_utbm`.email_utbm,
        `utl_etu_utbm`.promo_utbm, `utl_etu_utbm`.date_diplome_utbm,
        `utl_etu_utbm`.role_utbm, `utl_etu_utbm`.departement_utbm,
        `utilisateurs`.`id_ville` as `id_ville`,
        `utl_etu`.`id_ville` as `ville_parents`,
        `utilisateurs`.`id_pays` as `id_pays`, `utl_etu`.`id_pays` as `pays_parents`
        FROM `ae_cotisations`
        LEFT JOIN `utilisateurs` ON `utilisateurs`.id_utilisateur=`ae_cotisations`.`id_utilisateur`
        LEFT JOIN `utl_etu` ON `utl_etu`.`id_utilisateur`=`utilisateurs`.`id_utilisateur`
        LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur`=`utilisateurs`.`id_utilisateur`
        ORDER BY `id_cotisation` DESC LIMIT 15");

while ($row = $req->get_row()) {
    $user->_load_all($row);
jlaval's avatar
Fixup  
jlaval committed
69
    $gallery->add_item(new userinfov2($user, "small", false, "user.php", false));
70 71
}

jlaval's avatar
Fixup  
jlaval committed
72
$cts->add ($gallery);
73 74 75 76 77
$site->add_contents ($cts);

$site->end_page ();

?>