-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php.example1
40 lines (34 loc) · 1.25 KB
/
index.php.example1
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
<?php
/**
* PLUGIN NAME: Plugin Example 1 (using Plugin class)
* DESCRIPTION: Example REDCAP plugin index.php which utilizes this light-weight
* plugin framework.
*
* NOTE: This index.php version can be copied "as is" and use in a new plugin
* without modification.
*
* VERSION: 2.0
* AUTHOR: Michael Prittie
*/
// Retrieve REDCap global MYSQLi database connection object (REDCapism)
global $conn;
// Include the REDCap Connect file in the main "redcap" directory (REDCapism)
require_once('../../redcap_connect.php');
// Set path constants for REDCap and MI REDCap plugin framework
define('REDCAP_ROOT', realpath(dirname(__FILE__).'/../../').'/');
define('FRAMEWORK_ROOT', REDCAP_ROOT.'plugins/framework/');
require_once(FRAMEWORK_ROOT.'Plugin.php');
$plugin = new Plugin($conn, USERID);
$plugin->authorize();
$response_html = $plugin->request_to_response(
$_GET,
$_POST,
$_REQUEST
);
// OPTIONAL: Display the project header (REDCapism)
require_once(APP_PATH_DOCROOT.'ProjectGeneral/header.php');
//Your HTML page content goes here (REDCapism)
echo $response_html;
// OPTIONAL: Display the project footer (REDCapism)
require_once(APP_PATH_DOCROOT.'ProjectGeneral/footer.php');
?>