-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_private.php
129 lines (121 loc) · 6.57 KB
/
main_private.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
<?php use Vanderbilt\DataModelBrowserExternalModule\ProjectData; ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="<?=$module->getUrl('js/jquery-3.3.1.min.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/bootstrap.min.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/functions.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/jquery-ui.min.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/jquery.tablesorter.min.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/jquery.dataTables.min.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/dataTables.select.js')?>"></script>
<script type="text/javascript" src="<?=$module->getUrl('js/dataTables.buttons.min.js')?>"></script>
<link type='text/css' href='<?=$module->getUrl('js/fonts-awesome/css/font-awesome.min.css')?>' rel='stylesheet' media='screen' />
<link rel="stylesheet" type="text/css" href="<?=$module->getUrl('css/bootstrap.min.css')?>">
<link rel="stylesheet" type="text/css" href="<?=$module->getUrl('css/style.css')?>">
<link type='text/css' href='<?=$module->getUrl('css/tabs-steps-menu.css')?>' rel='stylesheet' media='screen' />
<link type='text/css' href='<?=$module->getUrl('css/sortable-theme-bootstrap.css')?>' rel='stylesheet' media='screen' />
<link type='text/css' href='<?=$module->getUrl('css/jquery-ui.min.css')?>' rel='stylesheet' media='screen' />
<script>
var startDDProjects_url = <?=json_encode($module->getUrl('startDDProjects.php'))?>;
var downloadPDF_AJAX_url = <?=json_encode($module->getUrl('options/downloadPDF_AJAX.php'))?>;
var pid = <?=json_encode((int)$_GET['pid'])?>;
</script>
<?php
include_once("projects.php");
$RecordSetSettings = \REDCap::getData($pidsArray['SETTINGS'], 'array');
$settings = ProjectData::getProjectInfoArrayRepeatingInstruments($RecordSetSettings)[0];
include_once("functions.php");
$des_privacy = $module->getProjectSetting('des-privacy');
$has_permission = false;
$page = "main_private.php?";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="<?=\Vanderbilt\DataModelBrowserExternalModule\printFile($module,$settings['des_favicon'],'url')?>">
<title><?=htmlentities($settings['des_doc_title'],ENT_QUOTES)?></title>
<script type='text/javascript'>
var app_path_webroot = '<?=APP_PATH_WEBROOT?>';
var app_path_webroot_full = '<?=APP_PATH_WEBROOT?>';
var app_path_images = '<?=APP_PATH_IMAGES?>';
</script>
<style>
table thead .glyphicon{ color: blue; }
</style>
<?php include('header.php'); ?>
<?php include('navbar.php'); ?>
</head>
<body>
<?php
$des_project = $module->getProjectSetting('des-project');
$has_permission = false;
if($des_privacy == 'public'){
$has_permission = true;
}else if($des_privacy == 'main'){
if(!defined('USERID')){
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">Please log in REDCap to access this Browser.</div></div>';
exit;
}else if(\Vanderbilt\DataModelBrowserExternalModule\isUserExpiredOrSuspended($module,USERID, 'user_suspended_time') || \Vanderbilt\DataModelBrowserExternalModule\isUserExpiredOrSuspended($module,USERID, 'user_expiration')) {
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">This user is expired or suspended. Please contact an administrator.</div></div>';
exit;
}else{
$result = $module->query("SELECT * FROM `redcap_user_rights` WHERE project_id=? AND username=?" ,[$_REQUEST['pid'],USERID]);
if ($result->num_rows > 0) {
$has_permission = true;
}
}
}else if($des_privacy == 'other') {
if(!defined('USERID')){
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">Please log in REDCap to access this Browser.</div></div>';
exit;
}else if(count($des_project) == 0) {
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">Please select a project(s) to give permissions to.</div></div>';
exit;
}else if(\Vanderbilt\DataModelBrowserExternalModule\isUserExpiredOrSuspended($module,USERID, 'user_suspended_time') || \Vanderbilt\DataModelBrowserExternalModule\isUserExpiredOrSuspended($module,USERID, 'user_expiration')) {
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">This user is expired or suspended. Please contact an administrator.</div></div>';
exit;
}else{
foreach ($des_project as $project) {
$result = $module->query("SELECT * FROM `redcap_user_rights` WHERE project_id=? AND username=?" ,[$project,USERID]);
if ($result->num_rows > 0) {
$has_permission = true;
}
}
}
}else{
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">This Browser has not yet been set up. Please go to the “<strong>External Modules</strong>” menu and configure the Data Model Browser.</div></div>';
exit;
}
if(!$has_permission){
echo '<div class="container" style="margin-top: 60px"><div class="alert alert-warning" role="alert">You don\'t have permissions to access this Browser. Please contact an administrator.</div></div>';
exit;
}
if($has_permission){
if($_REQUEST['option'] !== 'search' && $_REQUEST['option'] !== 'variableInfo' && $_REQUEST['option'] !== 'json') {
include('downloadButtons.php');
}
?>
<div class="container-fluid wiki_container">
<?PHP
if( !array_key_exists('option', $_REQUEST) )
{
include('pages/wiki_tables.php');
}else if( array_key_exists('option', $_REQUEST) && $_REQUEST['option'] === 'variables' )
{
include('pages/wiki_variables.php');
}else if( array_key_exists('option', $_REQUEST) && $_REQUEST['option'] === 'variableInfo' )
{
include('pages/wiki_variable_info.php');
}else if( array_key_exists('option', $_REQUEST) && $_REQUEST['option'] === 'search' )
{
include('pages/wiki_variable_search.php');
}else if( array_key_exists('option', $_REQUEST) && $_REQUEST['option'] === 'json' ) {
include('jsoncopy/copyfiles.php');
}
?>
</div>
<?php } ?>