-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatientLookup.php
More file actions
66 lines (56 loc) · 2.26 KB
/
patientLookup.php
File metadata and controls
66 lines (56 loc) · 2.26 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
<?php
require_once('base.php');
/* @var $module RedcapAfrica\OrganRegistryModule\OrganRegistryModule */
require_once \ExternalModules\ExternalModules::getProjectHeaderPath();
if($_GET['debug_logging'] == "on") {
$_SESSION['debug_logging'] = "on";
}
if($_GET['debug_logging'] == "off") {
$_SESSION['debug_logging'] = "off";
}
$vars['styles'][] = $module->getUrl("css/style.css");
$vars['styles'][] = $module->getUrl("css/datatables.min.css");
//$vars['scripts'][] = $module->getUrl("js/jquery-1.12.4.min.js");
$vars['scripts'][] = $module->getUrl("js/datatables.min.js");
$lookupFields = $module->getProjectSetting("search-fields");
$repeatingFields = $module->getProjectSetting("repeating-field");
$metadata = $module->getMetadata($project);
$lookupDetails = [];
foreach($lookupFields as $fieldKey => $thisField) {
$lookupDetails[$thisField]['label'] = $metadata[$thisField]["field_label"];
$options = [];
if($metadata[$thisField]["field_type"] == "checkbox") {
$options = $module->getChoiceLabels($thisField);
$lookupDetails[$thisField]['type'] = 'checkbox';
}
else if(in_array($metadata[$thisField]["field_type"],["radio","dropdown","yesno","truefalse","sql"])) {
$lookupDetails[$thisField]['type'] = 'select';
switch($metadata[$thisField]["field_type"]) {
case "radio":
case "dropdown":
$options = $module->getChoiceLabels($thisField);
break;
case "yesno":
$options = [1 => "yes", 0 => "no"];
break;
case "truefalse":
$options = [1 => "true", 0 => "false"];
break;
case "sql":
$options = [];
break;
}
}
else {
$lookupDetails[$thisField]['type'] = 'text';
}
$lookupDetails[$thisField]['options'] = $options;
if($repeatingFields[$fieldKey]) {
$lookupDetails[$thisField]['repeating'] = true;
}
}
$vars['lookupDetails'] = $lookupDetails;
$vars['searchHistoryLink'] = $module->getUrl("searchHistoryLookup.php");
$vars['patientSearchLink'] = $module->getUrl("patientSearchAjax.php");
echo $twig->render('patientLookup.twig', $vars);
require_once \ExternalModules\ExternalModules::getProjectFooterPath();