1 | <?php |
---|
2 | $ct = 0; |
---|
3 | if (isset($list)) { |
---|
4 | if (!isset($colonnes)) |
---|
5 | $colonnes = 3; |
---|
6 | if (isset($imp)) { |
---|
7 | $fonction = $deputes[0]->fonction; |
---|
8 | foreach ($deputes as $depute) if ($depute->sexe === "H") { |
---|
9 | $fonction = $depute->fonction; |
---|
10 | break; |
---|
11 | } |
---|
12 | echo '<h3 class="aligncenter">'.ucfirst(preg_replace('/d(u|e)s /', 'd\\1 ', preg_replace('/(,)? /', 's\\1 ', $fonction))).(count($deputes) > 1 && !preg_match('/(droit|bureau)$/', $fonction) ? 's' : '').'</h3>'; |
---|
13 | } |
---|
14 | echo '<table summary="Députés dont le nom commence par '.$lettre.'"><tr>'; |
---|
15 | $totaldep = count($deputes); |
---|
16 | $div = floor($totaldep/$colonnes)+1; |
---|
17 | if ($div > 1 && $totaldep % $colonnes == 0) |
---|
18 | $div--; |
---|
19 | $td = 0; |
---|
20 | if ($totaldep == 1) { |
---|
21 | if ($colonnes == 2) |
---|
22 | echo '<td class="list_td_small"/>'; |
---|
23 | else echo '<td/>'; |
---|
24 | $td++; |
---|
25 | } else if ($colonnes != 2 && ($totaldep == 2 || $totaldep == 4)) |
---|
26 | echo '<td class="list_td_small"/>'; |
---|
27 | echo '<td>'; |
---|
28 | } |
---|
29 | foreach($deputes as $depute) { |
---|
30 | $ct++; ?> |
---|
31 | <div class="list_dep<?php if (isset($circo) && $depute->fin_mandat == null) echo ' dep_map" id="dep'.preg_replace('/^(\d[\dab])$/', '0\\1', strtolower(Parlementaire::getNumeroDepartement($depute->nom_circo))).'-'.sprintf('%02d', $depute->num_circo); ?>" onclick="document.location='<?php echo url_for('@parlementaire?slug='.$depute->slug); ?>'"><span title="<?php echo $depute->nom.' -- '.$depute->getMoyenStatut(); ?>" class="jstitle phototitle block"><a class="urlphoto" href="<?php echo url_for('@parlementaire?slug='.$depute->slug); ?>"></a> |
---|
32 | <span class="list_nom"> |
---|
33 | <a href="<?php echo url_for('@parlementaire?slug='.$depute->slug); ?>"><?php echo $depute->getNomPrenom(); ?></a> |
---|
34 | </span> |
---|
35 | <span class="list_right"><a href="<?php if (!isset($circo)) echo url_for('@list_parlementaires_departement?departement='.$depute->nom_circo); else echo url_for('@parlementaire?slug='.$depute->slug); ?>"><?php |
---|
36 | if (isset($circo)) { |
---|
37 | echo '<span class="list_num_circo">'; |
---|
38 | $string = preg_replace('/(è[rm]e)/', '<sup>\1</sup>', $depute->getNumCircoString()); |
---|
39 | if (isset($dept)) |
---|
40 | $string = $depute->getNumDepartement().' — '.preg_replace("/nscription/", "", $string); |
---|
41 | echo $string.'</span></a>'; |
---|
42 | } else echo $depute->nom_circo; |
---|
43 | ?></a></span><br/> |
---|
44 | <span class="list_left"> |
---|
45 | <?php echo preg_replace('/\s([A-Z]+)$/', ' <a href="'.url_for('@list_parlementaires_groupe?acro='.$depute->groupe_acronyme).'"><span class="couleur_'.strtolower($depute->getGroupeAcronyme()).'">'."\\1</span></a>", $depute->getStatut()); ?> |
---|
46 | </span> |
---|
47 | <span class="list_right"><?php |
---|
48 | if (!$depute->nb_commentaires) |
---|
49 | echo "0 commentaire"; |
---|
50 | else { |
---|
51 | echo '<a href="'.url_for('@parlementaire_commentaires?slug='.$depute->slug).'"><span class="list_com">'.$depute->nb_commentaires.' commentaire'; |
---|
52 | if ($depute->nb_commentaires > 1) echo 's'; |
---|
53 | echo '</span></a>'; |
---|
54 | } |
---|
55 | ?> |
---|
56 | </span><br/> |
---|
57 | </span></div> |
---|
58 | <?php if (isset($list) && $ct % $div == 0 && $ct != $totaldep && $totaldep != 1) { |
---|
59 | $td++; |
---|
60 | echo '</td><td class="list_borderleft">'; |
---|
61 | } |
---|
62 | } |
---|
63 | if (isset($list)) { |
---|
64 | echo '</td>'; |
---|
65 | if (($colonnes == 2 && $totaldep == 1) || ($colonnes != 2 && ($totaldep == 2 || $totaldep == 4))) |
---|
66 | echo '<td class="list_td_small"/>'; |
---|
67 | else while ($td < $colonnes - 1) { |
---|
68 | $td++; |
---|
69 | echo '<td/>'; |
---|
70 | } |
---|
71 | echo '</tr></table>'; |
---|
72 | } |
---|
73 | ?> |
---|