-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_private.php
More file actions
116 lines (107 loc) · 5.09 KB
/
Copy pathmain_private.php
File metadata and controls
116 lines (107 loc) · 5.09 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
<?php
namespace Vanderbilt\DataModelBrowserExternalModule;
use Vanderbilt\DataModelBrowserExternalModule\ProjectData;
$pid = (int)$_GET['pid'];
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include_once (__DIR__ . "/scripts.php"); ?>
<?php
include_once("projects.php");
$RecordSetSettings = \REDCap::getData($pidsArray['SETTINGS'], 'array');
$settings = ProjectData::getProjectInfoArrayRepeatingInstruments($RecordSetSettings,$pidsArray['SETTINGS'])[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 } ?>