";
// on récupére le nombre de lignes
if(!$nbr_lignes) {
$requete = "SELECT COUNT(1) FROM groupe $clause ";
$res = mysql_query($requete, $dbh);
$nbr_lignes = @mysql_result($res, 0, 0);
}
if(!$page) $page=1;
$debut =($page-1)*$nb_per_page;
if($nbr_lignes) {
// on lance la vraie requête
$requete = "SELECT id_groupe, libelle_groupe, resp_groupe, concat(IFNULL(empr_prenom,'') ,' ',IFNULL(empr_nom,'')) as resp_name, count( empr_id ) as nb_empr FROM groupe LEFT JOIN empr_groupe ON groupe_id = id_groupe left join empr on resp_groupe = id_empr
$clause group by id_groupe, libelle_groupe, resp_groupe, resp_name ORDER BY libelle_groupe LIMIT $debut,$nb_per_page ";
$res = mysql_query($requete, $dbh);
if ((mysql_num_rows($res) > 1)||($page>1)) {
$parity=1;
$group_list .= "
".$msg[904]."
".$msg[913]."
".$msg['circ_group_emprunteur']."
".$msg['349']."
".$msg['reserv_en_cours']."
";
while($rgroup=mysql_fetch_object($res)) {
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$nb_pret=0;
$requete = "SELECT count( pret_idempr ) as nb_pret FROM empr_groupe,pret where groupe_id=$rgroup->id_groupe and empr_id = pret_idempr";
$res_pret = mysql_query($requete, $dbh);
if (mysql_num_rows($res_pret)) {
$rpret=mysql_fetch_object($res_pret);
$nb_pret=$rpret->nb_pret;
}
$nb_resa=0;
$requete = "SELECT count( resa_idempr ) as nb_resa FROM empr_groupe,resa where groupe_id=$rgroup->id_groupe and empr_id = resa_idempr";
$res_resa = mysql_query($requete, $dbh);
if (mysql_num_rows($res_resa)) {
$rresa=mysql_fetch_object($res_resa);
$nb_resa=$rresa->nb_resa;
}
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./circ.php?categ=groups&action=showgroup&groupID=$rgroup->id_groupe';\" ";
$group_list .= "