-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
51 lines (42 loc) · 1.49 KB
/
index.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
<?php
require_once(__DIR__."/app/bootstrap.php");
use Controllers\AppController as AppController;
use REDCap as REDCap;
use Symfony\Component\HttpFoundation\Request as Request;
use Symfony\Component\HttpFoundation\Response as Response;
$request = Request::createFromGlobals();
$response = new Response();
$chromeless = $request->query->getBoolean("chromeless", false);
// This externa module is designed to work only on longitudinal projects..
if (REDCap::isLongitudinal()){
// Initialize the controller
$controller = new AppController($module);
// Based on the action requested, perform the task...
switch($request->get("action")){
case 'export':
$chromeless = true;
$response = $controller->export($request, $response);
break;
case 'view':
default:
$response = $controller->view($request, $response);
break;
}
}
else{
$response->setContent("Calendar feeds are supported on longitudinal projects only.");
}
/*
Future Note: Should use Response->Send method to reply to the browser.
Section required as is because REDCap header and footer PHP file do not
properly buffer content. As a result, the require_once must be used.
*/
if (!$chromeless){
require_once APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
echo $response->getContent();
require_once APP_PATH_DOCROOT . 'ProjectGeneral/footer.php';
}
else{
$response->prepare($request);
$response->send();
}