-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
249 lines (223 loc) · 9.69 KB
/
profile.php
File metadata and controls
249 lines (223 loc) · 9.69 KB
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
<?php
use \Vanderbilt\CareerDevLibrary\Download;
use \Vanderbilt\CareerDevLibrary\Grants;
use \Vanderbilt\CareerDevLibrary\Scholar;
use \Vanderbilt\CareerDevLibrary\Links;
use \Vanderbilt\CareerDevLibrary\Publications;
use \Vanderbilt\FlightTrackerExternalModule\CareerDev;
require_once(dirname(__FILE__)."/small_base.php");
require_once(dirname(__FILE__)."/CareerDev.php");
require_once(dirname(__FILE__)."/charts/baseWeb.php");
require_once(dirname(__FILE__)."/classes/Download.php");
require_once(dirname(__FILE__)."/classes/Grants.php");
require_once(dirname(__FILE__)."/classes/Scholar.php");
require_once(dirname(__FILE__)."/classes/Links.php");
require_once(dirname(__FILE__)."/classes/Publications.php");
if (isset($_GET['record']) && is_numeric($_GET['record'])) {
$record = $_GET['record'];
} else {
$recordIds = Download::recordIds($token, $server);
if (count($recordIds) > 0) {
$record = $recordIds[0];
} else {
$record = 1;
}
}
$nextRecord = \Vanderbilt\FlightTrackerExternalModule\getNextRecord($record);
$redcapData = Download::records($token, $server, array($record));
$metadata = Download::metadata($token, $server);
$grants = new Grants($token, $server, $metadata);
$grants->setRows($redcapData);
$scholar = new Scholar($token, $server, $metadata);
$scholar->setRows($redcapData);
$scholar->setGrants($grants);
$pubs = new Publications($token, $server, $metadata);
$pubs->setRows($redcapData);
$normativeRow = array();
foreach ($redcapData as $row) {
if ($row['redcap_repeat_instrument'] == "") {
$normativeRow = $row;
}
}
$name = $scholar->getName("full");
$firstName = $scholar->getName("first");
$lastName = $scholar->getName("last");
$email = $scholar->getEmail();
if ($email) {
$email = "<a href='mailto:$email'>$email</a>";
} else {
$email = "None specified";
}
$status = $scholar->getEmploymentStatus();
if (preg_match("/^\d\d\d\d-\d+-\d+$/", $status)) {
$status = "Left ".INSTITUTION." on ".\Vanderbilt\FlightTrackerExternalModule\YMD2MDY($status);
}
$institution = $scholar->getInstitutionText();
$degrees = $scholar->getDegreesText();
$dept = $scholar->getPrimaryDepartmentText();
$mentors = $scholar->getAllMentors();
$resources = $scholar->getResourcesUsed();
$converted = $scholar->isConverted();
$numGrants = $grants->getNumberOfGrants("prior");
$numPublications = $pubs->getNumber("Original Included");
$avgRCR = $pubs->getAverageRCR("Original Included");
$numCitations = $pubs->getNumberOfCitationsByOthers("Original Included");
$dollarsSummaryTotal = $grants->getTotalDollars("prior");
$dollarsSummaryDirect = $grants->getDirectDollars("prior");
$grants->compileGrants("Financial");
$dollarsCompiledTotal = $grants->getTotalDollars("compiled");
$dollarsCompiledDirect = $grants->getDirectDollars("compiled");
?>
<style>
h1 { text-align: center; margin: 0px; }
.centered { text-align: center; margin: 0px; }
.label,.labelCentered { font-weight: bold; }
.labelCentered,.valueCentered { text-align: center; }
.label { text-align: right; }
.value,.valueCentered,.label,.labelCentered { font-size: 16px; }
.value { text-align: left; }
.allcaps { text-transform: uppercase; }
iframe.centered { width: 1000px; margin-left: auto; margin-right: auto; display: block; border-radius: 20px; }
.profileHeader { vertical-align: middle; padding: 4px 8px 4px 8px; }
td.profileHeader div a { color: black; }
td.profileHeader div a:hover { color: #0000FF; }
.header { padding: 8px; }
</style>
<script>
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
// remove onload event or it will refresh forever
obj.onload = function() { };
obj.src = obj.src;
}
function refreshProfile(page) {
var rec = $('#refreshRecord').val();
if (rec) {
window.location.href = page+"?pid=<?= $pid ?>&record="+rec;
}
}
$(document).ready(function() {
$('#searchProfile').keydown(function(e) {
if ((e.keyCode == 13) || (e.keyCode == 9)) {
var url = window.location.href;
var pageWithGet = url.replace(/^.+\//, "");
var page = pageWithGet.replace(/\?.+$/, "");
var name = $(this).val();
search(page, '#searchProfileDiv', name);
}
});
});
</script>
<div class='subnav'>
<?= Links::makeProfileLink($pid, "View Profile for Next Record", $nextRecord, FALSE, "purple") ?>
<?= Links::makeEmailMgmtLink($pid, "Survey Management", FALSE, "purple") ?>
<?= Links::makeDataWranglingLink($pid, "Grant Wrangler", $record, FALSE, "green") ?>
<?= Links::makePubWranglingLink($pid, "Publication Wrangler", $record, FALSE, "green") ?>
<a class='yellow'><?= getSelectRecordForProfile() ?></a>
<a class='yellow'><?= getSearchForProfile() ?></a>
</div>
<div id='content'>
<h1><?= $name ?></h1>
<table style='margin-left: auto; margin-right: auto; border-radius: 10px; padding: 8px;' class='blue'>
<tr>
<td class='label profileHeader'>First Name:</td>
<td class='value profileHeader'><?= $firstName ?></td>
<td class='label profileHeader'>Primary Department:</td>
<td class='value profileHeader'><?= $dept ?></td>
</tr>
<tr>
<td class='label profileHeader'>Last Name:</td>
<td class='value profileHeader'><?= $lastName ?></td>
<td class='label profileHeader'>Degrees:</td>
<td class='value profileHeader'><?= $degrees ?></td>
</tr>
<tr>
<td class='label profileHeader'>Email:</td>
<td class='value profileHeader'><?= $email ?></td>
<?php
if (CareerDev::getInstitutionCount() == 1) {
echo "<td class='label profileHeader'>Status:</td>\n";
echo "<td class='value profileHeader'>$status</td>\n";
} else {
echo "<td class='label profileHeader'>Institution:</td>\n";
echo "<td class='value profileHeader'>$institution</td>\n";
}
?>
</tr>
<tr>
<td class='label profileHeader'>REDCap:</td>
<td class='value profileHeader'><?= Links::makeSummaryLink($pid, $record, $event_id, "Record ".$record) ?></td>
<td class='label profileHeader'>Converted?:</td>
<td class='value profileHeader allcaps'><?= $converted ?></td>
</tr>
<tr>
<td class='label profileHeader'>Confirmed Original<br>Research Articles:</td>
<td class='value profileHeader'><?= \Vanderbilt\FlightTrackerExternalModule\pretty($numPublications) ?></td>
<td class='label profileHeader'>Average Relative<br>Citation Ratio:</td>
<td class='value profileHeader'><?= \Vanderbilt\FlightTrackerExternalModule\pretty($avgRCR) ?></td>
</tr>
<tr>
<td class='label profileHeader'>Grants:</td>
<td class='value profileHeader'><?= \Vanderbilt\FlightTrackerExternalModule\pretty($numGrants) ?></td>
<td class='label profileHeader'>Citations by Others:</td>
<td class='value profileHeader'><?= \Vanderbilt\FlightTrackerExternalModule\pretty($numCitations) ?></td>
</tr>
<tr>
<?php
if ($dollarsCompiledTotal) {
echo "<td class='label profileHeader'>Total Dollars<br>All Grants<br>(Internal and External;<br>recorded in COEUS):</td>\n";
echo "<td class='value profileHeader'>".\Vanderbilt\FlightTrackerExternalModule\prettyMoney($dollarsCompiledTotal)."</td>\n";
}
?>
<td class='label profileHeader'>Total Dollars<br>from Grants<br>(External Sources Only):</td>
<td class='value profileHeader'><?= \Vanderbilt\FlightTrackerExternalModule\prettyMoney($dollarsSummaryTotal) ?></td>
</tr>
<tr>
<td class='label profileHeader'>Mentors:</td>
<td class='value profileHeader'><?= printList($mentors) ?></td>
<td class='label profileHeader'>Resources Used:</td>
<td class='value profileHeader'><?= printList($resources) ?></td>
</tr>
</table><br><br>
<h2>Contents</h2>
<table style='margin-left: auto; margin-right: auto; max-width: 800px; border-radius: 10px; padding: 8px;' class='blue'>
<tr>
<td class='profileHeader'>
<div class='labelCentered'><a href='#grant_wrangler'>Grant Wrangler</a></div>
<div class='valueCentered'>The Grant Wrangler helps you make manual changes to the structure of grants that is computed. You can change which grants are included or excluded. You can also change some of the properties in each grant. This information will be fed back into the computed summaries next time that script is run in the background.</div>
</td>
</tr>
<tr>
<td class='profileHeader'>
<div class='labelCentered'><a href='#pub_wrangler'>Publication Wrangler</a></div>
<div class='valueCentered'>The Publication Wrangler helps you filter through each publication to see if names are mismatched. Since names can sometimes be mis-identified in publications, the step of authenticating the citation is required.</div>
</td>
</tr>
<tr>
<td class='profileHeader'>
<div class='labelCentered'><a href='#data_sources'>Data Source Comparison</a></div>
<div class='valueCentered'>This allows you to see all of your data about grants at one glance. The information to the left is preferred over the information to the write. The computer automatically picks the data which is most preferred. Items in green are being used while items in red disagree with the information in the preferred grant. This helps you see where the information comes from.</div>
</td>
</tr>
</table><br><br>
<?php
require_once(dirname(__FILE__)."/charts/timeline.php");
echo "<br><br>\n";
?>
<iframe class='centered' style='height: 600px;' id='grant_wrangler' src='<?= CareerDev::link("wrangler/index.php")."&record=$record&headers=false" ?>'></iframe><br><br>
<iframe class='centered' style='height: 600px;' id='pub_wrangler' src='<?= CareerDev::link("wrangler/pubs.php")."&record=$record&headers=false" ?>'></iframe><br><br>
<iframe class='centered' style='height: 600px;' id='data_sources' src='<?= CareerDev::link("tablesAndLists/dataSourceCompare.php")."&record=$record&headers=false" ?>'></iframe><br><br>
</div>
<?php
function getSearchForProfile() {
return Publications::getSearch();
}
function getSelectRecordForProfile() {
return Publications::getSelectRecord();
}
function printList($list) {
if (empty($list)) {
return "(None specified.)";
}
return implode("<br>", $list);
}