-
Notifications
You must be signed in to change notification settings - Fork 174
/
NDB_BVL_Instrument_TEMPLATE.class.inc
149 lines (133 loc) · 3.65 KB
/
NDB_BVL_Instrument_TEMPLATE.class.inc
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
* This file contains the NDB_BVL_Instrument_TEMPLATE
* class
*
* PHP Version 5
*
* @category Instrument
* @package TEMPLATE
* @author Author Name
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/loris/
*/
/**
* Creates the form elements for the Boston_Diagnostic_Aphasia_Exam instrument
*
* @category Instrument
* @package TEMPLATE
* @author Author Name
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/loris/
*/
class NDB_BVL_Instrument_TEST_NAME extends NDB_BVL_Instrument
{
use \LorisFormDictionaryImpl;
/**
* Sets up basic data.
*
* @param string $commentID the CommentID identifying the data to load
* @param string $page if a multipage form, the page to show
*
* @return void
* @access public
*/
function setup(?string $commentID = null, ?string $page = null): void
{
$this->formType ="XIN";
$this->form = new LorisForm('test_form');
$this->page = $page; // page label (number or
// string - used by
// user-defined child classes)
// set the object properties
// Corresponds to the Test_name column in test_names table
$this->testName = "<TEST_NAME>";
// name of database table corresponding to instrument
$this->table = '<TEST_NAME>';
// data keyed by commentID
$this->commentID = $commentID;
//The array of selects with multiple answers allowed
$this->selectMultipleElements = array();
// required fields for data entry completion status
$this->_requiredElements = array(
'Examiner',
'<FIRST QUESTION OF EACH PAGE>',
);
// setup the form
$this->_setupForm();
}
/**
* Builds the object into a paginated form
*
* @return void
* @access private
*/
function _setupForm()
{
if (preg_match("/<TEST_NAME>(_page[0-9]+)/", $this->page, $matches)) {
$this->_page($matches[1]);
} else {
$this->_main();
}
// Defines the call back function to use in validation
$this->form->addFormRule(array(&$this, 'XINValidate'));
}
/**
* Generates the main page of the form.
*
* @return void
* @access private
*/
function _main()
{
// display test name
$this->addHeader("<INSTRUMENT TITLE>");
// automatically adds examiner & date of administration
$this->_addMetadataFields();
// If the instrument is not paged,
// remove the switch from the _setupForm method
// and add all the form Elements in this function
}
/**
* Page 1
*
* @return void
**/
function _page1()
{
//add form Elements here as needed.
//continue onto further pages, if needed.
}
/**
* Page 2
*
* @return void
**/
function _page2()
{
//add form Elements here as needed.
//continue onto further pages, if needed.
}
/**
* {@inheritDoc}
*
* @return string|null
*/
public function getFullName(): ?string
{
return "TEMPLATE TEST NAME";
}
/**
* {@inheritDoc}
*
* @return array
*/
function getSubtestList(): array
{
$subtest = [
['Name'=>'<TEST_NAME>_page1','Description'=>'Subtest One'],
['Name'=>'<TEST_NAME>_page2','Description'=>'Subtest Two'],
];
return $subtest;
}
}