1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * Associaspip, extension de SPIP pour gestion d'associations * |
---|
4 | * * |
---|
5 | * Copyright (c) 2007 Bernard Blazin & Francois de Montlivault (V1) * |
---|
6 | * Copyright (c) 2010-2011 Emmanuel Saint-James & Jeannot Lapin (V2) * |
---|
7 | * * |
---|
8 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
9 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
10 | \***************************************************************************/ |
---|
11 | |
---|
12 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
13 | |
---|
14 | include_spip('pdf/extends'); |
---|
15 | |
---|
16 | function exec_pdf_adherents() |
---|
17 | { |
---|
18 | if (!autoriser('associer', 'adherents')) { |
---|
19 | include_spip('inc/minipres'); |
---|
20 | echo minipres(); |
---|
21 | } else { |
---|
22 | |
---|
23 | $pdf=new PDF(); |
---|
24 | |
---|
25 | $pdf->titre = _T('asso:adherent_titre_liste_actifs'); |
---|
26 | $pdf->Open(); |
---|
27 | $pdf->AddPage(); |
---|
28 | |
---|
29 | //On définit les colonnes (champs,largeur,intitulé,alignement) |
---|
30 | $champs = $GLOBALS['association_tables_principales']['spip_asso_membres']['field']; |
---|
31 | $sent = _request('champs'); |
---|
32 | foreach ($champs as $k => $v) { |
---|
33 | if ($sent[$k]=='on') { |
---|
34 | $type = strpos($v, 'text'); |
---|
35 | $p = ($type===false) ? 'R' : (($type==0) ? 'L' : 'C'); |
---|
36 | $n = ($type===false) ? 20 : (($type==0) ? 45 : 25); |
---|
37 | $pdf->AddCol($k,$n,_T('asso:adherent_libelle_' . $k), $p); |
---|
38 | } |
---|
39 | } |
---|
40 | // ainsi que les colonnes pour les champs hors table spip_asso_membres |
---|
41 | if ($sent['email']=='on') $pdf->AddCol('email',45 ,_T('asso:adherent_libelle_email'), 'C'); |
---|
42 | // if ($sent['adresse']=='on') $pdf->AddCol('adresse',45 ,_T('asso:adherent_libelle_adresse'), 'L'); |
---|
43 | // if ($sent['telephone']=='on') $pdf->AddCol('telephone',20 ,_T('asso:adherent_libelle_telephone'), 'C'); |
---|
44 | |
---|
45 | $prop=array( |
---|
46 | 'HeaderColor'=>array(255,150,100), |
---|
47 | 'color1'=>array(224,235,255), |
---|
48 | 'color2'=>array(255,255,255), |
---|
49 | 'padding'=>2 |
---|
50 | ); |
---|
51 | $order = 'm.id_auteur'; |
---|
52 | if ($sent['nom_famille']=='on') |
---|
53 | $order = 'm.nom_famille' . ",$order"; |
---|
54 | //* A FAIRE : AJOUTER LE MAIL, ADRESSE, TELEPHONE DANS LA QUERY ou trouver un autre moyen |
---|
55 | $pdf->Query(sql_select('*','spip_asso_membres as m INNER JOIN spip_auteurs as a ON m.id_auteur=a.id_auteur', request_statut_interne(), '', $order), $prop); |
---|
56 | $pdf->Output(); |
---|
57 | } |
---|
58 | } |
---|
59 | ?> |
---|