I have made a few changes:
core/modules/RouteSubmit/RouteSubmit.php: First of all, the "RouteSubmit.php" file should be placed in a folder titled "RouteSubmit" under the modules section. Replaces its contents with the following:
<?php
class RouteSubmit extends CodonModule {
public $title = "RouteSubmit Request";
public function index() {
if (!Auth::LoggedIn()) {
$this->set('error', 'You are not logged in.');
$this->show('core_error');
} else {
$this->set('allairlines', OperationsData::GetAllAirlines());
$this->set('allaircraft', OperationsData::GetAllAircraft());
$this->set('allairports', OperationsData::GetAllAirports());
//$this->set('airport_json_list', OperationsData::getAllAirportsJSON());
$this->set('flighttypes', Config::Get('FLIGHT_TYPES'));
$this->render('routesubmit/routesubmit_index');
}
}
public function submit() {
if ($this->post->arr == '') {
$this->set('error', 'You haven\'t specified a reason for your leaeve of absence.');
$this->render('routesubmit/routesubmit_error');
$this->render('routesubmit/routesubmit_index');
} else {
$this->sendmail($data);
}
}
protected function sendmail($data)
{
// Form arrays
$name = $this->post->name;
$from = $this->post->email;
$depp = $this->post->depp;
$arr = $this->post->arr;
$route = $this->post->route;
$aircraft = $this->post->Aircraft;
$fl = $this->post->fl;
$dtime = $this->post->dtime;
$atime = $this->post->atime;
$ftime = $this->post->ftime;
// Send email to admin
$subject_admin = SITE_NAME.' A pilot has submitted a Route Request';
$email_admin = 'your_email_or_ADMIN_EMAIL';
$message = "From: $name | $from \n
Departure: $depp \n
Arrival: $arr \n
Route: $route \n
Aircraft: $aircraft \n
Flight level: $fl \n
Departure time: $dtime \n
Arrival time: $atime \n
Flight time: $ftime \n
Essa mensagem automatica, por favor não responder";
if ($_POST['submit']) {
Util::SendEmail($email_admin, $subject_admin, $message);
// Show the template
$this->render('routesubmit/routesubmit_submitted');
}
}
}
Also, put the template files within a "routesubmit" folder too within the core/templates folder. Also, update the routesubmit_index.php file with this:
<?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?>
<body class="hold-transition login-page" style="background-color: #222222;">
<form action="<?php echo url('/routesubmit/submit');?>" method="post">
<div class="login-box">
<div class="login-logo">
<a href="" style="color: white;">Route<b>Submit</b></a>
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg" style="font-size: 13px;">Please complete this form to send your route.</p>
<form method="post" action="<?php echo url('/routesubmit/submit');?>">
<div class="form-group" align="center">
<tr>
<td><strong>Name:</strong></td>
<td>
<?php
if(Auth::LoggedIn())
{
echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname;
echo '<input type="hidden" name="name"
value="'.Auth::$userinfo->firstname
.' '.Auth::$userinfo->lastname.'" />';
} else {
?>
<input type="text" name="name" value="" />
<?php
}
?>
</td>
</tr>
</div>
<div class="form-group" align="center">
<tr>
<td width="1%" nowrap><strong>Endereço de E-mail:</strong></td>
<td>
<?php
if(Auth::LoggedIn())
{
echo Auth::$userinfo->email;
echo '<input type="hidden" name="name"
value="'.Auth::$userinfo->email.'" />';
} else {
?>
<input type="text" name="email" value="" />
<?php
}
?>
</td>
</tr>
</div>
<div class="form-group">
<input type="text" name="depp" class="form-control" value="<?php echo Vars::POST('lastname');?>" placeholder="Departure ICAO">
<?php
if($departure_error == true)
echo '<p class="error">Please enter your departure ICAO</p>';
?>
</div>
<div class="form-group">
<input type="text" name="arr" class="form-control" placeholder="Arrival ICAO">
<?php
if($arrival_error == true)
echo '<p class="error">Please enter your arrival ICAO</p>';
?>
</div>
<div class="form-group">
<input type="text" name="route" class="form-control" placeholder="Route">
<?php
if($route_error == true)
echo '<p class="error">Please enter your route</p>';
?>
</div>
<div class="form-group">
<select name="Aircraft" class="form-control">
<option value=" ">Select your aircraft</option>
<option value="2">Airbus</option>
<option>Airbus A318-111</option>
<option>Airbus A319-111</option>
<option>Airbus A320-211</option>
<option>Airbus A321-211</option>
<option value="2">Boeing</option>
<option>Boeing 737-800/W</option>
<option>Boeing 737-900/W</option>
<option>Boeing 747-400</option>
<option>Boeing 747-400F</option>
<option>Boeing 747-800I</option>
<option>Boeing 757-200</option>
<option>Boeing 767-300</option>
<option>Boeing 777-200LR</option>
<option>Boeing 777-300ER</option>
<option>Boeing 777-200F</option>
<option value="3">De Havilland</option>
<option>DHC-8-400</option>
<option value="4">McDonnell Douglas</option>
<option>MD-11</option>
<option>MD-11F</option>
</select>
<?php
if($aircraft_error == true)
echo '<p class="error">Please enter your aircraft</p>';
?>
</div>
<div class="form-group">
<input type="text" name="fl" class="form-control" placeholder="Flight level">
<?php
if($flightlevel_error == true)
echo '<p class="error">Please enter your flight level</p>';
?>
</div>
<div class="form-group">
<input type="text" name="dtime" class="form-control" placeholder="Departure Time">
<?php
if($departuretime_error == true)
echo '<p class="error">Please enter your departure time</p>';
?>
</div>
<div class="form-group">
<input type="text" name="atime" class="form-control" placeholder="Arrival Time">
<?php
if($arrivaltime_error == true)
echo '<p class="error">Please enter your arrival time</p>';
?>
</div>
<div class="form-group">
<input type="text" name="ftime" class="form-control" placeholder="Flight Time">
<?php
if($flighttime_error == true)
echo '<p class="error">Please enter your flight time</p>';
?>
</div>
<input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" />
<input id="submit" type="submit" class="btn btn-success" class="btn btn-primary btn-block btn-flat" name="submit" value='Submit Route'>
</td>
<!-- /.col -->
</tr>
</form>
</div>
<!-- /.login-box-body -->
</div>
<!-- /.login-box -->
Copyright © <?php echo date(Y); ?> CCBS Virtual Airlines - All Rights Reserved
<!-- iCheck -->
<script src="<?php echo SITE_URL?>/lib/skins/crewcenter/plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
});
</script>
It worked in my localhost server (do not comment the values ):
Let us know in case you have any issues.