-
Notifications
You must be signed in to change notification settings - Fork 0
/
_information.php
144 lines (118 loc) · 4.96 KB
/
_information.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
<?php
/**
* @_information.php
* @brief module that display the additional information for an experiment.
* *
* This module is for use in the expt page. It needs information contained in the data-description file.
* It also uses information that is in the $arrInfofiles which is infofiles.json - that file is at the moment created by db2json23 using the infofiles.csv
* @author Nathalie Castells
* @date 9/27/2018
*/
GLOBAL $arrInfofiles;
GLOBAL $displayValue;
GLOBAL $arrFilteredfiles;
/*These selection criteria is different on the live site as we add
'isReviewed'=> '1',
*/
//obtain a list of columns
$caption = array_column($arrFilteredfiles, 'Caption');
$order= array_column($arrFilteredfiles, 'order');
// Sort the data with orientation descending, caption ascending
// Add $images as the last parameter, to sort by the common key
array_multisort($order, SORT_DESC, $caption, SORT_ASC, $arrFilteredfiles);
$strTab = "<div class=\"row\">";
$strTab .= "\n\t <div class=\"col-12\">";
//$strTab .= "\n\t \t <h2 class=\"mx-3\">Additional Information</h2>";
$strTab .= "\n\t </div>";
$strTab .= "\n \t <div class=\"col-12 mx-auto\"> ";
$strTab .= "\n \t\t <div class=\"mt-3 mx-3\" id=\"accordionDesign\"> \n";
$i = 0;
$tabID = 0;
/*"2": {
"id": "2",
"Credit": "eRA curators",
"FileName": "measurements",
"Type": "html",
"Caption": "bms measurements",
"exptID": "bms",
"link": "http://local-info.rothamsted.ac.uk/eRA/era2018-new/info/bms/measurements",
"isReviewed": "1",
"Comments": ""
},
*/
foreach ($arrFilteredfiles as $file) {
$tabID = $tabID +1;
$needsReview = '';
if ($file['isReviewed'] == '0') {
$needsReview = $checkThisOne;
}
$Title = $file['Caption'];
$Description = $file['Description'];
$isReviewed = $file['isReviewed'];
$contentFile = 'metadata/'.$file['exptID'].'/'.$file['FileName'].'.'.$file['Type'];
if ($i != 0) {
$active = "";
$collapse = " show ";
$expanded = "true";
} else {
$active = " in";
$collapse = " ";
$expanded = "false";
}
//$tabID = str_replace(' ', '', $Title);
//$tabID = str_replace(':', '', $tabID);
//$tabID = str_replace('-', '', $tabID);
$ref = "";
$ref .= $file['KeyRefs'];
$papers = "NONE";
if ($ref != "") {
$papers = GetKeyRefs($ref);
}
//Here we want to check that the file is fully reviewed and the content is here before we write the list
$strTab .= "\n\t<div class=\"card bg-light\">";
$strTab .= "\n\t\t<div class=\"card-header \" id=\"heading" . $tabID . "\">";
$strTab .= "\n\t\t<h2 class=\"mb-0\">";
$strTab .= "\n\t\t\t<button class=\"btn btn-link\" data-toggle=\"collapse\" data-target=\"#collapse" . $tabID . "\" aria-expanded=\"" . $expanded . "\" aria-controls=\"" . $tabID . "\">";
$strTab .= "\n\t\t\t\t " . $Title. $needsReview;
$strTab .= "\n\t\t\t </button>";
$strTab .= "\n\t\t\t </h2>";
$strTab .= "\n\t\t\t<p><i>".$Description."</i></p> ";
$strTab .= "\n\t</div>";
$strTab .= "\n\t<div id=\"collapse" . $tabID . "\" class=\"collapse " . $collapse . " fade bg-light\" aria-labelledby=\"heading" . $tabID . "\" data-parent=\"#accordionDesign\">";
$strTab .= "\n\t<div class=\"card-body\">" ;
$hascontentFile = file_exists($contentFile);
if ($hascontentFile) {
$content = file_get_contents($contentFile);
//$content = " - GOTIT ";
} else {$content = " - NOT ";}
if ($displayValue == 0) {
$strTab .= "<div class=\"d-flex justify-content-between bg-warning text-white p-3 \"> <h2>To edit this page go to <u>//basset/../era2023/". $contentFile. "</u></h2> <p> When all editing use update-all.bat</div>";
}
$strTab .= "<a href=\"info/".$file['exptID']."/".$file['FileName']."\" target=\"_BLANK\"><b>Open in other tab</b></a>";
//$strTab .= $contentFile;
$strTab .= $content ;
if (substr($papers, 0, 4) != "NONE") {
$strTab .= "<h3>Key References</h3> \n\t\t
<div class=\"mx-3\">".$papers."\n\t</div>";
}
$strTab .= "<button class=\"btn btn-link fa-solid fa-xmark\" data-toggle=\"collapse\" data-target=\"#collapse" . $tabID . "\" aria-expanded=\"" . $expanded . "\" aria-controls=\"" . $tabID . "\">";
$strTab .= "\n\t\t\t\t <b>Close Page</b>";
$strTab .= "\n\t\t\t </button>";
$strTab .= "</div>";
$strTab .= "\n\t</div>";
$strTab .= "\n\t</div>";
}
$strTab .= "\n\t\t</div>";
$strTab .= "\n\t</div>";
$strTab .= "\n</div>";
echo $strTab;
/* TODO: include the reference of the file. The keyref needs to be in the infofile. I can get that from the doclist
if (isset($ref)) {
$papers = GetKeyRefs($ref);
if (substr($papers, 0, 4) != "NONE") {
echo "<h2>Key References</h2> \n\t\t
<div class=\"mx-3\">".$papers."\n\t</div>";
}
}
*/
?>