-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathverify.php
87 lines (78 loc) · 2.52 KB
/
verify.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
<?php
require_once __DIR__."/../../redcap_connect.php";
require_once __DIR__."/MetaDataDAO.php";
require_once __DIR__."/DataResolutionDAO.php";
$HtmlPage = new HtmlPage();
$HtmlPage->PrintHeaderExt();
$projectid = htmlspecialchars($_POST["projectid"], ENT_QUOTES);
$record = htmlspecialchars($_POST["recordid"], ENT_QUOTES);
$instrument = htmlspecialchars($_POST["instrument"], ENT_QUOTES);
$eventid = htmlspecialchars($_POST["eventid"], ENT_QUOTES);
$instanceid = htmlspecialchars($_POST["instanceid"], ENT_QUOTES);
echo "<h1>Updating for project $projectid on record $record</h1>";
echo "<p><a class='btn btn-info' data-toggle='collapse' href='#tableDiv' role='button' aria-expanded='false' aria-controls='tableDiv'>Show details</a></p>";
echo "<div class='collapse' id='tableDiv'>";
echo "<table class='table table-bordered'>";
echo "<tbody>";
echo "<tr>";
echo "<td>project_id</td>";
echo "<td>$projectid</td>";
echo "</tr>";
echo "<tr>";
echo "<td>record</td>";
echo "<td>$record</td>";
echo "</tr>";
echo "<tr>";
echo "<td>event_id</td>";
echo "<td>$eventid</td>";
echo "</tr>";
echo "<tr>";
echo "<td>instrument</td>";
echo "<td>$instrument</td>";
echo "</tr>";
echo "<tr>";
echo "<td>instance</td>";
echo "<td>$instanceid</td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</div>";
$metadataDao = new uzgent\VerifyClass\MetaDataDAO($conn);
$resolutionDao = new uzgent\VerifyClass\DataResolutionDAO($conn);
$userInitiator = User::getUserInfo(USERID);
$skipped = [];
$verified = [];
foreach ($metadataDao->getFieldNames($projectid, $instrument) as $field)
{
if ($field == "record_id") {
$skipped []= $field;
} else if ($resolutionDao->fieldHasComments($projectid, $record, $field, $instanceid, $eventid))
{
$skipped []= $field;
} else {
$verified []= $field;
$resolutionDao->markFieldAsVerified($projectid, $record, $field, $instanceid, $userInitiator['ui_id'], $eventid);
}
}
if (count($verified) > 0)
{
echo "<h3>The following fields have been set to verified: </h3>";
echo "<ul>";
foreach($verified as $verifiedField)
{
echo "<li>" . htmlspecialchars($verifiedField, ENT_QUOTES) . "</li>";
}
echo "</ul>";
}
if (count($skipped) > 0)
{
echo "<h3>The following fields have been skipped: </h3>";
echo "<ul>";
foreach($skipped as $skippedField)
{
echo "<li>" . htmlspecialchars($skippedField, ENT_QUOTES) . "</li>";
}
echo "</ul>";
}
?>
<button class="btn btn-success" onclick="window.history.go(-1); return false;">OK</button>