-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.php
199 lines (164 loc) · 5.14 KB
/
info.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
<?php
/**
* @file info.php
*
* @brief A topic page.
*
* This will include a page for any information, without tab stuff at the top.
* the included files are either html, php or txt... there will be a field that says that in the infofiles.json
* @author Nathalie Castells.
*
* @version 1.00
*
*
* @version 0.2 added space for the page dependant scripts. at the bottom.
*
*
*/
// /This will be used to pass the FileName : it will just include the file as is.
$FileName = 'index';
if (isset($_POST['FileName'])) {
$FileName = $_POST['FileName'];
}
/*
* this is to pass filename as page.extension where extension is in the phpfile.json
*
* At the moment, we use FileName
*/
include_once 'includes/init.php'; // these are the settings that refer to more than one page
$page = 'index';
if (isset($_POST['page'])) {
$page = $_POST['page'];
} else {
$page = 'index';
}
$expt = 'default';
// /This will be used to pass the experiment code, or type of page.
if (isset($_POST['expt'])) {
$expt = $_POST['expt'];
}
if (isset($_GET['expt'])) {
$expt = $_GET['expt'];
}
/**
* $page info should have the following structure:
* array(4) {
* ["ExperimentName"]=> string(9) "Broadbalk"
* ["ExptCode"]=> string(4) "rbk1"
* ["KeyRef"]=> string(15) "KeyRefBroadbalk"
*
* ["URLCode"]=> string(9) "Broadbalk" }
*
* @var array $pageinfo
*/
/**
* We need the caption of the file.
*
* @var String $page_title
*/
$url = 'metadata/default/infofiles.json';
if (is_file($url)) {
$jdata = file_get_contents($url);
$data = json_decode($jdata, true);
$pairs = array(
'FileName' => $FileName,
'exptID' => $expt
);
$page = multiSearch($data, $pairs);
$h1Title = $page[0]['Caption'];
$page_title .= ': ' . $page[0]['Caption'];
$pageType = $page[0]['pageType'];
$ext = $page[0]['Type'];
$ref = $page[0]['KeyRefs'];
$papers = "NONE";
if ($ref != "") {
$papers = GetKeyRefs($ref);
}
// $KeyRef = $page[0]['KeyRef'];
} else {
$h1Title = $pageinfo['ExperimentName'];
$page_title .= ': ' . $pageinfo['ExperimentName'];
}
$fileDataset = 'metadata/default/datasets.json';
/*
$hasDatasets = file_exists($fileDataset);
$displayDatasets = 0;
if ($hasDatasets) {
$jdatasets = file_get_contents($fileDataset);
$jdatasets = utf8_encode($jdatasets);
$datasets = json_decode($jdatasets, true);
foreach ($datasets as $dataset) {
if ($dataset['isReady'] > $displayValue) {
$displayDatasets = 1;
}
}
}
*/
?>
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<?php
include 'includes/meta.html'; // that is the <meta and link tags> superseeds head.html
$script = ''; // $script is added to the header as the
if (isset($datacite)) {
$script = "<script type=\"application/ld+json\">" . $datacite . "</script>";
echo $script;
}
?>
</head>
<body>
<div class="container bg-white px-0">
<?php
include 'includes/header.html'; // all the menus at the top
// -- start dependant content ---------------------------------------------------------
?>
<div id="idExpt" class="p-0 mb-0">
<div id="greenTitle"
class="d-flex justify-content-between bg-info text-white ">
<div class="pt-3 ">
<h1 class="ml-3 "> <?php echo $h1Title;?></h1>
</div>
<div>
<p class="pt-4 mr-3 text-right ">
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw"
class="twitter-share-button" data-via="eRA_curator"
data-size="large"
data-text=" <?php echo $page[0]['Caption'];?> "
data-url="https://www.era.rothamsted.ac.uk/info/<?php echo $page[0]['exptID'];?>/<?php echo $page[0]['FileName'];?>"
data-hashtags="eRAinfo"
data-related="eRA_Curator,Rothamsted" data-related="Rothamsted"
data-show-count="false">Tweet this!</a>
</p>
<script async src="https://platform.twitter.com/widgets.js"
charset="utf-8"></script>
</div>
</div>
<?php
$includeFile = 'metadata/' . $expt . '/' . $FileName.'.'.$ext;
if ($displayValue == 0) {
?>
<div class="d-flex justify-content-between bg-warning text-white p-3 ">
<h2>To edit this page go to <u>'//basset/../era2023/<?php echo $includeFile;?></u> then run the update-all.bat tool which is in "OneDrive - Rothamsted Research\Documents - e-RA\Website maintenance\update eRA website from eraGILBERT - 2024-04-02."</h2>
</div>
<?php
}
$exptPage = "";
if ($pageType != 'default') { $exptPage = " Part of ".$pageType." <a href=\"". $pageType ."/" .$expt. "\">" .$expt. "</a>";}
echo $exptPage;
include_once ($includeFile);
$strTab = "";
if (substr($papers, 0, 4) != "NONE") {
$strTab .= "<h3>Key References</h3> \n\t\t
<div class=\"mx-3\">".$papers."\n\t</div>";
}
echo $strTab;
include_once 'includes/footer.html'; // this has the green bar and bottom
?>
</div>
<?php
include_once 'includes/finish.inc'; // this has the common js scripts
?>
<!-- include here the page dependant scripts -->
</body>
</html>