$affichage .= '<th class="nu">&nbsp;&nbsp;&nbsp;</th>';
 $affichage .= '<th class="nu">';
 $affichage .= '<p><label for="Afficher_pourcentage"><input type="checkbox" id="Afficher_pourcentage" /> <span for="Afficher_pourcentage" class="socle_info voir">Afficher / Masquer les pourcentages d\'items d\'enseignements acquis.</span></label></p>';
 $affichage .= '<p><button id="Enregistrer_validation" type="button" class="valider">Enregistrer les validations</button> <button id="fermer_zone_validation" type="button" class="retourner">Retour</button><label id="ajax_msg_validation"></label></p>';
 $affichage .= '<div><button id="go_precedent_groupe" type="button" class="go_precedent" title="Classe / groupe précédent.">&nbsp;</button> <button id="go_suivant_groupe" type="button" class="go_suivant" title="Classe / groupe suivant.">&nbsp;</button> <span class="m1 b">@GROUPE@</span></div>';
 $affichage .= '<div><button id="go_precedent_palier" type="button" class="go_precedent" title="Palier précédent.">&nbsp;</button> <button id="go_suivant_palier" type="button" class="go_suivant" title="Palier suivant.">&nbsp;</button> <span class="m1 b">@PALIER@</span></div>';
 $affichage .= '<div><button id="go_precedent_pilier" type="button" class="go_precedent" title="Compétence précédente.">&nbsp;</button> <button id="go_suivant_pilier" type="button" class="go_suivant" title="Compétence suivante.">&nbsp;</button> <span class="n1 b">@PILIER@</span></div>';
 $affichage .= '</th>';
 $affichage .= '</tr></thead>';
 $affichage .= '<tbody>';
 // Récupérer l'arborescence du pilier du socle sélectionné (éventuellement restreint à des domaines précisés)
 // Mémoriser au passage le listing des entrées du socle
 // Mémoriser au passage la liste des entrées du socle par pilier
 $tab_entree_id = array();
 $tab_pilier_entree = array();
 $DB_TAB = DB_STRUCTURE_SOCLE::DB_recuperer_arborescence_pilier($pilier_id, $listing_domaine_id);
 $pilier_id = 0;
 foreach ($DB_TAB as $DB_ROW) {
     if ($DB_ROW['pilier_id'] != $pilier_id) {
         $pilier_id = $DB_ROW['pilier_id'];
         $section_id = 0;
         $entree_id = 0;
     }
     if (!is_null($DB_ROW['section_id']) && $DB_ROW['section_id'] != $section_id) {
         $section_id = $DB_ROW['section_id'];
         // Afficher la ligne du tableau avec les validations pour toute une section, puis le nom de la section (officiellement domaine)
         $affichage .= '<tr>';
         foreach ($tab_eleve_id as $eleve_id) {
             $affichage .= '<th id="S' . $section_id . 'U' . $eleve_id . '" class="down1" title="Modifier la validation de tout le domaine pour cet élève."></th>';
         }
         $affichage .= '<th id="S' . $section_id . '" class="diag1" title="Modifier la validation de tout le domaine pour tous les élèves."></th>';
$tab_eval = array();
// [eleve_id][socle_id][item_id][]['note'] => note   [type "pourcentage" uniquement]
$tab_item = array();
// [item_id] => array(calcul_methode,calcul_limite); [type "pourcentage" uniquement]
$tab_user_entree = array();
// [eleve_id][entree_id] => array(etat,date,info);   [type "validation" uniquement]
$tab_user_pilier = array();
// [eleve_id][pilier_id] => array(etat,date,info);   [type "validation" uniquement]
// Tableau des langues
require CHEMIN_DOSSIER_INCLUDE . 'tableau_langues_socle.php';
$tab_item_pilier = array();
// id de l'item => id du pilier
// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Récupération de la liste des items du socle pour le ou les piliers sélectionné(s)
// ////////////////////////////////////////////////////////////////////////////////////////////////////
$DB_TAB = $memo_demande == 'pilier' ? DB_STRUCTURE_SOCLE::DB_recuperer_arborescence_pilier($tab_pilier_id[0]) : DB_STRUCTURE_SOCLE::DB_recuperer_arborescence_piliers(implode(',', $tab_pilier_id));
if (empty($DB_TAB)) {
    exit('Aucun item référencé pour cette partie du socle commun !');
}
$pilier_id = 0;
$socle_id = 0;
foreach ($DB_TAB as $DB_ROW) {
    if (!is_null($DB_ROW['pilier_id']) && $DB_ROW['pilier_id'] != $pilier_id) {
        $pilier_id = $DB_ROW['pilier_id'];
        $tab_pilier[$pilier_id] = array('pilier_ref' => $DB_ROW['pilier_ref'], 'pilier_nom' => $DB_ROW['pilier_nom'], 'pilier_nb_entrees' => 0);
    }
    if (!is_null($DB_ROW['section_id'])) {
        $section_nom = $DB_ROW['section_nom'];
    }
    if (!is_null($DB_ROW['entree_id']) && $DB_ROW['entree_id'] != $socle_id) {
        $socle_id = $DB_ROW['entree_id'];
 $tab_item = array();  // [entree_id] => 0/1;
 $DB_TAB = DB_STRUCTURE_SOCLE::DB_lister_jointure_user_entree($eleve_id,$listing_entree_id='',$domaine_id=0,$pilier_id,$palier_id=0);
 if(empty($DB_TAB))
 {
   exit('Aucune validation d\'item n\'est renseignée pour cette compétence !');
 }
 foreach($DB_TAB as $DB_ROW)
 {
   $tab_item[$DB_ROW['entree_id']] = $DB_ROW['validation_entree_etat'];
 }
 // Récupérer l'arborescence du pilier du socle ; préparer l'affichage et comptabiliser les différents états de validation
 $tab_texte_stats = array(1=>'validé',0=>'invalidé',2=>'non renseigné');
 $tab_texte_items = array(1=>'OUI',0=>'NON',2=>'???');
 $tab_validation_socle = array(1=>0,0=>0,2=>0);
 $affichage_socle = '';
 $DB_TAB = DB_STRUCTURE_SOCLE::DB_recuperer_arborescence_pilier($pilier_id);
 $section_id = 0;
 foreach($DB_TAB as $DB_ROW)
 {
   if( (!is_null($DB_ROW['section_id'])) && ($DB_ROW['section_id']!=$section_id) )
   {
     $section_id = $DB_ROW['section_id'];
     $affichage_socle .= '<div class="n2 i">'.html($DB_ROW['section_nom']).'</div>';
     $entree_id  = 0;
   }
   if( (!is_null($DB_ROW['entree_id'])) && ($DB_ROW['entree_id']!=$entree_id) )
   {
     $entree_id = $DB_ROW['entree_id'];
     $etat = (isset($tab_item[$DB_ROW['entree_id']])) ? $tab_item[$DB_ROW['entree_id']] : 2 ;
     $affichage_socle .= '<div class="n3"><tt class="v'.$etat.'">'.$tab_texte_items[$etat].'</tt>'.html($DB_ROW['entree_nom']).'</div>';
     $tab_validation_socle[$etat]++;