-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch_expt.php
77 lines (71 loc) · 2.62 KB
/
search_expt.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
<?php
/**
* DEM dec2014: Show all Trials from the chosen Experiment (experiments from the chosen experiment_set).
*/
session_start();
require 'config.php';
require $config['root_dir'].'includes/bootstrap.inc';
require $config['root_dir'].'theme/normal_header.php';
$mysqli = connecti();
$exptuid = $_GET['expt'];
$exptname = mysql_grab("select experiment_set_name from experiment_set where experiment_set_uid = $exptuid");
echo "<h2>Trials from Experiment $exptname</h2><p>";
$sql="SELECT experiments.experiment_uid from csr_measurement, experiments
WHERE experiments.experiment_uid = csr_measurement.experiment_uid
AND experiment_set_uid='$exptuid'";
$result_trialcode=mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
while ($row_trialcode=mysqli_fetch_array($result_trialcode)) {
$uid = $row_trialcode['experiment_uid'];
$csr_list[$uid] = 1;
}
$sql="SELECT e.trial_code, e.experiment_year, e.traits, et.experiment_type_name, e.experiment_uid
FROM experiments as e, experiment_types as et
WHERE e.experiment_set_uid='$exptuid'
AND et.experiment_type_uid = e.experiment_type_uid";
if (!authenticate(array(USER_TYPE_PARTICIPANT,
USER_TYPE_CURATOR,
USER_TYPE_ADMINISTRATOR)))
$sql .= " AND data_public_flag > 0";
$sql .= " order by e.experiment_year desc,e.trial_code ASC";
$result_trialcode=mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
$num_rows = mysqli_num_rows($result_trialcode);
if ($num_rows ==0){
?>
<div class="section">
<p> There are no publicly available trials for this Experiment at this time.
Registered users may see additional data after signing in.
</div>
<?php
}
else {
?>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Year</th>
<th>Trial Name</th>
<th>Traits</th>
</tr>
<?php
while($row_trialcode=mysqli_fetch_array($result_trialcode))
{
$uid=$row_trialcode['experiment_uid'];
$trial_code=$row_trialcode['trial_code'];
$year=$row_trialcode['experiment_year'];
$traits=$row_trialcode['traits'];
$filename="data/".$trial_code.".xls";
$experiment_type = $row_trialcode['experiment_type_name'];
if (isset($csr_list[$uid])) {
$traits = "CSR Data<br>$traits";
}
if ($experiment_type=='phenotype') {
echo( "<tr> <td>$year</td> <td><a href='display_phenotype.php?trial_code=$trial_code'>$trial_code</a> </td> <td>$traits</td> </tr>");
} elseif ($experiment_type=='genotype') {
echo( "<tr> <td>$year</td> <td><a href='display_genotype.php?trial_code=$trial_code'>$trial_code</a> </td> <td>$traits</td> </tr>");
}
}
}
echo "</table>";
$footer_div = 1;
require $config['root_dir'].'theme/footer.php'; ?>
</body>
</html>