$mListe->AjouterColSelection(COL_DEPENDFONCTIONNALITE);
$numJointure = $mListe->AjouterJointure(COL_MENU, COL_ID, 0, SQL_LEFT_JOIN);
$numJointure = $mListe->AjouterJointure(COL_LIBELLE, COL_ID, $numJointure, SQL_LEFT_JOIN);
$mListe->AjouterColSelectionPourJointure($numJointure, COL_LIBELLE, COL_MENU . COL_LIBELLE);
$mListe->AjouterFiltreEgalPourJointure($numJointure, COL_LANGUE, GSession::Langue(COL_ID));
$mListe->AjouterColOrdre(COL_ORDRE);
$mListe->Charger();
// Liste des menus principaux.
$mListeMenusPrincipaux = new MListeMenus();
$menus = $mListe->GetListe();
foreach ($menus as $menu) {
    if ($menu->Menu()->Id() === NULL) {
        $mListeMenusPrincipaux->AjouterElement($menu);
    }
}
$menusPrincipaux = $mListeMenusPrincipaux->GetListe();
foreach ($menusPrincipaux as $menuPrincipal) {
    $nbSousMenus = 0;
    $cListeSousMenus = new CListeMenus($prefixIdClass, 'Menus_' . $menuPrincipal->Id(), $nomContexte, -1);
    $cListeSousMenus->SetListeParente($cListe, $menuPrincipal->Id());
    $mListeSousMenus = new MListeMenus();
    // On regarde les sous-menus qui sont rattachés aux menus principaux.
    foreach ($menus as $menu) {
        if ($menuPrincipal->Id() === $menu->Menu()->Id()) {
            // On vérifie que le joueur à les droits d'accès aux fonctionnalités liées au menu.
            $mListeMenusFonctionnalites = $menu->ListeMenusFonctionnalites();
            if ($mListeMenusFonctionnalites->ListeChargee() !== true) {
                $mListeMenusFonctionnalites->Charger();
            }
            $listeMenusFonctionnalites = $mListeMenusFonctionnalites->GetListe();
            $insertionMenuOk = true;