-
Notifications
You must be signed in to change notification settings - Fork 0
/
snes.module
158 lines (147 loc) · 4.25 KB
/
snes.module
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
150
151
152
153
154
155
156
157
158
<?php
function snes_menu()
{
$items = array();
$items['snes/play'] = array(
'title' => 'Play the SNES trivia game!',
'page callback' => 'drupal_get_form',
'page arguments' => array('snes_form'),
'access callback' => TRUE,
'description' => 'Play a fun of SNES trivia to demonstrate custom Drupal module development',
);
return $items;
}
function snes_form($form, &$form_state) {
$form['question1'] = array(
'#type' => 'radios',
'#options' => array(
'a1' => t('Terrabound'),
'a2' => t('Zelda - A Link to the Present'),
'a3' => t('Earthbound'),
),
'#title' => t('Which RPG featured a little boy using a baseball bat, ordering pizza, and checking the game map out of the public library?')
);
$form['question1yes'] = array(
'#type' => 'fieldset',
'#title' => t('Correct!'),
// This #states rule says that the "high school" fieldset should only
// be shown if the "student_type" form element is set to "High School".
'#states' => array(
'visible' => array(
':input[name="question1"]' => array('value' => 'a3'),
),
),
);
$form['question2'] = array(
'#type' => 'radios',
'#options' => array(
'b1' => t('Super Famicom'),
'b2' => t('Nintendo Master System'),
'b3' => t('Super Nintendo 16'),
),
'#title' => t('What was the system called in Japan where it originated from?'),
'#states' => array(
'visible' => array(
':input[name="question1"]' => array('value' => 'a3'),
),
),
);
$form['question2yes'] = array(
'#type' => 'fieldset',
'#title' => t('Correct!'),
'#states' => array(
'visible' => array(
':input[name="question2"]' => array('value' => 'b1'),
),
),
);
$form['question3'] = array(
'#type' => 'textfield',
'#title' => t('Super Mario Kart has this type of graphics processor added to it which was revolutionary at the time.'),
'#states' => array(
'visible' => array(
':input[name="question2"]' => array('value' => 'b1'),
),
),
);
$form['question3yes'] = array(
'#type' => 'fieldset',
'#title' => t('Correct!'),
'#states' => array(
'visible' => array(
':input[name="question3"]' => array('value' => 'Mode 7'),
),
),
);
$form['question4'] = array(
'#type' => 'radios',
'#title' => t('Mortal Kombat for the SNES and Genesis formed the need for what content ratings group?'),
'#options' => array(
'c1' => t('msrp'),
'c2' => t('esrb'),
'c3' => t('mpaa'),
),
'#states' => array(
'visible' => array(
':input[name="question3"]' => array('value' => 'Mode 7'),
),
),
);
$form['question4yes'] = array(
'#type' => 'fieldset',
'#title' => t('Correct!'),
'#states' => array(
'visible' => array(
':input[name="question4"]' => array('value' => 'c2'),
),
),
);
$form['question5'] = array(
'#type' => 'fieldset',
'#title' => t('Before their smash hit with Donkey Kong, what animal games did Rare produce for the SNES?'),
'#states' => array(
'visible' => array(
':input[name="question4"]' => array('value' => 'c2'),
),
),
);
$form['question5a'] = array(
'#type' => 'checkbox',
'#title' => t('Banjo-Kablooey'),
'#states' => array(
'visible' => array(
':input[name="question4"]' => array('value' => 'c2'),
),
),
);
$form['question5b'] = array(
'#type' => 'checkbox',
'#title' => t('Stamper: Jungle Trouble'),
'#states' => array(
'visible' => array(
':input[name="question4"]' => array('value' => 'c2'),
),
),
);
$form['question5c'] = array(
'#type' => 'checkbox',
'#title' => t('Battletoads in Battlemaniacs'),
'#states' => array(
'visible' => array(
':input[name="question4"]' => array('value' => 'c2'),
),
),
);
$form['question5yes'] = array(
'#type' => 'fieldset',
'#title' => t('Correct!'),
'#states' => array(
'visible' => array(
':input[name="question5a"]' => array('checked' => FALSE),
':input[name="question5b"]' => array('checked' => FALSE),
':input[name="question5c"]' => array('checked' => TRUE),
),
),
);
return $form;
}