activites.php 5.13 KB
Newer Older
mbriand's avatar
mbriand committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

/* Copyright 2008
 * - Benjamin Collet < bcollet AT oxynux DOT org >
 *
 * 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.
 */

mbriand's avatar
mbriand committed
25
$topdir = "./";
mbriand's avatar
mbriand committed
26
27
28
29
30
31

require_once($topdir. "include/site.inc.php");
require_once($topdir. "include/cts/sqltable.inc.php");

$site = new site ();

mbriand's avatar
mbriand committed
32
$site->start_page("presentation","Activités");
mbriand's avatar
mbriand committed
33

mbriand's avatar
mbriand committed
34
$cts = new contents("Responsables des clubs");
mbriand's avatar
mbriand committed
35
36
37
if ($site->user->is_in_group("gestion_ae"))
{
  $tabs = array();
mbriand's avatar
mbriand committed
38
39
  $tabs[] = array("list","activites.php?view=list","Liste");
  $tabs[] = array("trombino","activites.php?view=trombino","Trombino");
mbriand's avatar
mbriand committed
40
41
42
43
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
69
70
71
  $cts->add(new tabshead($tabs, (isset($_REQUEST['view'])) ? $_REQUEST['view'] : 'trombino'));
}

if (($_REQUEST['view'] == "list") && ($site->user->is_in_group("gestion_ae")))
{
  $req_assos = new requete($site->db, "SELECT asso_parent.id_asso AS id_asso_parent,
        asso_parent.nom_asso AS nom_asso_parent,
        asso.id_asso AS id_asso,
        asso.nom_asso AS nom_asso,
        utilisateurs_resp.id_utilisateur as id_utilisateur_resp,
        CONCAT(utilisateurs_resp.nom_utl,' ',utilisateurs_resp.prenom_utl) AS nom_utilisateur_resp,
        utilisateurs_tres.id_utilisateur AS id_utilisateur_tres,
        CONCAT(utilisateurs_tres.nom_utl,' ',utilisateurs_tres.prenom_utl) AS nom_utilisateur_tres
      FROM asso
      LEFT JOIN asso_membre AS tbl_resp ON (tbl_resp.id_asso=asso.id_asso AND tbl_resp.role='10' AND tbl_resp.date_fin IS NULL)
      LEFT JOIN asso_membre AS tbl_tres ON (tbl_tres.id_asso=asso.id_asso AND tbl_tres.role='7' AND tbl_tres.date_fin IS NULL)
      LEFT JOIN utilisateurs AS utilisateurs_resp ON tbl_resp.id_utilisateur=utilisateurs_resp.id_utilisateur
      LEFT JOIN utilisateurs AS utilisateurs_tres ON tbl_tres.id_utilisateur=utilisateurs_tres.id_utilisateur
      INNER JOIN asso AS asso_parent ON asso.id_asso_parent=asso_parent.id_asso
      WHERE asso.id_asso_parent IN (SELECT id_asso FROM asso WHERE id_asso_parent='1')
      AND `asso`.`hidden` = '0'
      GROUP BY asso.id_asso
      ORDER BY asso_parent.nom_asso, asso.nom_asso");

  $table = new sqltable("", "Liste des responsables et des trésoriers des activités", $req_assos, "", "",
                        array("nom_asso_parent" => "Pôle",
                              "nom_asso" => "Activité",
                              "nom_utilisateur_resp" => "Responsable",
                              "nom_utilisateur_tres" => "Trésorier"
                              ),
                        array(), array(), array() );

mbriand's avatar
mbriand committed
72
  $cts->add($table);
mbriand's avatar
mbriand committed
73
74
75
76
77
78
79
80
81
82
83
84
}
else
{
  require_once($topdir."include/cts/gallery.inc.php");

  $site->add_css("css/sas.css");

  $reqpoles = new requete($site->db,
    "SELECT `id_asso`, `nom_asso` FROM `asso` WHERE `id_asso_parent` = '1' AND hidden = '0'");

  while ( $rowpoles = $reqpoles->get_row() )
  {
mbriand's avatar
mbriand committed
85
    $cts->add_title(2, $rowpoles['nom_asso']);
mbriand's avatar
mbriand committed
86
87
88
89
90
91
92

    $req = new requete($site->db,
      "SELECT `utilisateurs`.`id_utilisateur`, " .
      "CONCAT(`utilisateurs`.`prenom_utl`,' ',`utilisateurs`.`nom_utl`) as `nom_utilisateur`, " .
      "`asso`.`nom_asso` ".
      "FROM `asso_membre` " .
      "INNER JOIN `utilisateurs` USING (`id_utilisateur`) " .
mbriand's avatar
mbriand committed
93
      "INNER JOIN `asso` USING (`id_asso`) " .
mbriand's avatar
mbriand committed
94
95
96
97
      "WHERE `asso_membre`.`date_fin` IS NULL " .
      "AND `asso_membre`.`role`='10' " .
      "AND `asso`.`id_asso_parent` = '".$rowpoles['id_asso']."'" .
      "AND `asso`.`hidden` = '0' " .
98
      ($site->user->is_in_group ("gestion_ae") ? "" : "AND `utilisateurs`.`publique_utl` >= '1'") .
mbriand's avatar
mbriand committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
      "GROUP BY `asso`.`id_asso` " .
      "ORDER BY `asso`.`nom_asso`");

    $gal = new gallery();
    while ( $row = $req->get_row() )
    {

      $img = $topdir."images/icons/128/user.png";
      if ( file_exists($topdir."var/img/matmatronch/".$row['id_utilisateur'].".identity.jpg") )
        $img = $topdir."var/img/matmatronch/".$row['id_utilisateur'].".identity.jpg";
      elseif ( file_exists($topdir."var/img/matmatronch/".$row['id_utilisateur'].".jpg") )
        $img = $topdir."var/img/matmatronch/".$row['id_utilisateur'].".jpg";

      $gal->add_item(
mbriand's avatar
mbriand committed
113
114
      "<a href=\"../user.php?id_utilisateur=".$row['id_utilisateur']."\"><img src=\"$img\" alt=\"Photo\" height=\"105\"></a>",
      "<a href=\"../user.php?id_utilisateur=".$row['id_utilisateur']."\">".htmlentities($row['nom_utilisateur'],ENT_NOQUOTES,"UTF-8")."</a><br /> (".htmlentities($row['nom_asso'],ENT_NOQUOTES,"UTF-8").")");
mbriand's avatar
mbriand committed
115
116
117
118
119
    }
    $cts->add($gal);
  }
}

mbriand's avatar
mbriand committed
120
121
$site->add_contents($cts);

mbriand's avatar
mbriand committed
122
123
124
$site->end_page();

?>