atcApply_form.php
11.1 KB
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
session_start();
require_once 'classes/realops.php';
$get = new Get();
$stats = new Stats();
$set = new Set();
date_default_timezone_set('Australia/Sydney');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'sections/header.php'; ?>
</head>
<body>
<div class="wrapper">
<?php include 'sections/navbar.php' ?>
<div class="container" id="realops-container">
<div class="row">
<article class="col-sm-12 panel panel-default" id="realops-body">
<div class="page-header">
<h2>ATC Application Form</h2>
</div>
<?php if(isset($_POST['firstName']) && !$get->isATC($_SESSION['vatsimID']))
{
$set->atcApplication($_SESSION['vatsimID'], $_POST['firstName'], $_POST['lastName'], $_POST['email'], $_POST['rating'], $_POST['position1'], $_POST['position2'], $_POST['position3'], serialize($_POST['shifts']))
?>
<div class="alert alert-success" role="alert"><strong>Success! </strong>Your application has been submitted and in the queue.</div>
<a href="index.php" class="btn btn-info">Go Home</a>
<?php
}
else if($get->isATC($_SESSION['vatsimID']))
{
?>
<div class="alert alert-success" role="alert"><strong>Success! </strong>Your application has been submitted and in the queue.</div>
<a href="index.php" class="btn btn-info">Go Home</a>
<?php
}
else if($_GET['failed'] == 1)
{ ?>
<div class="alert alert-danger" role="alert"><strong>Failed. </strong>Please try again.</div>
<?php
}
else if(empty($_SESSION['firstName']))
{ ?>
<h2>You must be logged in to apply for ATC</h2>
<a href="sso/index.php?redirect=/slots.php" class="btn btn-success loginButton" id="2" data-toggle="modal" data-target="#realops-login-info">Login to Apply</a>
<?php }
else
{ ?>
<form id="defaultForm" method="post" action="atcApply.php?success=1" class="form-horizontal" >
<p class="help-block"> Your name, email address and ATC rating have been pre-populated with information from VATSIM. If any of this information is incorrect, please submit your application and <a href="contact.php">contact us with the correct details</a></p>
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>
<div class="col-sm-4">
<input type="text" readonly class="form-control" name="firstName" placeholder="First name" value="<?php echo $_SESSION['firstName'] ?>" />
</div>
<div class="col-sm-4">
<input type="text" readonly class="form-control" name="lastName" placeholder="Last name" value="<?php echo $_SESSION['lastName'] ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Email Address</label>
<div class="col-sm-5">
<input type="text" readonly class="form-control" name="email" value="<?php echo $_SESSION['email']; ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Controller Rating</label>
<div class="col-sm-5">
<input type="text" readonly class="form-control" name="rating" value="<?php echo $_SESSION['rating'] ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Preferred ATC Position 1:</label>
<div class="col-sm-5">
<select name="position1" class="form-control">
<option disabled selected>Please choose...</option>
<option value="TWR">SY TWR (DEL, GND, TWR)</option>
<option value="TMA">SY TMA (APP, DEP)</option>
<option value="ENR">Enroute (CTR)</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Preferred ATC Position 2:</label>
<div class="col-sm-5">
<select name="position2" class="form-control">
<option disabled selected>Please choose...</option>
<option value="TWR">SY TWR (DEL, GND, TWR)</option>
<option value="TMA">SY TMA (APP, DEP)</option>
<option value="ENR">Enroute (CTR)</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Preferred ATC Position 3:</label>
<div class="col-sm-5">
<select name="position3" class="form-control">
<option disabled selected>Please choose...</option>
<option value="TWR">SY TWR (DEL, GND, TWR)</option>
<option value="TMA">SY TMA (APP, DEP)</option>
<option value="ENR">Enroute (CTR)</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Shift Availability:</label>
<div class="col-sm-5">
<div class="checkbox">
<label>
<input type="checkbox" name="shifts[]" value="04">0400z-0600z
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="shifts[]" value="06">0600z-0800z
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="shifts[]" value="08">0800z-1000z
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="shifts[]" value="10"> 1000z-1200z
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" id="captchaOperation"></label>
<div class="col-sm-2">
<input type="text" class="form-control" name="captcha" />
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
<button type="submit" class="btn btn-primary" name="signup" value="Sign up">Submit Application</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
</article>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.wrapper -->
<?php include 'sections/footer.php'; ?>
<script type="text/javascript">
$(document).ready(function() {
// Generate a simple captcha
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
};
$('#captchaOperation').html([randomNumber(1, 10), '+', randomNumber(1, 10), '='].join(' '));
$('#defaultForm').formValidation({
message: 'This value is not valid',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
firstName: {
row: '.col-sm-4',
validators: {
notEmpty: {
message: 'The first name is required'
}
}
},
lastName: {
row: '.col-sm-4',
validators: {
notEmpty: {
message: 'The last name is required'
}
}
},
rating: {
message: 'The rating is not valid',
validators: {
notEmpty: {
message: 'The rating is required'
}
}
},
position1: {
message: 'The position 1 is not valid',
validators: {
notEmpty: {
message: 'You must select a position'
}
}
},
'shifts[]': {
validators: {
choice: {
min: 1,
message: 'Please choose more than 1 shift'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email address is required'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
},
captcha: {
validators: {
callback: {
message: 'Wrong answer',
callback: function(value, validator, $field) {
var items = $('#captchaOperation').html().split(' '), sum = parseInt(items[0]) + parseInt(items[2]);
return value == sum;
}
}
}
}
}
});
});
</script>