<?php
-function schema2form($file, $pid=null, $id=null, $cat=null, $data=null){
+function schema2form($file, $pid=null, $id=null, $cat=null, $data=null, $time=null){
global $db;
$schema=json_decode(file_get_contents($file));
$value="value='".$data->$field."'";
$value2=$data->$field;
}
+ elseif(!empty($time) && $field=="date"){
+ $value="value='".date("Y-m-d", $time)."'";
+ $value2=date("Y-m-d", $time);
+ }
+ elseif(!empty($time) && $field=="time"){
+ $value="value='".date("H:i", $time)."'";
+ $value2=date("H:i", $time);
+ }
else{
$value="";
$value2="";
$sample="value='".$data->sample."'";
$organism="value='".$data->organism."'";
}
- elseif(!empty($_GET["sample"])){
- $date="";
- $sample="value='".$_GET["sample"]."'";
+ elseif(!empty($_GET["time"]) || !empty($_GET["sample"])){
+ if(!empty($_GET["time"])){
+ $date="value='".date("Y-m-d", $_GET["time"])."'";
+ }
+ if(!empty($_GET["sample"])){
+ $sample="value='".$_GET["sample"]."'";
+ }
$organism="";
}
else{
$pid=$arr["pid"];
if(!empty($arr["form"])){
if($arr["form"]=="report-cs"){
- $test="<a href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&src=index'>".$arr["test"]."</a>";
+ $test="<a href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>".$arr["test"]."</a>";
}
else{
- $test="<a href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&src=index'>".$arr["test"]."</a>";
+ $test="<a href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>".$arr["test"]."</a>";
}
}
else{
exit();
}
}
+ if(!empty($_GET["time"])){
+ $time=$_GET["time"];
+ }
+ else{
+ $time=null;
+ }
if(isSet($_GET["id"])){
- $form=schema2form("forms/".$_GET["form"].".schema.json", $pid, $_GET["id"], "reports");
+ $form=schema2form("forms/".$_GET["form"].".schema.json", $pid, $_GET["id"], "reports", null, $time);
}
else{
- $form=schema2form("forms/".$_GET["form"].".schema.json");
+ $form=schema2form("forms/".$_GET["form"].".schema.json", null, null, null, null, $time);
}
}
?>
else{
$sample="";
}
+if(!empty($_GET["time"])){
+ $time="&time=".$_GET["time"];
+}
+else{
+ $time="";
+}
if(!empty($_GET["src"]) && $_GET["src"]=="index"){
$src="&src=index";
}
<div class="card-body">
<h4 class="card-title">Type of Organism</h4>
<ul class="list-group">
- <li class="list-group-item"><a href="report.php?pid=<?php echo $pid;?>&form=report-cs<?php echo $req;?><?php echo $sample;?><?php echo $src;?>">No growth</a></li>
- <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-grampos<?php echo $req;?><?php echo $sample;?><?php echo $src;?>">Vitek Report (Gram Positive)</a></li>
- <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-gramneg<?php echo $req;?><?php echo $sample;?><?php echo $src;?>">Vitek Report (Gram Negative)</a></li>
- <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-fungal<?php echo $req;?><?php echo $sample;?><?php echo $src;?>">Vitek Report (Fungal)</a></li>
+ <li class="list-group-item"><a href="report.php?pid=<?php echo $pid;?>&form=report-cs<?php echo $req;?><?php echo $sample;?><?php echo $time;?><?php echo $src;?>">No growth</a></li>
+ <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-grampos<?php echo $req;?><?php echo $sample;?><?php echo $time;?><?php echo $src;?>">Vitek Report (Gram Positive)</a></li>
+ <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-gramneg<?php echo $req;?><?php echo $sample;?><?php echo $time;?><?php echo $src;?>">Vitek Report (Gram Negative)</a></li>
+ <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-fungal<?php echo $req;?><?php echo $sample;?><?php echo $time;?><?php echo $src;?>">Vitek Report (Fungal)</a></li>
</ul>
</div>
</div>