$b['lib_rub_no_html'];
}
// affichage des membres de la page
function show_results($nbr_lignes=0, $page=0) {
global $nb_per_page;
global $base_url;
global $caller;
global $charset;
global $msg;
global $id_bibli, $id_exer;
global $acquisition_budget_show_all;
global $elt_query;
// on récupére le nombre de lignes qui vont bien
$nbr_lignes = entites::countRubriquesFinales($id_bibli, $id_exer, true, $elt_query);
if (!$page) $page=1;
$debut = ($page-1)*$nb_per_page;
if($nbr_lignes) {
// on lance la vraie requête
if(!$acquisition_budget_show_all){
$res = entites::listRubriquesFinales($id_bibli, $id_exer, true, $debut, $nb_per_page, $elt_query);
}else{
$res = entites::listRubriquesFinales($id_bibli, $id_exer, true, 0, 0, $elt_query);
}
$id_bud = 0;
print "
".htmlentities($msg['acquisition_rub'], ENT_QUOTES, $charset)." | ".htmlentities($msg['acquisition_rub_sol'], ENT_QUOTES, $charset)." |
";
$arrayRub=array();
while($row = pmb_mysql_fetch_object($res)) {
$new_id_bud = $row->num_budget;
if ($new_id_bud != $id_bud) {
//Affichage des rubriques précédentes
if (count($arrayRub)) {
//tri des rubriques par ordre alphabétique
usort($arrayRub, "sort_array_rub");
foreach ($arrayRub as $rub) {
print " | ".$rub["sol"]." |
");
}
}
//Affichage budget
$id_bud = $new_id_bud;
print pmb_bidi("".htmlentities($row->lib_bud, ENT_QUOTES, $charset)." | ");
if($row->type_budget) {
$aff_glo = true;
$mnt = $row->montant_global;
$cal = budgets::calcEngagement($id_bud);
if($cal > $mnt) $sol=0; else $sol = $mnt-$cal;
$sol = number_format($sol, 2,'.','' );
if($cal > $mnt*($row->seuil_alerte/100)) $alert = true; else $alert = false;
} else {
$aff_glo = false;
}
print " |
";
//Rubriques
$arrayRub=array();
}
$tab_rub = rubriques::listAncetres($row->id_rubrique, true);
$lib_rub = '';
$lib_rub_no_html = "" ;
foreach ($tab_rub as $value) {
$lib_rub.= htmlentities($value[1], ENT_QUOTES, $charset);
$lib_rub_no_html.= $value[1];
if($value[0] != $row->id_rubrique) $lib_rub.= ":";
}
if(!$aff_glo) {
$mnt = $row->montant;
$cal = rubriques::calcEngagement($row->id_rubrique);
if($cal > $mnt) $sol=0; else $sol = $mnt-$cal;
$sol = number_format($sol, 2,'.','' );
if($cal >= $mnt*($row->seuil_alerte/100)) $alert = true; else $alert = false;
}
if ($alert) $cl = "class='erreur' "; else $cl= '';
$arrayRub[] = array(
"id_rubrique"=>$row->id_rubrique,
"lib_bud"=>$row->lib_bud,
"lib_rub_no_html"=>$lib_rub_no_html,
"cl"=>$cl,
"lib_rub"=>$lib_rub,
"sol"=>$sol
);
}
//Affichage des rubriques restantes
if (count($arrayRub)) {
//tri des rubriques par ordre alphabétique
usort($arrayRub, "sort_array_rub");
foreach ($arrayRub as $rub) {
print " | ".$rub["sol"]." |
");
}
}
print "
";
pmb_mysql_free_result($res);
// affichage pagination
print "
";
if(!$acquisition_budget_show_all){
$base_url.="&elt_query=".$elt_query;
$nav_bar = aff_pagination ($base_url, $nbr_lignes, $nb_per_page, $page, 10, true, true) ;
print $nav_bar;
}
print "
";
}
}
print $sel_footer;