-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSF.php
847 lines (774 loc) · 28.5 KB
/
PSF.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
<!DOCTYPE html>
<html>
<head>
<title>Evolution of PSF in time</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Demo project">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<style type="text/css"></style>
</head>
<body>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<!-- Connection to the database -->
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=PSF;charset=utf8','root','admin');
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
//Get the name of the tables in order to choose the microscope
$choiceMicroscope = $bdd->query('select table_name from information_schema.tables where table_schema="PSF"');
?>
<form method="POST" action="PSF.php">
<!-- Menu with the different microscopes -->
<select id="Microscope" name="Microscope" onChange="hideshow();" onMouseDown="document.getElementById('ObjMagn').selectedIndex=0;" required>
<option value="None">Select Microscope</option>
<?php
//Secure way of making a list with the different microscope and avoid SQL injections
$table_list = array();
$numMic = 0;
while($choice = $choiceMicroscope->fetch())
{
?>
<option value="<?php echo $numMic; ?>"><?php echo $choice['table_name']; ?></option>
<?php
$numMic++;
array_push($table_list,$choice['table_name']);
}
?>
</select>
<!-- Objective magnification menu with all the different values -->
<select id="ObjMagn" name="ObjMagn" style="display:none" onChange="hideshow();" required>
<option value="None">Select Objective Magnification</option>
<option value="40x">40x</option>
<option value="60x">60x</option>
<option value="63x">63x</option>
<option value="100x">100x</option>
<option value="20x">20x</option>
</select>
<!-- Objective NA menu with all the different values -->
<select id="NA" name="NA" style="display:none" required>
<option value="">Select Objective Numerical Aperture</option>
<option value="1.3">1.3</option>
<option value="1.4">1.4</option>
<option value="1.42">1.42</option>
<option value="1.46">1.46</option>
<option value="0.75">0.75</option>
<option value="0.95">0.95</option>
<option value="1.0">1.0</option>
</select>
<!-- Airy Unit menu with all the different values -->
<select id="AU" name="AU" style="display:none" required>
<option value= "">Select Airy Unit</option>
<option value= "1">1</option>
<option value="Max">Max</option>
</select>
<!-- Date you want the values to be shown -->
<br>
Select the date from which the values will be shown. Format is YYYY-MM-DD<br>
<input type="date" name="Date" id="Date" value="0000-00-00" />
<br>
Select the date until which the values will be shown. Format is YYYY-MM-DD<br>
<input type="date" name="DateEnd" id="DateEnd" value="9999-12-31" />
<br>
<!-- Submit button -->
<input type="Submit" value="Send" id="Send" name="Send" style="display:none" >
</form>
<script type='text/javascript'>
//Function to hide and/or show the different menus depending of the previous one(s)
function hideshow()
{
var obj= document.getElementById("ObjMagn"); //Values of the menu ObjMagn
var sub= document.getElementById("Send"); //Get the button to hide/show it
var au= document.getElementById("AU"); //Values of the menu AU
var mic = document.getElementById("Microscope"); //Values of the menu Microscope
var na = document.getElementById("NA"); //Values of the menu NA
var array = <?php echo json_encode($table_list); ?>; //Array of the microscopes encoded in JS
var micChoice1 = mic.options[mic.selectedIndex].value; //Get the number of the microscope selected
var micChoice = array[micChoice1]; //Name of the selected microscope
var objChoice = obj.options[obj.selectedIndex].value; //Get the Obj menu to hide/show it
//If the microscope selected is different than a LSM
if (micChoice != "None" && micChoice.substr(0,3) != "LSM")
{
//If it's CellR
if (micChoice == "CellR")
{
//Only show the corresponding options
obj.style.display="block";
obj[1].style.display="block";
obj[2].style.display="block";
obj[3].style.display="none";
obj[4].style.display="none";
obj[5].style.display="block";
sub.style.display="block";
au.required=false;
au.style.display="none";
//Hide the menu
if(objChoice != "None")
{
switch (objChoice)
{
case "60x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="none";
na[3].style.display="block";
na.selectedIndex = 3;
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "20x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="none";
na[3].style.display="none";
na.selectedIndex = 5;
na[4].style.display="none";
na[5].style.display="block";
na[6].style.display="none";
na[7].style.display="none";
break;
case "40x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="none";
na[3].style.display="none";
na.selectedIndex = 6;
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="block";
na[7].style.display="none";
}
}
//Show it
else
{
na.style.display="none";
}
}
//If it's the AxioObserver
else
{
obj.style.display="block";
obj[1].style.display="block";
obj[2].style.display="none";
obj[3].style.display="block";
obj[4].style.display="block";
obj[5].style.display="none";
sub.style.display="block";
au.required=false;
au.style.display="none";
//Depending on the choice we show/hide the corresponding options
if(objChoice != "None")
{
switch (objChoice)
{
case "40x" :
//alert("40x");
na.style.display="block";
na[0].style.display="none";
na[1].style.display="block";
na.selectedIndex = 1;
na[2].style.display="none";
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "63x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "100x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
}
}
//else hide it
else
{
na.style.display="none";
}
}
}
//Test if the microscope's a LSM
else if(micChoice != "None" && micChoice.substr(0,3) == "LSM")
{
//Depending on the choices, show/hide the corresponding options
switch (micChoice)
{
case "LSM700":
obj.style.display="block";
obj[1].style.display="block";
obj[2].style.display="none";
obj[3].style.display="block";
obj[4].style.display="none";
obj[5].style.display="none";
sub.style.display="block";
au.required = true;
au.style.display="block";
if(objChoice != "None")
{
switch (objChoice)
{
case "40x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="block";
na.selectedIndex = 1;
na[2].style.display="none";
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "63x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
}
}
else
{
na.style.display="none";
}
break;
case "LSM710":
obj.style.display="block";
obj[1].style.display="block";
obj[2].style.display="none";
obj[3].style.display="none";
obj[4].style.display="none";
obj[5].style.display="block";
sub.style.display="block";
au.required = true;
au.style.display="block";
if(objChoice != "None")
{
switch (objChoice)
{
case "40x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="block";
na[2].style.display="none";
na.selectedIndex = 1;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "20x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="none";
na.selectedIndex = 7;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="block";
break;
}
}
else
{
na.style.display="none";
}
break;
case "LSM780":
obj.style.display="block";
obj[1].style.display="none";
obj[2].style.display="none";
obj[3].style.display="block";
obj[4].style.display="block";
obj[5].style.display="none";
sub.style.display="block";
au.required = true;
au.style.display="block";
if(objChoice != "None")
{
switch (objChoice)
{
case "63x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "100x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="none";
na[3].style.display="none";
na[4].style.display="block";
na.selectedIndex = 4;
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
}
}
case "LSM880":
obj.style.display="block";
obj[1].style.display="block";
obj[2].style.display="none";
obj[3].style.display="block";
obj[4].style.display="none";
obj[5].style.display="none";
sub.style.display="block";
au.required = true;
au.style.display="block";
if(objChoice != "None")
{
switch (objChoice)
{
case "40x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
break;
case "63x" :
na.style.display="block";
na[0].style.display="none";
na[1].style.display="none";
na[2].style.display="block";
na.selectedIndex = 2;
na[3].style.display="none";
na[4].style.display="none";
na[5].style.display="none";
na[6].style.display="none";
na[7].style.display="none";
}
}
else
{
na.style.display="none";
}
break;
}
}
else
{
obj.style.display="none";
sub.style.display="none";
au.required=false;
au.style.display="none";
na.style.display="none";
}
}
</script>
<script type='text/javascript'>
//Function to draw the chart
function drawChart()
{
//Table of the data
var data = new google.visualization.DataTable();
//Declare columns
data.addColumn('date','Date');
data.addColumn('number','Actual Value for X');
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn('number','Actual Value for Y');
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn('number','Actual Value for Z');
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn({id:'interval', type:'number',role:'interval'});
data.addColumn('number','Theoretical Value for X and Y');
//data.addColumn('number','Theoretical Value for y');
data.addColumn('number','Theoretical Value for Z');
//Add data
<?php
if(isset($_POST['Send']))
{
//Get the different values
$Microscope = $table_list[$_POST['Microscope']];
$ObjMagn = $_POST['ObjMagn'];
$ObjNA = $_POST['NA'];
$AU = $_POST['AU'];
$Settings =$_POST['Settings'];
$DateBegin = $_POST['Date'];
$DateEnd = $_POST['DateEnd'];
//echo $DateBegin;
//If LSM, there's an added option
if(preg_match('/LSM/i',$Microscope))
{
//Secured query to avoid SQL injections
$query = "Select distinct Date from $Microscope where ObjMagn = ? and ROUND(ObjNA)=ROUND(?) and AU = ? AND Date BETWEEN ? AND ? ORDER BY Date ASC";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$AU,$DateBegin,$DateEnd));
//Get the different date corresponding to the values in the database
$Distinctdate = $stmt->fetchAll();
$NumberDistinctDate = count($Distinctdate);
}
//If it's the CellR of the AxioObserver
else
{
//Secured query, without the AU, to avoir SQL injections
$query = "Select distinct Date from $Microscope where ObjMagn = ? and ROUND(ObjNA)=ROUND(?) AND Date BETWEEN ? AND ? ORDER BY Date ASC";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$DateBegin,$DateEnd));
//Get the different date corresponding to the values in the database
$Distinctdate = $stmt->fetchAll();
$NumberDistinctDate = count($Distinctdate);
}
//Loop through the dates
for($i=0;$i<$NumberDistinctDate;$i++)
{
//If LSM then there is one value more to get in the database
if(preg_match('/LSM/i', $Microscope))
{
//Secured query to get the number of bead and get the maximum and minimum
/* $query = "Select distinct NumberBead from $Microscope where ObjMagn = ? and ROUND(ObjNA)=ROUND(?) and AU=?";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$AU));
$DistinctBead = $stmt->fetch();
$NumberDistinctBead = count($DistinctBead);*/
//Get the values
$query = "Select MIN(LAVx) AS ValueMinx, MIN(LAVy) AS ValueMiny, MIN(LAVz) AS ValueMinz, MAX(LAVX) AS ValueMaxx, MAX(LAVy) AS ValueMaxy, MAX(LAVz) AS ValueMaxz, TRUNCATE(AVG(LAVx),1) AS ValueMoyx,
TRUNCATE(AVG(LAVy),1) AS ValueMoyy, TRUNCATE(AVG(LAVz),1) AS ValueMoyz, LTVx AS ValueLTVx, LTVy AS ValueLTVy, LTVz AS ValueLTVz
from $Microscope where ObjMagn=? and ROUND(ObjNA)=ROUND(?) and Date = ? and AU=?";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$Distinctdate[$i]['Date'],$AU));
$Values2 = $stmt->fetch();
}
//If not LSM, then we don't care about the AU
else
{
//Secured query to get the number of bead and get the maximum and minimum
/* $query = "Select distinct NumberBead from $Microscope where ObjMagn = ? and ROUND(ObjNA)=ROUND(?) ";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA));
$DistinctBead = $stmt->fetch();
$NumberDistinctBead = count($DistinctBead);*/
//Get the values
$query = "Select MIN(LAVx) AS ValueMinx, MIN(LAVy) AS ValueMiny, MIN(LAVz) AS ValueMinz, MAX(LAVX) AS ValueMaxx, MAX(LAVy) AS ValueMaxy, MAX(LAVz) AS ValueMaxz, TRUNCATE(AVG(LAVx),1) AS ValueMoyx,
TRUNCATE(AVG(LAVy),1) AS ValueMoyy, TRUNCATE(AVG(LAVz),1) AS ValueMoyz, LTVx AS ValueLTVx, LTVy AS ValueLTVy, LTVz AS ValueLTVz
from $Microscope where ObjMagn=? and ROUND(ObjNA)=ROUND(?) and Date = ? ";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$Distinctdate[$i]['Date']));
$Values2 = $stmt->fetch();
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Date.DIRECTORY_SEPARATOR;
}
?>
//We add the values in the data table for each date
data.addRows([
[new Date("<?php echo $Distinctdate[$i]['Date']; ?>"),
<?php echo $Values2['ValueMoyx']; ?>,
<?php echo $Values2['ValueMinx']; ?>,
<?php echo $Values2['ValueMaxx']; ?>,
<?php echo $Values2['ValueMoyy']; ?>,
<?php echo $Values2['ValueMiny']; ?>,
<?php echo $Values2['ValueMaxy']; ?>,
<?php echo $Values2['ValueMoyz']; ?>,
<?php echo $Values2['ValueMinz']; ?>,
<?php echo $Values2['ValueMaxz']; ?>,
<?php echo $Values2['ValueLTVx']; ?>,
//<?php echo $Values2['ValueLTVy']; ?>,
<?php echo $Values2['ValueLTVz']; ?>
]
]);
<?php
}
}
?>
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
// create columns array
var columns = [0];
/* the series map is an array of data series
* "column" is the index of the data column to use for the series
* "roleColumns" is an array of column indices corresponding to columns with roles that are associated with this data series
* "display" is a boolean, set to true to make the series visible on the initial draw
*/
var seriesMap = [{
column: 1,
roleColumns: [2,3],
display: true
}, {
column: 4,
roleColumns: [5,6],
display: true
}, {
column: 7,
roleColumns: [8,9],
display: true
},
{
column: 10,
roleColumns: [],
display: true
},
{
column: 11,
roleColumns: [],
display: true
}/*,
{
column: 12,
roleColumns: [],
display: false
}*/];
var columnsMap = {};
var series = [];
var series = {};
for (var i = 0; i < seriesMap.length; i++) {
var col = seriesMap[i].column;
columnsMap[col]=i;
//Set the default series option
series[i] = {};
if (seriesMap[i].display) {
// if the column is the domain column or in the default list, display the series
columns.push(col);
}
else {
// otherwise, hide it
columns.push({
label: data.getColumnLabel(col),
type: data.getColumnType(col),
sourceColumn: col,
calc: function () {
return null;
}
});
/* if (i > 0) {
columns.push({
calc: 'stringify',
sourceColumn: i,
type: 'string',
role: 'annotation'
}); */
// set the default series option
if (typeof(series[i].color) !== 'undefined') {
series[i].backupColor = series[i].color;
}
series[i].color = '#CCCCCC';
}
for (var j = 0; j < seriesMap[i].roleColumns.length; j++) {
columns.push(seriesMap[i].roleColumns[j]);
}
}
var options = {
title : "<?php
echo 'Microscope : ';
echo $Microscope;
echo ' , ObjMagn : ';
echo $ObjMagn;
if(preg_match('/LSM/i', $Microscope))
{
echo ' , AU : ';
echo $AU;
}
echo ' , ObjNA : ';
echo $ObjNA;
?>",
width: '100%',
height: '100%',
series: series,
pointSize: 5
}
function showHideSeries () {
var sel = chart.getSelection();
// if selection length is 0, we deselected an element
if (sel.length > 0) {
// if row is undefined, we clicked on the legend
if (sel[0].row === null) {
var col = sel[0].column;
if (typeof(columns[col]) == 'number') {
var src = columns[col];
// hide the data series
columns[col] = {
label: data.getColumnLabel(src),
type: data.getColumnType(src),
sourceColumn: src,
calc: function () {
return null;
}
};
// grey out the legend entry
series[columnsMap[src]].color = '#CCCCCC';
}
else {
var src = columns[col].sourceColumn;
// show the data series
columns[col] = src;
series[columnsMap[src]].color = null;
}
var view = new google.visualization.DataView(data);
view.setColumns(columns);
chart.draw(view, options);
}
}
}
google.visualization.events.addListener(chart, 'select', showHideSeries);
// create a view with the default columns
var view = new google.visualization.DataView(data);
view.setColumns(columns);
chart.draw(view, options);
}
// Load the Visualization API and the piechart package.
<?php
if(isset($_POST['Send']))
{
?>
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
<?php
}
?>
</script>
<div id='chart_div' style='width:1000x; height:800px'></div>
<?php
//If a selection has been made, then we show the different dates and the settings
if(isset($_POST['Send']))
{
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Date.DIRECTORY_SEPARATOR;
//Loop through the date
for($i=0;$i<$NumberDistinctDate;$i++)
{
//If LSM
if(preg_match('/LSM/i', $Microscope))
{
$query = "Select * from $Microscope where ObjMagn=? and ROUND(ObjNA)=ROUND(?) and Date = ? and AU = ?;";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$Distinctdate[$i]['Date'],$AU));
$Values = $stmt->fetchAll();
}
//If not
else
{
$query = "Select * from $Microscope where ObjMagn=? and ROUND(ObjNA)=ROUND(?) and Date = ?;";
$stmt = $bdd->prepare($query);
$stmt->execute(array($ObjMagn,$ObjNA,$Distinctdate[$i]['Date']));
$Values = $stmt->fetchAll();
}
//If there are settings, we show the date and then the settings
if($Values[0]['Settings'] != "")
{
echo nl2br(" Date : '<b>".$Values[0]['Date']."</b>', User : <b>".$Values[0]['NameUser']."</b>\r\n");
echo nl2br("<pre><b>Settings: </b>".$Values[0]['Settings']."\n");
echo nl2br("<b>Comments: </b>".$Values[0]['Comment']."\n");
if(preg_match('/LSM/i', $Microscope))
{
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Values[0]['Date'].DIRECTORY_SEPARATOR.$AU.DIRECTORY_SEPARATOR;
//echo $folder;
if(file_exists($folder."Image.tif"))
{
?>
<a href="<?php $link = $folder.'Image.tif'; echo $link;?>" target="_blank" download="<?php echo $Microscope.$ObjMagn.$ObjNA.$Values[0]['Date'].$AU.'.tif';?>">Link to image</a>
<?php
}
echo "</pre>";
}
else
{
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Values[0]['Date'].DIRECTORY_SEPARATOR;
//echo $folder;
if(file_exists($folder."Image.tif"))
{
?>
<a href="<?php $link = $folder.'Image.tif'; echo $link;?>" target="_blank" download="<?php echo $Microscope.$ObjMagn.$ObjNA.$Values[0]['Date'].'.tif';?>">Link to image</a>
<?php
}
echo "</pre>";
}
}
//If no settings then we don't show it
else
{
echo nl2br(" Date : '<b>".$Values[0]['Date']."</b>', User : <b>".$Values[0]['NameUser']."</b>\r\n");
echo nl2br("<pre><i> No settings in the database</i>\n");
echo nl2br("<b>Comments: </b>".$Values[0]['Comment']."\n");
if(preg_match('/LSM/i', $Microscope))
{
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Values[0]['Date'].DIRECTORY_SEPARATOR.$AU.DIRECTORY_SEPARATOR;
//echo $folder;
//echo $folder."Image.tif";
//echo file_exists($folder."Image.tif");
if(file_exists($folder."Image.tif"))
{
?>
<a href="<?php $link = $folder.'Image.tif'; echo $link;?>" target="_blank" download="<?php echo $Microscope.$ObjMagn.$ObjNA.$Values[0]['Date'].$AU.'.tif';?>">Link to image</a>
<?php
}
echo "</pre>";
}
else
{
$folder='images'.DIRECTORY_SEPARATOR.$Microscope.DIRECTORY_SEPARATOR.$ObjMagn.DIRECTORY_SEPARATOR.$ObjNA.DIRECTORY_SEPARATOR.$Values[0]['Date'].DIRECTORY_SEPARATOR;
//echo $folder;
//echo $folder."Image.tif";
//echo file_exists($folder."Image.tif");
if(file_exists($folder."Image.tif"))
{
?>
<a href="<?php $link = $folder.'Image.tif'; echo $link;?>" target="_blank" download="<?php echo $Microscope.$ObjMagn.$ObjNA.$Values[0]['Date'].'.tif';?>">Link to image</a>
<?php
}
echo "</pre>";
}
}
}
}
?>
<footer>
<!-- Link to add new values to the database -->
<p><i> To add new values : <a href="add.php"> this way </a></i></p>
</footer>
</body>
</html>