<?
include ("connection.php");

$id=$_GET["id"];

$requete="SELECT \"NAME\",\"SPECIES\" from \"EMBRYO\" where \"EMBRYO_ID\"='$id'";
$stmt=pg_query($c,$requete);
$row=pg_fetch_array($stmt);

$name=$row["NAME"];
$name=str_replace("@","_",$name);
$name=str_replace(" ","_",$row["SPECIES"])."_".$name;


//////////header force download ///////////////////////
header("Content-disposition: attachment; filename=$name.$id.BIOM.txt");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: text/plain\n"); // Surtout ne pas enlever le \n
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");



print "#Cell / Sphericity / Elongation / Flatness / squareness / entropy / Surf/Vol / Convexity / v/V /\n";
print "#devstage=\n";


$requete="SELECT \"CELL\",\"SPHERICITY\",\"ELONGATION\",\"FLATNESS\",\"OCCUPENCY\",\"ENTROPY\",\"SV\",\"CONVEXITY\",\"VV\" from \"EMBRYO_BIOMETRY_SHAPE\" where \"EMBRYO_ID\"='$id'";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt))
{

$cell=$row["CELL"];
$sph=$row["SPHERICITY"];
$elo=$row["ELONGATION"];
$fla=$row["FLATNESS"];
$occ=$row["OCCUPENCY"];
$ent=$row["ENTROPY"];
$sv=$row["SV"];
$con=$row["CONVEXITY"];
$vv=$row["VV"];


$requete0="SELECT \"NAME\" from \"ANAT_ENTITY\" where \"ANAT_ID\"='$cell'";
$stmt0=pg_query($c,$requete0);
$row0=pg_fetch_array($stmt0);
$anatname=$row0["NAME"];


print "$anatname\t$sph\t$elo\t$fla\t$occ\t$ent\t$sv\t$con\t$vv\n";


}









?> 
