<?php
//$Id$
//gen openMairie le 30/05/2019 16:10

include "election_unite.inc.php";

if (in_array($retourformulaire, $foreign_keys_extended["election"])) {
    $tab_actions['corner']['ajouter'] = null;
}

$table = DB_PREFIXE."election_unite
    LEFT JOIN ".DB_PREFIXE."election
        ON election_unite.election = election.election
    LEFT JOIN ".DB_PREFIXE."unite
        ON election_unite.unite = unite.unite
    LEFT JOIN ".DB_PREFIXE."resultat_participation_unite
        ON election_unite.election_unite = resultat_participation_unite.election_unite";

// SELECT
$displayed_field_election = 'election.libelle as "'.__("election").'"';
$champAffiche = array(
    'election_unite.election_unite as "'.__("id").'"',
    $displayed_field_election,
    'concat(unite.code_unite, \' \', unite.libelle) as "'.__("unité").'"',
    'resultat_participation_unite.votant as "'.__("votant").'"',
    "case
        resultat_participation_unite.saisie
    when
        't'
        then '<img src=../app/img/arrive.png>'
        else '<img src=../app/img/nonarrive.png>'
    end as \"".__("saisie")."\"",
    "case
        resultat_participation_unite.envoi_aff
    when
        't'
        then '<img src=../app/img/arrive.png>'
        else '<img src=../app/img/nonarrive.png>'
    end as \"".__("aff")."\"",
    "case
        resultat_participation_unite.envoi_web
    when
        't'
        then '<img src=../app/img/arrive.png>'
        else '<img src=../app/img/nonarrive.png>'
    end as \"".__("web")."\""
);
// La colonne élection n'est pas nécessaire dans le contexte d'une élection
if (in_array($retourformulaire, $foreign_keys_extended["election"])) {
    $champAffiche = array_diff($champAffiche, array($displayed_field_election, ));
    $champRecherche = array_diff($champRecherche, array($displayed_field_election, ));
}
$tab_title = _("delegation_participation");
$ent .= " -> "._("delegation_participation");