-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathend.php
181 lines (158 loc) · 5.94 KB
/
end.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<meta http-equiv="Content-Script-Type" content="text/javascript; charset=utf-8">
<script src="debug.js" type="text/javascript"></script>
<?php
$lang = $_GET['lang'];
if(empty($lang)){
$lang = 'en';
}
//echo $lang;
$debug = intval($_GET['debug']);
$cnum_str = $_GET['cnum_str'];
$et = json_decode(stripslashes($_POST['entry']), true);
//*
echo '<pre>';
print_r($et);
echo '</pre>';
//*/
?>
<link href='lib/js/themes/flick/jquery-ui-1.7.2.custom.css' type='text/css' rel="Stylesheet" />
<script src="lib/js/jquery-1.3.2.js" type="text/javascript"></script>
<script src="lib/js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="lib/js/jquery.form.js" type="text/javascript"></script>
<script src="lib/js/jquery.serialScroll-1.2.2/jquery.scrollTo.js" type="text/javascript"></script>
<script src="lib/js/jquery.serialScroll-1.2.2/jquery.serialScroll.js" type="text/javascript"></script>
<?php
echo '<script src="lib/js/jquery.validate.';
echo $lang;
//echo'.js" type="text/javascript" charset="utf-8"></script>';
echo'.js" type="text/javascript"></script>';
?>
<script src="lib/js/prototype.js" type="text/javascript"></script>
<script src="lib/js/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript">
<?php
require_once('lib/spyc/spyc.php');
function alert($val){
echo 'val="'.$val.'";';
echo 'alert('.val.');';
}
$end = Spyc::YAMLLoad('conf.d/end.yaml');
echo 'end='.json_encode($end).';';
echo 'lang="'.$lang.'";';
echo 'cnum_str="'.$cnum_str.'";';
echo 'ip="'.$_SERVER['REMOTE_ADDR'].'";';
echo 'debug='.$debug.';';
$followup = Spyc::YAMLLoad('conf.d/followup.yaml');
$demography = Spyc::YAMLLoad('conf.d/demography.yaml');
if($debug){
$followup['valid-question-ids'] = array($followup['valid-question-ids'][0]);
$demography['valid-question-ids'] = array($demography['valid-question-ids'][0]);
}
echo 'followup='.json_encode($followup).';';
echo 'demography='.json_encode($demography).';';
?>
</script>
<script src="end.js" type="text/javascript"></script>
<?php
//*
echo '<pre>';
//print_r($consent);
echo '</pre>';
//*/
?>
</head>
<?php
require_once('conf.d/server/ga.php');
?>
<style type="text/css">
#header {color: red;}
label.choice:hover {background-color: yellow; cursor:pointer; cursor:hand;}
input:focus {background: yellow; }
#comment-end-input {width: 500px; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; display:none; }
</style>
<div id="header"></div>
<form id='followup-form'>
<div id='followup-view'>
<div id='followup-desc'></div><br/>
<?php
foreach($followup['valid-question-ids'] as $i){
echo "<label id='followup-".$i."-desc'></label>";
echo '<label class="error" for="followup-'.$i.'" ><br />';
if($lang=='zh'){
echo '请选择一个答案.';
}else{
echo 'Please select an answer.';
}
echo "</label><br />";
for($j=1; $j<=5; $j++){
echo '<label class="choice"><input type="radio" name="followup-'.$i.'" value="'.$j.'" /> <span class="choice" id="followup-'.$i.'-answer-'.$j.'" ></span>     </label>';
}
echo "<br /><br />";
}
?>
</div>
</form>
<form id='demography-form'>
<div id='demography-desc'></div><br/>
<?php
foreach($demography['valid-question-ids'] as $i){
echo "<label id='demography-".$i."-desc'></label>";
echo '<label class="error" for="demography-'.$i.'" ><br />';
if($lang=='zh'){
echo '请选择一个答案.';
}else{
echo 'Please select an answer.';
}
echo "</label><br />";
$count = count($demography['questions-answers'][$i]['answer'][$lang]);
for($j=1; $j<=$count; $j++){
echo '<label class="choice"><input type="radio" name="demography-'.$i.'" value="'.$j.'" /> <span class="choice" id="demography-'.$i.'-answer-'.$j.'" ></span>     </label><br/>';
}
echo "<br />";
}
?>
</form>
<form id='Chinese-in-America-form'>
<label>8. 您现在哪里居住?</label>
<?php
echo '<label class="error" for="residency" ><br />';
if($lang=='zh'){
echo '请选择一个答案.';
}else{
echo 'Please select an answer.';
}
echo "</label><br />";
?>
<label class="choice"><input type="radio" name="residency" value="1" /> <span class="choice">美国</span> </label><br/>
<label class="choice"><input type="radio" name="residency" value="2" /> <span class="choice">加拿大</span> </label><br/>
<label class="choice"><input type="radio" name="residency" value="3" /> <span class="choice">中国</span> </label><br/>
<label class="choice"><input type="radio" name="residency" value="4" /> <span class="choice">其他</span> </label><br/>
<div id='not-live-in-China'>
<br/>
<label>9. 如果您现在不在中国居住, 您是哪一年出国的?</label><br/>
<input id='year-abroad' name='year-abroad' type="text" size="6"/>年<label class="error" for="year-abroad" >     请输入4位年份数字</label>
</div>
<div id='live-in-China'>
<br/>
<label>9. 如果您现在在中国居住, 但是曾经在国外居住一段时间, 请问您曾在国外呆了多长时间? 在那个国家? </label><br/>
<input id="years" name='years' type="text" size="2"/>年<label class="error" for="years" >  请输入数字(0 ~ 100)  </label>
<input id="months" name='months' type="text" size="2"/>个月<label class="error" for="months" >  请输入数字(0 ~ 11)  </label>
在<input id="country" name='country' type="text" size="10"/><label class="error" for="country" >  请输入  </label>(国家名字)
</div>
</form>
<form id='final-form'>
<div id='end-desc'></div>
<div id='confirmation-number'></div>
<br/>
<div id='email-desc'></div>
<input id='email' name='email' type="text"/>
<br /><br />
<label id='comment-end-label'></label><br />
<input id='comment-end-input' type="text" /><br />
</form>
<input id='submit' type="button"/>
<div id='result'></div>
<div id='final-view'></div>