addworksheet(); $worksheet->write(0,0,$titre_page); break; case "TABLEAUHTML": echo "

".$titre_page."

" ; break; default: echo "

".$titre_page."

" ; break; } // nombre de références par pages if ($nb_per_page_empr != "") $nb_per_page = $nb_per_page_empr ; else $nb_per_page = 10; // restriction localisation le cas échéant if ($pmb_lecteurs_localises) { if ($empr_location_id=="") $empr_location_id = $deflt2docs_location ; if ($empr_location_id!=0) $restrict_localisation = " AND empr_location='$empr_location_id' "; else $restrict_localisation = ""; } // filtré par un statut sélectionné if ($empr_statut_edit) { if ($empr_statut_edit!=0) $restrict_statut = " AND empr_statut='$empr_statut_edit' "; else $restrict_statut=""; } // on récupére le nombre de lignes if(!$nbr_lignes) { $requete = "SELECT COUNT(1) FROM empr, empr_statut, empr_categ where empr.empr_categ=empr_categ.id_categ_empr "; $requete = $requete.$restrict_localisation.$restrict_statut." and ".$restrict; $requete .= " and empr_statut=idstatut"; $res = mysql_query($requete, $dbh); $nbr_lignes = @mysql_result($res, 0, 0); } //Si aucune limite_page n'a été passée, valeur par défaut $nb_per_page if (!$limite_page) $limite_page = $nb_per_page; else $nb_per_page = $limite_page; $nbpages= $nbr_lignes / $limite_page; if(!$page) $page=1; $debut =($page-1)*$nb_per_page; if($nbr_lignes) { if ($statut_action=="modify") { $requete="UPDATE empr, empr_categ set empr_statut='$empr_chang_statut_edit' where empr.empr_categ=empr_categ.id_categ_empr ".$restrict_localisation.$restrict_statut." and ".$restrict; $restrict_statut = " AND empr_statut='$empr_chang_statut_edit' "; @mysql_query($requete); } // on lance la vraie requête $requete = "SELECT empr.*, date_format(empr_date_adhesion, '".$msg["format_date"]."') as aff_empr_date_adhesion, date_format(empr_date_expiration, '".$msg["format_date"]."') as aff_empr_date_expiration, statut_libelle, empr_categ.libelle as categ_libelle FROM empr, empr_statut, empr_categ "; $restrict_empr = " WHERE empr.empr_categ=empr_categ.id_categ_empr "; $restrict_requete = $restrict_empr.$restrict_localisation.$restrict_statut." and ".$restrict; $requete .= $restrict_requete; $requete .= " and empr_statut=idstatut "; if (!isset($sortby)) $sortby = 'empr_nom'; $requete .= " ORDER BY $sortby "; switch($dest) { case "TABLEAU": $res = @mysql_query($requete, $dbh); $nbr_champs = @mysql_num_fields($res); for($n=0; $n < $nbr_champs; $n++) { $worksheet->write(2,$n,mysql_field_name($res,$n)); } for($i=0; $i < $nbr_lignes; $i++) { $row = mysql_fetch_row($res); $j=0; foreach($row as $dummykey=>$col) { if(!$col) $col=" "; $worksheet->write(($i+3),$j,$col); $j++; } } $workbook->close(); $fh=fopen($fname, "rb"); fpassthru($fh); unlink($fname); break; case "TABLEAUHTML": $res = @mysql_query($requete, $dbh); $empr_list = "" ; $empr_list .=""; while(($empr=mysql_fetch_object($res))) { $empr_list .= ""; $empr_list .= " "; $empr_list .= ""; $empr_list .= ""; $empr_list .= ""; } $empr_list .= "
$msg[code_barre_empr] $msg[nom_prenom_empr] $msg[adresse_empr] $msg[ville_empr] $msg[year_empr] $msg[readerlist_dateexpiration] $msg[statut_empr]
$empr->empr_cb $empr->empr_nom $empr->empr_prenom $empr->empr_adr1 $empr->empr_adr2 $empr->empr_ville $empr->empr_year".$empr->aff_empr_date_expiration."".$empr->statut_libelle."
" ; echo $empr_list ; break; default: $requete .= "LIMIT $debut,$nb_per_page "; $res = @mysql_query($requete, $dbh); $parity=1; $empr_list .=" $msg[code_barre_empr] $msg[nom_prenom_empr] $msg[adresse_empr] $msg[ville_empr] $msg[year_empr] $msg[readerlist_dateexpiration] $msg[statut_empr]"; switch ($sub) { case "encours" : $empr_list .=""; break; case "categ_change" : $empr_list .="$msg[categ_empr] $msg[empr_categ_change_prochain]"; break; default : $empr_list .=""; break; } $empr_list .=""; while(($empr=mysql_fetch_object($res))) { if ($parity % 2) $pair_impair = "even"; else $pair_impair = "odd"; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" "; $script="onclick=\"document.location='./circ.php?categ=pret&form_cb=".rawurlencode($empr->empr_cb)."';\""; $empr_list .= ""; $empr_list .= " $empr->empr_cb $empr->empr_nom $empr->empr_prenom $empr->empr_adr1 $empr->empr_ville $empr->empr_year"; $empr_list .= "".$empr->aff_empr_date_expiration.""; $empr_list .= "".$empr->statut_libelle.""; switch ($sub) { case "encours" : $empr_list .= "".""; break; case "categ_change" : $empr_list.="".$empr->categ_libelle.""; $empr_list.=""; $today = getdate(); $age_lecteur = $today["year"] - $empr->empr_year; // on construit le select catégorie $query = "SELECT id_categ_empr, libelle FROM empr_categ WHERE (".$age_lecteur." >= age_min or age_min=0) and (".$age_lecteur." <= age_max or age_max=0) ORDER BY age_min "; $result = mysql_query($query, $dbh); $nbr_rows = mysql_num_rows($result); $empr_list.= ""; $empr_list .= " $msg[1905]  
Export tableau EXCEL   Export tableau HTML  
"; if ($pmb_lecteurs_localises) echo docs_location::gen_combo_box_empr($empr_location_id); echo gen_liste("select idstatut, statut_libelle from empr_statut","idstatut","statut_libelle","empr_statut_edit","",$empr_statut_edit,-1,"",0,$msg["all_statuts_empr"]); $sort_params = array('empr_nom' => $msg['readerlist_name'], 'empr_cb' => $msg['readerlist_code'], 'empr_ville' => $msg['readerlist_ville'], 'empr_date_expiration' => $msg['readerlist_dateexpiration']); echo " ".$msg["sort_by"].": "; echo ''; echo "   "; if ($empr_show_caddie) $bt_add_panier="  "; else $bt_add_panier=""; echo "

"; print ""; switch ($sub) { case "categ_change" : print pmb_bidi("
".$empr_list."
"); break; default : print pmb_bidi("".$empr_list."
"); break; } echo "
"; if ($sub=="categ_change") echo " "; if ($sub=="limite" || $sub=="depasse") echo " "; echo "$bt_add_panier
".$msg["empr_chang_statut"]."  ".gen_liste("select idstatut, statut_libelle from empr_statut","idstatut","statut_libelle","empr_chang_statut_edit","","",0,"",0,"")."  
"; break; } //switch($dest) } else { // la requête n'a produit aucun résultat switch($dest) { case "TABLEAU": break; case "TABLEAUHTML": break; default: error_message($msg[46], str_replace('!!form_cb!!', $form_cb, $msg['edit_lect_aucun_trouve']), 1, './edit.php?categ=empr&sub='.$sub); } }