make_interface_tableau_series_supervisor()   F
last analyzed

Complexity

Conditions 28
Paths > 20000

Size

Total Lines 192
Code Lines 161

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 28
eloc 161
c 2
b 0
f 0
nc 708588
nop 1
dl 0
loc 192
rs 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 Copyright (C) 2018-2020 KANOUN Salim
4
 This program is free software; you can redistribute it and/or modify
5
 it under the terms of the Affero GNU General Public v.3 License as published by
6
 the Free Software Foundation;
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
 Affero GNU General Public Public for more details.
11
 You should have received a copy of the Affero GNU General Public Public along
12
 with this program; if not, write to the Free Software Foundation, Inc.,
13
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14
 */
15
?>
16
17
<script>
18
$(document).ready(function(){
19
20
	//Display the contoller form
21
	<?php if ($visitObject->stateQualityControl != Visit::QC_NOT_DONE) {?>
22
    	$("#quality_control_form").load('/controller_form', {
23
    		id_visit :<?=$id_visit?>,
24
    		type_visit : '<?=$visit_type?>',
25
    		patient_num : <?=$patientNumber?>
26
    	});
27
   	<?php
28
	}
29
    
30
	//If a corrective action has been made and QC not concluded, display the corrective action form
31
	if ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED 
32
		 && $visitObject->correctiveActionDate != null) {
33
	?>
34
		$("#corrective_action_form").load('/corrective_action', {
35
			id_visit :<?=$id_visit?>,
36
			type_visit : '<?=$visit_type?>',
37
			patient_num : <?=$patientNumber?>
38
		});
39
	<?php 
40
	}
41
	
42
	if ($visitObject->stateInvestigatorForm != Visit::LOCAL_FORM_NOT_DONE) {
43
	?>
44
		//Display the local investigator specific form
45
		$("#investigatorForm").load('/specific_form', {
46
			id_visit :<?=$id_visit?>,
47
			type_visit : '<?=$visit_type?>',
48
			patient_num : <?=$patientNumber?>,
49
			getLocal : true
50
		})
51
	<?php 
52
	}?>
53
	//Show / hide div on element click in visit table
54
	$(".visitDetails").on('click', function() {
55
		$('.visitInfoDiv').hide();
56
		var title=$(this).attr('title');
57
		$('#'+title).show();
58
		$.fn.dataTable
59
	    .tables( { visible: true, api: true } )
60
	    .columns.adjust();
61
		
62
	})
63
64
	$(".visitDetails").css('text-decoration', 'underline');
65
66
	$('.visitHistory').DataTable( {
67
		"sDom": 'lrtip',
68
		"bSortCellsTop": true,
69
		"scrollX": true
70
	});
71
72
});
73
</script>
74
75
<div class="text-center">
76
	<h1>Patient <?=$patientNumber?> - <?=htmlspecialchars($visit_type)?></h1>
77
</div>
78
79
<div id="change_patient_status"> </div>
80
81
<div> 
82
	<?=make_interface_tableau_visites_supervisor($visitObject)?>
83
</div>
84
85
<div id="visit" class="visitInfoDiv" style="display:none">
86
	<table class="table table-striped">
87
		<tr>
88
			<th>Created by</th>
89
			<td><?=htmlspecialchars($visitObject->creatorName)?></td>
90
		</tr>
91
		<tr>
92
			<th>Creation date</th>
93
			<td><?=$visitObject->creationDate?></td>
94
		</tr>
95
		<tr>
96
			<th>If Not done, Reason</th>
97
			<td><?=htmlspecialchars($visitObject->reasonForNotDone)?></td>
98
		</tr>
99
	</table>
100
	<a href=scripts/delete_visit.php?id_visit=<?=$id_visit?>  class="ajaxLinkConfirm refreshVisitSupervisor"><input class='btn btn-danger' type="button" value='Delete Visit'></a><br>
101
	<?php makeHistoryTable("Visit", $trackerVisitResponses); ?>
102
</div>
103
104
<div id="serie" class="visitInfoDiv" style="display:none" >
105
	<table class="table table-striped ">
106
		<tr>
107
			<th>Uploaded by</th>
108
			<td><?=htmlspecialchars($visitObject->uploaderUsername)?></td>
109
		</tr>
110
		<tr>
111
			<th>Upload date</th>
112
			<td><?=$visitObject->uploadDate?></td>
113
		</tr>
114
	</table>
115
	<?php
116
	echo(make_study_table($visitObject));
0 ignored issues
show
Bug introduced by
Are you sure the usage of make_study_table($visitObject) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
117
	makeHistoryTable("Serie", $trackerVisitResponses);
118
	?>
119
</div>
120
121
<div id="quality" class="visitInfoDiv" style="display:none">
122
	<div>
123
		<table class="table table-striped">
124
			<tr>
125
				<th>Quality Controle Done by</th>
126
				<td><?=htmlspecialchars($visitObject->controllerUsername)?></td>
127
			</tr>
128
			<tr>
129
				<th>date</th>
130
				<td><?=$visitObject->controlDate?></td>
131
			</tr>
132
		</table>
133
		
134
		<div id="quality_control_form" ></div>
135
		<?php 
136
		if ($visitObject->reviewStatus == Visit::NOT_DONE) {
137
			?>
138
		    <a href=scripts/reset_qc.php?id_visit=<?=$id_visit?> class="ajaxLinkConfirm refreshVisitSupervisor" ><input class='btn btn-danger' type="button" value='Reset QC'></a>
139
       		<?php
140
		}?>
141
		
142
   	</div>
143
   	<br>
144
	<?php 
145
	//If QC not finalized and existe corrective action data, display the user's corrective action data
146
	if ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED && $visitObject->correctiveActionDate != null) {
147
	?>
148
		<table class="table table-striped">
149
			<tr>
150
				<th>Corrective Action Done by</th>
151
				<td><?=$visitObject->correctiveActionUsername?></td>
152
			</tr>
153
			<tr>
154
				<th>date</th>
155
				<td><?=$visitObject->correctiveActionDate?></td>
156
			</tr>
157
		</table>
158
	<?php 
159
	}
160
	?>
161
	<div id="corrective_action_form"></div>
162
	
163
	<?php makeHistoryTable("Qc", $trackerVisitResponses); ?>
164
</div>
165
166
<div id="form" class="visitInfoDiv" style="display:none">
167
168
	<table class='table table-striped'>
169
    	<tr>
170
    		<th>Filled in by</th>
171
    		<td><?php if (!empty($localReviewObject)) echo(htmlspecialchars($localReviewObject->username)); ?></td>
172
    	</tr>
173
    	<tr>
174
    		<th>Date</th>
175
    		<td><?php if (!empty($localReviewObject)) echo($localReviewObject->reviewDate); ?></td>
176
    	</tr>
177
    </table>
178
   
179
    <?php 
180
	if (!empty($localReviewObject) && $visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED) {
181
		?>
182
         <a href=scripts/unlock_form.php?id_review=<?=$localReviewObject->id_review.'&id_visit='.$id_visit?> class="ajaxLinkConfirm refreshVisitSupervisor" ><input class='btn btn-danger' type="button" value='Unlock Form'></a>
183
		 <a href=scripts/delete_form.php?id_review=<?=$localReviewObject->id_review.'&id_visit='.$id_visit?> class="ajaxLinkConfirm refreshVisitSupervisor" ><input class='btn btn-danger' type=button value='Delete Form'></a>
184
        <?php 
185
	}?>
186
   <br>
187
   <div id="investigatorForm"></div>
188
   <?php makeHistoryTable("Form", $trackerVisitResponses, true); ?>
189
</div>
190
191
192
<div id="review_div" class="visitInfoDiv" style="display:none;">
193
194
	<table class='table table-striped'>
195
    	<tr>
196
    		<th>Conclusion Date</th>
197
    		<td><?php if (!empty($visitObject->reviewConclusionDate)) echo($visitObject->reviewConclusionDate); else echo("N/A") ?></td>
198
    	</tr>
199
    	<tr>
200
    		<th>Conclusion Value</th>
201
    		<td><?php if (!empty($visitObject->reviewConclusion)) echo(htmlspecialchars($visitObject->reviewConclusion)); else echo("N/A") ?></td>
202
    	</tr>
203
    </table>
204
    
205
	<?php make_interface_tableau_review_supervisor($data_reviews)?>
206
	<?php makeHistoryTable("Form", $trackerVisitResponses, false); ?>
207
</div>
208
209
<?php
210
function makeHistoryTable($actionGroup, $trackerVisitResponses, bool $formInvestigator=null) {
211
    
212
	if ($actionGroup == "Visit") {
213
		$actionArray=array("Create Visit", "Delete Visit", "Reactivate Visit");
214
	}else if ($actionGroup == "Form") {
215
		$actionArray=array("Save Form", "Unlock Form", "Delete Form");
216
	}else if ($actionGroup == "Qc") {
217
		$actionArray=array("Reset QC", "Quality Control", "Corrective Action");
218
	}else if ($actionGroup == "Serie") {
219
		$actionArray=array("Import Series", "Change Serie");
220
	}
221
	?>
222
    <div class="mt-4" style="overflow-x:auto;" >
223
    	<h3>History</h3>
224
        <table class="table table-striped visitHistory block" style="width: 100%;">
225
            <thead>
226
            	<tr>
227
        			<td>Date</td>
228
            		<td>Username</td>
229
            		<td>Role</td>
230
            		<td>Action Type</td>
231
            		<td>Details</td>
232
            	</tr>
233
        	</thead>
234
        	<tbody>
235
            	<?php 
236
				foreach ($trackerVisitResponses as $response) {
237
            	    
238
					if (in_array($response['action_type'], $actionArray)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $actionArray does not seem to be defined for all execution paths leading up to this point.
Loading history...
239
            	        
240
						$details=json_decode($response['action_details'], true);
241
            	        
242
						if ($actionGroup == "Form") { 
243
							if ($formInvestigator && $details['local_review'] == "0") continue(1);
244
							if (!$formInvestigator && $details['local_review'] == "1") continue(1);  
0 ignored issues
show
Bug Best Practice introduced by
The expression $formInvestigator of type boolean|null is loosely compared to false; this is ambiguous if the boolean can be false. You might want to explicitly use !== null instead.

If an expression can have both false, and null as possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.

$a = canBeFalseAndNull();

// Instead of
if ( ! $a) { }

// Better use one of the explicit versions:
if ($a !== null) { }
if ($a !== false) { }
if ($a !== null && $a !== false) { }
Loading history...
245
						}
246
            	        
247
					?>
248
                	    <tr>
249
            				<td><?=$response['date']?></td>
250
                	    	<td><?=htmlspecialchars($response['username'])?></td>
251
                	    	<td><?=$response['role']?></td>
252
            				<td><?=$response['action_type']?></td>
253
                	    	<td><?='<pre><code>'.json_encode($details, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>'?></td>
254
                	    </tr>
255
            	    <?php 
256
					}
257
				}
258
				?>
259
    		</tbody>
260
        </table>
261
    </div>
262
<?php 
263
}
264
265
function make_study_table($visitObject) {
266
    
267
	$dicomStudies=$visitObject->getStudyDicomDetails();
268
    
269
	if (empty($dicomStudies)) {
270
		//If no available studies, show all deleted studies in the DB
271
		make_interface_tableau_study_supervisor($visitObject);
272
	}else {
273
		make_interface_tableau_series_supervisor($visitObject);
274
	}
275
    
276
}
277
278
/**
279
 * Display all deleted DICOM studies
280
 * @param Visit $visitObject
281
 */
282
function make_interface_tableau_study_supervisor(Visit $visitObject) {
283
	$data_studies=$visitObject->getStudyDicomDetails(true);
284
285
	$studies_number=count($data_studies);
286
    
287
	//if no deleted studies do not display table at all
288
	if ($studies_number == 0) {
289
		return;
290
	}
291
    
292
	?>
293
        <div style="overflow-x:auto;"> 
294
        	<h2> Deleted Dicom Studies</h2>
295
        	<table id="tab_series_super" class="table table-striped block">
296
    			<tr>
297
    				<th colspan=<?=($studies_number+1)?>>Studies information</th>
298
    			</tr>
299
    			<tr>
300
    				<td>Uploader</td>
301
    				<?php 
302
					for ($i=0; $i < $studies_number; $i++) {
303
					?>
304
    				    <td><?=htmlspecialchars($data_studies [$i]->uploaderUsername)?></td>
305
    				<?php 
306
					}
307
					?>
308
    			</tr>
309
				<tr>
310
    				<td>Upload Date</td>
311
    				<?php 
312
					for ($i=0; $i < $studies_number; $i++) {
313
					?>
314
    				    <td><?=$data_studies [$i]->uploadDate?></td>
315
				    <?php
316
					}
317
					?>
318
    			</tr>
319
    			<tr>
320
    				<td>Study Description</td>
321
    				<?php 
322
					for ($i=0; $i < $studies_number; $i++) {
323
						if (empty ($data_studies[$i]->studyDescription)) { ?>
324
                        	<td>/</td>
325
                    	<?php
326
						}else { ?>
327
                            <td><?=htmlspecialchars($data_studies[$i]->studyDescription)?></td>
328
                		<?php 
329
						}
330
					}
331
					?>
332
    			</tr>
333
    			<tr>
334
    				<td>Acquisition Date Time</td>
335
    				<?php 
336
					for ($i=0; $i < $studies_number; $i++) {
337
						if (empty ($data_studies[$i]->studyAcquisitionDateTime)) { ?>
338
                        	<td>/</td>
339
                    	<?php
340
						}else { ?>
341
                            <td><?=htmlspecialchars($data_studies[$i]->studyAcquisitionDateTime)?></td>
342
                		<?php 
343
						}
344
					}
345
					?>
346
    			</tr>
347
    			<tr>
348
    				<td>Nb Series / Nb Instances</td>
349
    				<?php 
350
					for ($i=0; $i < $studies_number; $i++) {
351
						?>
352
                            <td><?=$data_studies [$i]->nbOfSeries?> / <?=$data_studies [$i]->numberOfInstances?></td>
353
                            <?php 
354
					}
355
					?>
356
    			</tr>
357
    			
358
            <?php 
359
			if ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED) {
360
			?>
361
                <tr>
362
                	<td></td>
363
            	<?php 
364
				   for ($i=0; $i < $studies_number; $i++) {
365
						?>
366
                        <td>
367
                        	<a href='scripts/reactivate_study.php?Study_Orthanc_Id=<?=$data_studies[$i]->studyOrthancId?>&id_visit=<?=$visitObject->id_visit?>' class="ajaxLinkConfirm refreshVisitSupervisor"><input class="btn btn-danger" type="button" value="Reactivate Study"></a>
368
                        </td>
369
                    <?php 
370
					}
371
				}
372
				?>
373
            	</tr>
374
    		</table>
375
    	</div>
376
<?php
377
}
378
379
/**
380
 * Generate table series of the activated study Dicom
381
 * @param Visit $visitObject
382
 */
383
function make_interface_tableau_series_supervisor(Visit $visitObject) {
384
    
385
	$data_series=$visitObject->getSeriesDetails(false);
386
	$deleted_series=$visitObject->getSeriesDetails(true);
387
	//Add deleted series at the end of array
388
	foreach ($deleted_series as $deleted_serie) {
389
		$data_series[]=$deleted_serie;
390
	}
391
	$series_number=count($data_series);
392
	?>
393
        <div style="overflow-x:auto;"> 
394
        	<table id="tab_series_super" class="table table-striped block">
395
    			<tr>
396
    				<th colspan=<?=($series_number+1)?>>Series information</th>
397
    			</tr>
398
    			<tr>
399
    				<td></td>
400
                	<?php 
401
					for ($i=0; $i < $series_number; $i++) {
402
						if (empty ($data_series[$i]->seriesNumber)) { ?>
403
                        	<td>/</td>
404
                    	<?php
405
						}else { ?>
406
                            <td>Serie <?=htmlspecialchars($data_series [$i]->seriesNumber)?></td>
407
                		<?php 
408
						}
409
					}
410
					?>
411
    			</tr>
412
    			<tr>
413
    				<td>Series Description</td>
414
    				<?php 
415
					for ($i=0; $i < $series_number; $i++) {
416
						if (empty ($data_series[$i]->seriesDescription)) { ?>
417
                        	<td>/</td>
418
                    	<?php
419
						}else { ?>
420
                            <td><?=htmlspecialchars($data_series [$i]->seriesDescription)?></td>
421
                		<?php 
422
						}
423
					}
424
					?>
425
    			</tr>
426
    			<tr>
427
    				<td>Manufacturer</td>
428
    				<?php 
429
					for ($i=0; $i < $series_number; $i++) {
430
						if (empty ($data_series[$i]->manufacturer)) { ?>
431
                        	<td>/</td>
432
                    	<?php
433
						}else { ?>
434
                            <td><?=htmlspecialchars($data_series [$i]->manufacturer)?></td>
435
                		<?php 
436
						}
437
					}
438
					?>
439
    			</tr>
440
    			<tr>
441
    				<td>Modality</td>
442
    				<?php 
443
					for ($i=0; $i < $series_number; $i++) {
444
						if (empty ($data_series[$i]->modality)) { ?>
445
                        	<td>/</td>
446
                    	<?php
447
						}else { ?>
448
                            <td><?=htmlspecialchars($data_series [$i]->modality)?></td>
449
                		<?php 
450
						}
451
					}
452
					?>
453
    			</tr>
454
    			<tr>
455
    				<td>Acquisition Date Time</td>
456
    				<?php 
457
					for ($i=0; $i < $series_number; $i++) {
458
						if (empty ($data_series[$i]->acquisitionDateTime)) { ?>
459
                        	<td>/</td>
460
                    	<?php
461
						}else { ?>
462
                            <td><?=htmlspecialchars($data_series [$i]->acquisitionDateTime)?></td>
463
                		<?php 
464
						}
465
					}
466
					?>
467
    			</tr>
468
    			<tr>
469
    				<td>Injected Dose (MBq)</td>
470
    				<?php 
471
					for ($i=0; $i < $series_number; $i++) {
472
						if (empty ($data_series[$i]->injectedDose)) { ?>
473
                        	<td>/</td>
474
                    	<?php
475
						}else { ?>
476
                            <td><?=htmlspecialchars(($data_series [$i]->injectedDose/10**6)) ?></td>
477
                		<?php 
478
						}
479
					}
480
					?>
481
    			</tr>
482
    			<tr>
483
    				<td>Injection Date Time</td>
484
    				<?php 
485
					for ($i=0; $i < $series_number; $i++) {
486
						if (empty ($data_series[$i]->injectedDateTime)) { ?>
487
                        	<td>/</td>
488
                    	<?php
489
						}else { ?>
490
                            <td><?=htmlspecialchars($data_series [$i]->injectedDateTime) ?></td>
491
                		<?php 
492
						}
493
					}
494
					?>
495
        		</tr>
496
    			<tr>
497
    				<td>Radiopharm. Specific Activity (MBq)</td>
498
    				<?php 
499
					for ($i=0; $i < $series_number; $i++) {
500
						if (empty ($data_series[$i]->injectedActivity)) { ?>
501
                        	<td>/</td>
502
                    	<?php
503
						}else { ?>
504
                            <td><?=htmlspecialchars(($data_series [$i]->injectedActivity/10**6)) ?></td>
505
                		<?php 
506
						}
507
					}
508
					?>
509
    			</tr>
510
    			<tr>
511
    				<td>Patient's weight (kg)</td>
512
    				<?php 
513
					for ($i=0; $i < $series_number; $i++) {
514
						if (empty ($data_series[$i]->patientWeight)) { ?>
515
                        	<td>/</td>
516
                    	<?php
517
						}else { ?>
518
                            <td><?=htmlspecialchars($data_series [$i]->patientWeight)?></td>
519
                		<?php 
520
						}
521
					}
522
					?>
523
    			</tr>
524
    			<tr>
525
    				<td>Slice count</td>
526
    				<?php 
527
					for ($i=0; $i < $series_number; $i++) {
528
						if (empty ($data_series[$i]->numberInstances)) { ?>
529
                        	<td>/</td>
530
                    	<?php
531
						}else { ?>
532
                            <td><?=$data_series [$i]->numberInstances?></td>
533
                		<?php 
534
						}
535
					}
536
					?>
537
    			</tr>
538
    			<tr>
539
    				<td>Insert Date</td>
540
    				<?php 
541
					for ($i=0; $i < $series_number; $i++) {
542
						if (empty ($data_series[$i]->uploadDate)) { ?>
543
                        	<td>/</td>
544
                    	<?php
545
						}else { ?>
546
                            <td><?=$data_series [$i]->uploadDate?></td>
547
                		<?php 
548
						}
549
					}
550
					?>
551
                </tr>
552
            <?php 
553
			if ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED) {
554
			?>
555
                <tr>
556
                	<td></td>
557
            	<?php 
558
					for ($i=0; $i < $series_number; $i++) {
559
						$deleted=false;
560
						$action="delete";
561
						if ($data_series[$i]->deleted) {
562
							$deleted=true;
0 ignored issues
show
Unused Code introduced by
The assignment to $deleted is dead and can be removed.
Loading history...
563
							$action="reactivate";
564
						}
565
                            
566
						?>
567
                        <td>
568
                        	<a href='scripts/change_series_deletion.php?action=<?=$action?>&Series_Orthanc_Id=<?=$data_series[$i]->seriesOrthancID?>&id_visit=<?=$visitObject->id_visit?>' class="ajaxLinkConfirm refreshVisitSupervisor"><input class="btn btn-danger" type="button" value="<?=$action?> Series"></a>
569
                        </td>
570
                    <?php 
571
					}
572
				}
573
				?>
574
            	</tr>
575
    		</table>
576
    	</div>
577
<?php 
578
}
579
580
581
/**
582
 * Generate table with selected visit details for supervisor interface
583
 * @param $id_visit
584
 * @return string
585
 */
586
function make_interface_tableau_visites_supervisor($visitObject) {
587
?>
588
    <div style="overflow-x:auto;">
589
    	<table id='tab_visit_super' class='table table-striped block'>
590
			<tr>
591
    			<th colspan=7>Visit information</th>
592
			</tr>
593
			<tr>
594
    			<td rowspan=2>Visit</td>
595
    			<td colspan=4>Visit status</td>
596
    			<td rowspan=2>Review Status</td>
597
			</tr>
598
			<tr>
599
    			<td>Visit</td>
600
    			<td>Series upload</td>
601
    			<td>Investigator form</td>
602
    			<td>Quality control</td>
603
			</tr>
604
    
605
    		<tr>
606
    			<td><?=$visitObject->visitType?></td>
607
    			<td class="visitDetails" title="visit" ><?=$visitObject->statusDone?></td>
608
    			<td class="visitDetails" title="serie" ><?=$visitObject->uploadStatus?></td>
609
    			<td class="visitDetails" title="form" ><?=$visitObject->stateInvestigatorForm?></td>
610
    			<td class="visitDetails" title="quality" ><?=$visitObject->stateQualityControl?></td>
611
    			<td class="visitDetails" title="review_div" ><?=$visitObject->reviewStatus?></td>
612
			</tr>
613
		</table>
614
	</div>
615
<?php 
616
}
617
618
619
function make_interface_tableau_review_supervisor($data_reviews) {
620
    
621
	$res_nb_reviews=count($data_reviews);
622
    
623
	if ($res_nb_reviews == 0) {
624
		return;
625
	}
626
	?>
627
    <div style="overflow-x:auto;">
628
    	<table class="table table-striped block">
629
    		<tr>
630
    			<th></th>
631
    			<?php 
632
				for ($i=1; $i <= $res_nb_reviews; $i++) {
633
				?>
634
                    <th>Review <?=$i?></th>
635
                <?php 
636
				}
637
				?>
638
            </tr>
639
        	<tr>
640
        		<td>Name</td>
641
            		<?php 
642
					for ($i=0; $i < $res_nb_reviews; $i++) {
643
					?>
644
                        <td><?=$data_reviews[$i]->username?>
645
                        <?php  if ($data_reviews[$i]->isLocal) echo('- Local Investigator');
646
							   if ($data_reviews[$i]->isAdjudication) echo('- Adjudication Form');
647
						?>
648
        				</td>
649
                    <?php 
650
					}
651
				?>
652
            </tr>
653
            <tr>
654
                <td>Reading Date</td>
655
                <?php
656
				for ($i=0; $i < $res_nb_reviews; $i++) {
657
					?>
658
                    <td><?=$data_reviews[$i]->reviewDate ?>
659
        			</td>
660
                <?php 
661
				}
662
				?>
663
            </tr>
664
    		<tr>
665
        		<td>Reading Form</td>
666
        		<?php 
667
				for ($i=0; $i < $res_nb_reviews; $i++) {
668
					$dataSpecific=$data_reviews[$i]->getSpecificData();
669
					?>
670
                    <td style="text-align:unset;">
671
                    	<pre><code><?=json_encode($dataSpecific, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS)?></code></pre>
672
                	</td>
673
            	<?php 
674
				}
675
				?>
676
        	</tr>
677
    		<tr>
678
            	<td>Status</td>
679
            	<?php 
680
				for ($i=0; $i < $res_nb_reviews; $i++) {
681
				?>
682
                    <td>
683
                    	<?php 
684
						   if ($data_reviews[$i]->validated) echo('Validated'); else echo('Draft');
685
						?>
686
                	</td>
687
            	<?php 
688
				}
689
				?>
690
            </tr>
691
    		<tr>
692
    			<td>Action</td>
693
    			<?php 
694
				for ($i=0; $i < $res_nb_reviews; $i++) {
695
					if ($data_reviews[$i]->isLocal == 0) {
696
						//If validated show both unlock and delete button
697
						if ($data_reviews[$i]->validated) {
698
							?>
699
                            <td>
700
            		        	<a href="scripts/unlock_form.php?id_review=<?=$data_reviews[$i]->id_review?>&id_visit=<?=$data_reviews[$i]->id_visit?>" class="ajaxLinkConfirm refreshVisitSupervisor"><input class="btn btn-danger" type="button" value="Unlock Form"> </a>
701
            		        	<a href="scripts/delete_form.php?id_review=<?=$data_reviews[$i]->id_review?>&id_visit=<?=$data_reviews[$i]->id_visit?>" class="ajaxLinkConfirm refreshVisitSupervisor"><input class="btn btn-danger" type="button" value="Delete Form"> </a>
702
            		        </td>
703
            		        <?php
704
						//if not validated (not locked) show only delete button
705
						}else {
706
							?>
707
                            <td>
708
            		        	<a href="scripts/delete_form.php?id_review=<?=$data_reviews[$i]->id_review?>&id_visit=<?=$data_reviews[$i]->id_visit?>" class="ajaxLinkConfirm refreshVisitSupervisor"><input class="btn btn-danger" type="button" value="Delete Form"> </a>
709
            		        </td>
710
        		        <?php 
711
						}
712
                
713
					}else {
714
					?>
715
        				<td></td>
716
        			<?php 
717
					}
718
            
719
				}
720
				?>
721
        </tr>
722
    	</table>
723
	</div>
724
<?php 
725
}
726
?>