isAuthorized(array($obj,$obj."_exporter"),"OR"); $f->disableLog(); // Récupération des fichiers d'include if (file_exists ("../sql/".$f -> phptype."/".$obj.".inc.php")) { include ("../sql/".$f -> phptype."/".$obj.".inc.php"); } elseif (file_exists ("../sql/".$f -> phptype."/".$obj.".inc")) { include ("../sql/".$f -> phptype."/".$obj.".inc"); } // Les variables sont surcharger pour afficher plus ou moins de champs if (file_exists ("../sql/".$f-> phptype."/".$obj.".reqmo.inc.php")) { include ("../sql/".$f -> phptype."/".$obj.".reqmo.inc.php"); } elseif (file_exists ("../sql/".$f -> phptype."/".$obj.".reqmo.inc")) { include ("../sql/".$f -> phptype."/".$obj.".reqmo.inc"); } // Instanciation d'om_table require_once "../obj/om_table.class.php"; $tb = new om_table("../scr/tab.php", $table, $serie, $champAffiche, $champRecherche, $tri, $selection, $edition, $options, $advs_id); // Affectation des parametres $params = array( "obj" => $obj, "premier" => $premier, "recherche" => $recherche, "selectioncol" => $selectioncol, "tricol" => $tricol, "advs_id" => $advs_id, "valide" => $valide, ); $tb->setParams($params); // Methode permettant de definir si la recherche doit etre faite // sur la recherche simple ou avncee $tb->composeSearchTab(); // Generation de la requete de recherche $tb->composeQuery(); $res = $f->db->query($tb->sql); $f->isDatabaseError($res); $nbligne=$res->numrows(); if($nbligne>0){ //OUPUT HEADERS header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/csv"); header("Content-Disposition: attachment; filename=\"$filename.csv\";" ); header("Content-Transfer-Encoding: binary"); $header=true; // Ouverture du flux de sortie $out = fopen('php://output', 'w'); // Formatage de chaque ligne pour csv while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ if($header) { fputcsv($out, array_keys($row), ';','"'); $header=false; } fputcsv($out, $row, ';','"'); } // Affichage de la sortie standard readfile('php://output'); // Fermeture de la sortie fclose($out); }else { header('Location: ../scr/tab.php?obj='.$obj. '&premier='.$premier. '&tricol='.$tricol. '&advs_id='.$advs_id. '&valide='.$valide. '&recherche='.$recherche. '&selectioncol='.$selectioncol ); } ?>