forked from vanderbilt-redcap/redcap-developer-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHookBasic.php
62 lines (53 loc) · 2.16 KB
/
HookBasic.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
<?php
namespace ExampleModules\HookBasic;
use ExternalModules\AbstractExternalModule;
use ExternalModules\ExternalModules;
class HookBasic extends AbstractExternalModule {
public function redcap_every_page_top($project_id)
{
if ($this->getProjectSetting("enable_every_page_top", $project_id) === true) {
$this->displayAlert(__FUNCTION__);
if ($this->getProjectSetting("enable_debugging", $project_id) === true) {
$this->displayDebug(get_defined_vars());
}
}
}
public function redcap_survey_page_top($project_id, $record, $instrument, $event_id, $group_id, $survey_hash, $response_id, $repeat_instance)
{
$this->displayAlert(__FUNCTION__);
if ($this->getProjectSetting("enable_debugging", $project_id) === true) {
$this->displayDebug(get_defined_vars());
}
}
public function redcap_data_entry_form_top($project_id, $record, $instrument, $event_id, $group_id, $repeat_instance)
{
$this->displayAlert(__FUNCTION__);
if ($this->getProjectSetting("enable_debugging", $project_id) === true) {
$this->displayDebug(get_defined_vars());
}
}
public function redcap_survey_page($project_id, $record, $instrument, $event_id, $group_id, $survey_hash, $response_id, $repeat_instance)
{
$this->displayAlert(__FUNCTION__);
if ($this->getProjectSetting("enable_debugging", $project_id) === true) {
$this->displayDebug(get_defined_vars());
}
}
public function redcap_data_entry_form($project_id, $record, $instrument, $event_id, $group_id, $repeat_instance)
{
$this->displayAlert(__FUNCTION__);
if ($this->getProjectSetting("enable_debugging", $project_id) === true) {
$this->displayDebug(get_defined_vars());
}
}
function displayAlert($msg, $type = "info") {
echo "<div class='alert alert-$type'>$msg</div>";
}
function displayDebug($debug) {
if (is_array($debug) || is_object($debug)) {
echo "<pre>" . print_r($debug, true) . "</pre>";
} else {
echo "<pre>$debug</pre>";
}
}
}