1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?php
// ------------------------------------
// 1/ LISTE des CATEGORIES
// ------------------------------------
foreach ($managerCategorie->getListeSupCategorieActiver() as $ItemListeCategorie)
{
$body .= '<tr><td style="font-weight:bold;color:black;border:1px solid #999999;background-color:#E2E2E2" colspan="6">'.$ItemListeCategorie->getTitreCategorie().'</td></tr>'."\n";
// ------------------------------------
// 2/ RECUPERER un array des sous-categories COCHEES par le membre et qui avaient été enregistrées dans la bdd sur cette liste de categorie
// ------------------------------------
// recuperer un tableau des sous-categories de la table categorie
$ItemListeCategorieCentre = $managerMembreCentre->getListCentreByMembre($_SESSION['id_membre']);
// on veut juste recuperer les id_categorie
foreach($ItemListeCategorieCentre as $key => $ListCentreId)
{
$ItemListeIdCategorie[$key] = $ListCentreId->getIdCategorie(); // array des id_categorie
} // fin 2eme foreach
// ------------------------------------
// 3/ LISTE des SOUS-CATEGORIES (de cette categorie)
// ------------------------------------
foreach($managerCategorie->getListeSousCategorieByIdActiver($ItemListeCategorie->getIdCategorie()) as $infosC)
{
// COCHER les SOUS-CATEGORIES
// si c'est une option sélectionnée : on la coche
$selected = ( in_array($infosC->getIdCategorie(), $ItemListeIdCategorie ) )? ' checked="checked"' : '';
if ($i%3 == 0) {
// passage a la ligne
$body .= '<tr></tr>'."\n";
}
$body .= '<td><input type="checkbox" name="ref_centre[]" id="ref_centre[]" value="'.$infosC->getIdCategorie().'"'. $selected .'" /></td>'."\n";
$body .= '<td>'. $infosC->getTitreCategorie().'</td>'."\n";
$i++;
} // fin 3eme foreach
} // fin 1er foreach
?> |