-
Notifications
You must be signed in to change notification settings - Fork 1
/
submit_headless.php
223 lines (195 loc) · 8.29 KB
/
submit_headless.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
include './inc/init.php';
include './inc/flourishDB.php';
$tmpl->set('siteName', $translations->siteName);
$tmpl->set('siteTagline', $translations->siteTagline);
$tmpl->set('formallyKnownAs', $translations->formallyKnownAs);
$tmpl->set('maps', $translations->maps);
$tmpl->set('blog', $translations->blog);
$tmpl->set('forums', $translations->forums);
$tmpl->set('submitAReading', $translations->submitAReading);
$tmpl->set('languageSelect', $translations->languageSelect);
$tmpl->set('contact', $translations->contact);
$tmpl->set('follow', $translations->follow);
$tmpl->set('termsPolicy', $translations->termsPolicy);
$tmpl->set('conceivedPart1', $translations->conceivedPart1);
$tmpl->set('conceivedPart2', $translations->conceivedPart2);
$tmpl->set('pageName', 'submit');
$action = fRequest::get('action',"string?" );
$tmpl->place('header_headless');
if($action=="submit"){
$tmpl->set('title', 'Reading Submitted');
$whitelist = array("[email protected]","[email protected]");
echo '<div class="content">
<div class="relativeWrap">
<div class="submitFormWrap">
<div class="sectionHeadForm">' . $translations->submitReading . '</div><div id="submitFormBody" class="form">';
$success = true;
try {
//look for an existing user
$email = fRequest::get('email',"string?" );
if($email!=NULL){
$user = new User(array('email' => $email));
}else{
$success = false;
}
} catch (fExpectedException $e) {
$success = false;
}
try {
//$user = new User();
$email = fRequest::get('email',"string?" );
if(!$success){
$user = new User();
$user->populate();
$user->store();
}
$reading = new Reading();
$reading->populate();
$reading->setUserId($user->getUserId());
// if (in_array(strtolower($email), $whitelist)) {
$reading->setIsVerified(1);
// }
$reading->store();
echo "Thank you for submitting your radiation reading.";
} catch (fExpectedException $e) {
echo $e->printMessage();
}
echo '</div>
</div>
</div>
</div>';
die;
}
$tmpl->set('title', 'Submit Radiation Reading');
if($mobile){
$tmpl->add('css', 'style/formalizeMobile.css');
}else{
$tmpl->add('css', 'style/formalize.css');
}
$tmpl->add('css', 'style/anytime.css');
$tmpl->add('js', 'http://maps.google.com/maps/api/js?sensor=false');
$tmpl->add('js', 'script/jquery.formalize.min.js');
$tmpl->add('js', 'script/jquery.checkForm.1.0.js');
$tmpl->add('js', 'script/jquery.locationpicker.js');
$tmpl->add('js', 'script/jquery.geolocation.js');
$tmpl->add('js', 'script/anytime.js');
$tmpl->add('js', 'script/anytimetz.js');
$tmpl->add('js', 'script/formValidation.js');
$tmpl->place('header_headless');
/*
"enterLocation": "enter location",
"submitReading": "Submit a reading:",
*/
?>
<div class="content">
<div class="relativeWrap">
<div class="submitFormWrap">
<div class="sectionHeadForm"><?php echo $translations->submitReading; ?></div>
<div id="submitFormBody" class="form">
<fieldset>
<legend><?php echo $translations->aboutYourReading; ?></legend>
<div class="formRow">
<label for="input_reading_value"><?php echo $translations->readingValue; ?></label><br />
<input type="text" name="input_reading_value" value="" id="input_reading_value" class="input_xxlarge" />
</div>
<div class="formRow">
<label for="input_reading_system"><?php echo $translations->readingUnits; ?></label><br />
<select size="1" id="input_reading_system" name="input_reading_system" class="">
<option value=1>Color (Green, Yellow, Red)</option>
<option value=2>Clicks Per Minute (CPM)</option>
<option value=3>µSv/h</option>
<option value=4>µRem/h</option>
<option value=5>Roentgen (R)</option>
<option value=6>Rad (Radiation Absorbed Dose)</option>
<option value=7>nGy/h</option>
</select>
</div>
<div class="formRow">
<label for="input_equipment"><?php echo $translations->equipmentDescription; ?></label><br />
<input type="text" name="input_equipment" value="" id="input_equipment" class="input_xxlarge" />
</div>
<div class="latlngWrap">
<div class="latlngbox">
<label for="pickerDay"><?php echo $translations->whatDay; ?></label><br />
<input type="text" name="pickerDay" value="" id="pickerDay" class="input_medium" />
</div>
<div class="latlngbox">
<label for="pickerTime"><?php echo $translations->whatTime; ?></label><br />
<input type="text" name="pickerTime" value="" id="pickerTime" class="input_medium" />
</div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $translations->whereReadingTaken; ?></legend>
<div id="locationWrapper">
<div class="formRow">
<label for="lnglat"><?php echo $translations->location; ?></label><br />
<input type="text" name="lnglat" value="" id="lnglat" class="input_xxlarge" />
</div>
<div id="locationOrSpacer"> - or - </div>
<form id="submitReading" name="submitReading" method="post" action="submit_h/do" class="">
<div class="latlngWrap">
<div class="latlngbox">
<label for="readings-lat"><?php echo $translations->latitude; ?></label><br />
<input type="text" name="lat" value="" id="readings-lat" class="input_medium" />
</div>
<div class="latlngbox">
<label for="readings-lng"><?php echo $translations->longitude; ?></label><br />
<input type="text" name="lng" value="" id="readings-lng" class="input_medium" />
</div>
</div>
<div id="locationMap"></div>
<div id="mapNote"><?php echo $translations->youMayDragPin; ?></div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $translations->yourInfo; ?></legend>
<div class="formRow">
<label for="readings-first_name"><?php echo $translations->firstName; ?></label><br />
<input type="text" name="first_name" value="" id="readings-first_name" class="input_xxlarge require" />
</div>
<div class="formRow">
<label for="readings-last_name"><?php echo $translations->lastName; ?></label><br />
<input type="text" name="last_name" value="" id="readings-last_name" class="input_xxlarge require" />
</div>
<div class="formRow">
<label for="readings-email"><?php echo $translations->email; ?></label><br />
<input type="text" name="email" value="" id="readings-email" class="input_xxlarge require" />
</div>
</fieldset>
<div class="formRowSubmit"><br />
<input type="hidden" name="reading_value" id="readings-reading_value" value="" />
<input type="hidden" name="reading_system" id="readings-reading_system" value="" />
<input type="hidden" name="equipment" id="readings-equipment" value="" />
<input type="hidden" name="reading_date" id="readings-reading_date" value="" />
<input type="image" src="images/submitNow.png" alt="" style="width:168px; height:33px:" />
</div>
</form>
</div>
</div>
<div class="submitSteps box">
<div class="sectionHeadRight"><?php echo $translations->howSubmitHead; ?></div>
<div id="stepsBody">
<div id="stepsIntro"><?php echo $translations->howSubmitBody; ?>
</div>
<div id="stepsHead">
<?php echo $translations->toSubmitHead; ?>
</div>
<div class="step">
<?php echo $translations->toSubmitStep1; ?>
<li><a href="http://shop.medcom.com/">INTERNATIONAL MEDCOM</a></li>
<li><a href="http://amzn.to/hnk4g7">AMAZON</a></li>
<li><a href="http://bit.ly/dNzH87">LAB SAFETY SUPPLY</a></li>
<li><a href="http://bit.ly/dZBL3y">COLE-PARMER</a></li>
</div>
<div class="step">
<?php echo $translations->toSubmitStep2; ?>
</div>
<div class="step">
<?php echo $translations->toSubmitStep3; ?>
</div>
</div>
</div>
</div>
</div>