Jump to content

Charter Flight System v1.1.0 (UPDATED!)


iva

  

50 members have voted

  1. 1. What is your opinion on this module?

    • It is really useful and simple
      30
    • A little complicated, but useful
      16
    • Useless and extremely complicated
      4


Recommended Posts

Hello Micheal,

as you said befor :

i think that the problem is: flight type:

why? that field is empty

The problem is that you didn't creat the specific airline named "Charter Flight" with code "CH" , as PARKHO said...

The problem can NOT be any thing else...please check the CODE of your CHARTER airline , it must be only CH ;)

Link to comment
Share on other sites

Hello Micheal,

as you said befor :

The problem is that you didn't creat the specific airline named "Charter Flight" with code "CH" , as PARKHO said...

The problem can NOT be any thing else...please check the CODE of your CHARTER airline , it must be only CH ;)

haha sorry i have CHA.. i change that to CH and its working good! thanks :)

Link to comment
Share on other sites

hello all,

just for additional info...I'm working on supplementary module for CHARTER FLIGHT SYSTEM ,so the pilots must buy the aircraft to fly as charter :rolleyes:

so I just need your idea about this!? B)

yeah sounds good but I think this is more Interesting for small Airlines which simulates (Private Pilot or Executive/VIP) Flight Operations with smaller aircrafts

Link to comment
Share on other sites

how can I change the ops-scheduleform and ops-scheduleeditform to only show the aircraft that are enabled in backend

please include the ability to set the Fare Price manually in the next update how is calculated at the moment?

otherwise its perfect :)

hi, u should do it like this :


                      	 <?php                            
                           foreach($allaircraft as $aircraft)
                               {
                                   if($aircraft->enabled == "1")
                                   {
                                       if($aircraft->registration == $schedule->registration)
                                       {
                                           $sel = 'selected';
                                       }
                                       else
                                       {
                                           $sel = '';
                                       }

                                       echo '<option value="'.$aircraft->id.'" '.$sel.'>'.$aircraft->fullname.'</option>';
                                   }
                               }
                           ?>

Link to comment
Share on other sites

hello all,

just for additional info...I'm working on supplementary module for CHARTER FLIGHT SYSTEM ,so the pilots must buy the aircraft to fly as charter :rolleyes:

I did it and it works perfect for me, no bug , no nothing ;)

but it is realy hard to install!

so it takes some time to translate and make it real simple to install for other webmasters

but i take some shots for you...enjoy...and wait for the module PLEASE :wub:

post-3295-0-73090900-1351130107_thumb.jpg

post-3295-0-49951900-1351130128_thumb.jpg

post-3295-0-94977000-1351130144_thumb.jpg

post-3295-0-08355000-1351130160_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I followed all the instructions and doesn't work . when everything done i've got that :

Parse error: syntax error, unexpected T_PUBLIC in /home/skyteama/public_html/core/common/SchedulesData.class.php on line 1076

Why?

hi,

please check the code below

		 /**
		 * Get the total number of schedules based on criterea for charters
		 *
		 * @param array $params key => value list
		 * @return int Returns the total number
		 *
		 */
		 public static function CountCharterSchedules($icao, $price)
		 { //Count schedules
		 $query = "SELECT * FROM ".TABLE_PREFIX."schedules WHERE price = '".$price."' AND code = '".$icao."'";
						 $results = DB::get_results($query);
						 return DB::num_rows($results);
		 }

you should add the code to your SchedulesData.class.php !

maybe there is something wrong with your database or you did NOT do it correct!

please try again. if you got this error again, send your SchedulesData.class.php file for me ,so i will do it for you ;)

here is my email : datmir@yahoo.com

Link to comment
Share on other sites

  • 1 month later...

HI Thank you for the excellent module

is there any way to allow pilots to erase old charter flights from the system as i know now they have a limit lets say 30 flights so it would be very useful to allow them to erase the flights have already flown

thank you :)

hi,thanks,

you'r right, but i think it's not nessecery when we limit their ability to add charters (limit of 30 charters only!).

they can easily edit their charter flight and change all the fields ,but flightnum B)

best reagrds - R.Farzam

Link to comment
Share on other sites

Iva.

I want to use this module, I can take a doubt?

I have 757 flights, which can generate cheap scales, if I install

Your module will only be able to fly with cheap chaters? this can give problems

in other free flights?

GLO0004.png

hi fernando,

I don't get what u going to say :D

but it might works :

this module just add a new airline to your DB and the pilots will add their own charter flights in the new airline named "charter flight" (code: CH), just it!

your current airline with its own flights will never being crashed or removed or any thing :D

its an additional option for the pilots, it can be a goal for them! trust me :D

  • Like 1
Link to comment
Share on other sites

In the default tpl files that come with this, the bg_cont.png over and under the table does not show up. I am taking a wild guess that this is because the images needs to be in css correct?

For an example, simply visit yoursite.com/index.php/charter

hi,

its the background image, and i think u should replace it with your own website background or change it to a colour or delete it , it's on your own ;)

Link to comment
Share on other sites

hi,

its the background image, and i think u should replace it with your own website background or change it to a colour or delete it , it's on your own ;)

Yeah I agree. I will be making it my own for sure. I appreciate the work you did on this.

I think my main point is, I like to install a module and make sure it works 100% correct before I start tearing apart code. It makes it more fair to the author of said module that I am installing if I need help.

Link to comment
Share on other sites

Iva Perfect.

I'll install the module looks very good, you've shown in your previous post

a system of purchase of these aircraft to fly charter flights.

Please This system is in operation? (aircraft Shop)

GLO0004.png

thx,

actually yes! i've done this in my va.

but it's really treaky...i mixed PILOT SHOP module and CHARTER module to make it happen :D

I'm going to make it more simple...

I'll publish the new version of this module...as soon as i can ;)

I have a problem, when you book the flight the message

No route passed

Iva,

Can you help me?

GLO0004.png

I don't know wy you get this error, i think you have a filter for your bids to check the route...i don't have any idea, mybe you should search other topics

so sorry i couldn't help body

Link to comment
Share on other sites

Problem SOLVED !!!

What line module that can change the number of flights?

# Check flight number

if($this->post->flightnum < 9000 || $this->post->flightnum > 9999)

{

$this->set('message', 'You must choose a number between 9000 to 9999 as the Flight Number!');

$this->render('charter/core_error.tpl');

return;

}

I changed the script above and did not work.

GLO0004.png

Link to comment
Share on other sites

Problem SOLVED !!!

What line module that can change the number of flights?

I changed the script above and did not work.

GLO0004.png

hi,

we have 2 of these checkers in our module file,

one for ADD SCHEDULE (line 820)

the other for EDIT SCHEDULE (line 967)

...

i think you changed the checker for EDIT SCHEDULE and not for ADD SCHEDULE function!

please check this and let me know if the problem solved ;)

Link to comment
Share on other sites

Iva

I changed these lines before its publication here in the forum.

Still requesting the default numbers the system 10001-12000

Check my script Charter.php

<?php
/**
* phpVMS - Virtual Airline Administration Software
* Copyright (c) 2008 Nabeel Shahzad
* For more information, visit www.phpvms.net
* Forums: http://www.phpvms.net/forum
* Documentation: http://www.phpvms.net/docs
*
* phpVMS is licenced under the following license:
* Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
* View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
* @package module_admin_operations
*/
class Charter extends CodonModule
{
public $title = 'Charter Flight System';
public function index()
{
$this->schedules();
}


public function viewmap()
{
if($this->get->type === 'pirep')
{
$data = PIREPData::getReportDetails($this->get->id);
}

elseif($this->get->type === 'schedule')
{
$data = SchedulesData::getScheduleDetailed($this->get->id);
}

elseif($this->get->type === 'preview')
{
$data = new stdClass();

$depicao = OperationsData::getAirportInfo($this->get->depicao);
$arricao = OperationsData::getAirportInfo($this->get->arricao);

$data->deplat = $depicao->lat;
$data->deplng = $depicao->lng;
$data->depname = $depicao->name;

$data->arrlat = $arricao->lat;
$data->arrlng = $arricao->lng;
$data->arrname = $arricao->name;

$data->route = $this->get->route;

unset($depicao);
unset($arricao);

$data->route_details = NavData::parseRoute($data);
}

$this->set('mapdata', $data);
$this->render('route_map.tpl');
}

public function calculatedistance($depicao='', $arricao='')
{
if($depicao == '')
$depicao = $this->get->depicao;

if($arricao == '')
$arricao = $this->get->arricao;

echo OperationsData::getAirportDistance($depicao, $arricao);
}

public function findairport()
{
$results = OperationsData::searchAirport($this->get->term);

if(count($results) > 0)
{
$return = array();

foreach($results as $row)
{
$tmp = array(
 'label' => "{$row->icao} ({$row->name})",
 'value' => $row->icao,
 'id' => $row->id,
);

$return[] = $tmp;
}

echo json_encode($return);
}
}

public function airlines()
{
if(isset($this->post->action))
{
if($this->post->action == 'addairline')
{
$this->add_airline_post();
}
elseif($this->post->action == 'editairline')
{
$this->edit_airline_post();
}
}

$this->set('allairlines', OperationsData::GetAllAirlines());
$this->render('charter/ops_airlineslist.tpl');
}

public function aircraft()
{
/* If they're adding an aircraft, go through this pain
*/
switch($this->post->action)
{
case 'addaircraft':

$this->add_aircraft_post();

break;

case 'editaircraft':

$this->edit_aircraft_post();

break;
}

$this->set('allaircraft', OperationsData::GetAllAircraft());
$this->render('charter/ops_aircraftlist.tpl');
}

public function airports()
{
/* If they're adding an airport, go through this pain
*/
if(isset($this->post->action))
{
switch($this->post->action)
{
case 'addairport':
 $this->add_airport_post();
 break;
case 'editairport':
 $this->edit_airport_post();
 break;
}

return;
}

//$this->set('airports', OperationsData::getAllAirports());
$this->render('charter/ops_airportlist.tpl');
}
public function airportgrid()
{
$page = $this->get->page; // get the requested page
$limit = $this->get->rows; // get how many rows we want to have into the grid
$sidx = $this->get->sidx; // get index row - i.e. user click to sort
$sord = $this->get->sord; // get the direction
if(!$sidx) $sidx =1;

# http://dev.phpvms.net/admin/action.php/operations/
# ?_search=true&nd=1270940867171&rows=20&page=1&sidx=flightnum&sord=asc&searchField=code&searchString=TAY&searchOper=eq

/* Do the search using jqGrid */
$where = array();
if($this->get->_search == 'true')
{
$searchstr = jqgrid::strip($this->get->filters);
$where_string = jqgrid::constructWhere($searchstr);

# Append to our search, add 1=1 since it comes with AND
# from above
$where[] = "1=1 {$where_string}";
}

# Do a search without the limits so we can find how many records
$count = count(OperationsData::findAirport($where));

if($count > 0)
{
$total_pages = ceil($count/$limit);
}
else
{
$total_pages = 0;
}

if ($page > $total_pages)
{
$page = $total_pages;
}

$start = $limit * $page - $limit; // do not put $limit*($page - 1)
if ($start < 0)
{
$start = 0;
}

# And finally do a search with the limits
$airports = OperationsData::findAirport($where, $limit, $start, "{$sidx} {$sord}");
if(!$airports)
{
$airports = array();
}
# Form the json header
$json = array(
'page' => $page,
'total' => $total_pages,
'records' => $count,
'rows' => array()
);

# Add each row to the above array
foreach($airports as $row)
{
if($row->fuelprice == 0)
{
$row->fuelprice = 'Live';
}
$edit = '<a href="#" onclick="editairport(\''.$row->icao.'\'); return false;">Edit</a>';

$tmp = array(
'id' => $row->id,
'cell' => array(
 # Each column, in order
 $row->icao,
 $row->name,
 $row->country,
 $row->fuelprice,
 $row->lat,
 $row->lng,
 $edit,
 ),
 );

$json['rows'][] = $tmp;
}

header("Content-type: text/x-json");
echo json_encode($json);
}

public function addschedule()
{
$this->set('title', 'Add Schedule');
$this->set('action', 'addschedule');
 $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('charter/ops_scheduleform.tpl');
}

public function editschedule()
{
$id = $this->get->id;
$this->set('title', 'Edit Schedule');
$this->set('schedule', SchedulesData::GetSchedule($id));

$this->set('action', 'editschedule');
 $this->set('allairlines', OperationsData::GetAllAirlines());
$this->set('allaircraft', OperationsData::GetAllAircraft());
$this->set('allairports', OperationsData::GetAllAirports());
$this->set('flighttypes', Config::Get('FLIGHT_TYPES'));

$this->render('charter/ops_editscheduleform.tpl');
}

public function activeschedules()
{
$this->schedules('activeschedules');
}

public function inactiveschedules()
{
$this->schedules('inactiveschedules');
}

public function schedulegrid()
{
$page = $this->get->page; // get the requested page
$limit = $this->get->rows; // get how many rows we want to have into the grid
$sidx = $this->get->sidx; // get index row - i.e. user click to sort
$sord = $this->get->sord; // get the direction
if(!$sidx) $sidx =1;

# http://dev.phpvms.net/admin/action.php/operations/
# ?_search=true&nd=1270940867171&rows=20&page=1&sidx=flightnum&sord=asc&searchField=code&searchString=TAY&searchOper=eq

/* Do the search using jqGrid */
$where = array();
if($this->get->_search == 'true')
{
$searchstr = jqgrid::strip($this->get->filters);
$where_string = jqgrid::constructWhere($searchstr);

# Append to our search, add 1=1 since it comes with AND
# from above
$where[] = "1=1 {$where_string}";
}

Config::Set('SCHEDULES_ORDER_BY', "{$sidx} {$sord}");

# Do a search without the limits so we can find how many records
$count = SchedulesData::countSchedules($where);
if($count > 0)
{
$total_pages = ceil($count/$limit);
}
else
{
$total_pages = 0;
}

 if ($page > $total_pages)
 {
$page = $total_pages;
}

$start = $limit * $page - $limit; // do not put $limit*($page - 1)
if ($start < 0)
{
$start = 0;
}

# And finally do a search with the limits
$schedules = SchedulesData::findSchedules($where, $limit, $start);
if(!$schedules)
{
$schedules = array();
}

# Form the json header
$json = array(
'page' => $page,
'total' => $total_pages,
'records' => $count,
'rows' => array()
);

# Add each row to the above array
foreach($schedules as $row)
{
if($row->route != '')
{
$route = '<a href="#" onclick="showroute(\''.$row->id.'\'); return false;">View</a>';
}
else
{
$route = '-';
}

$edit = '<a href="../Meus documentos/Downloads/Nova pasta/core/modules/Charter/'.url('/operations/editschedule?id='.$row->id).'">Edit</a>';
$delete = '<a href="#" onclick="deleteschedule('.$row->id.'); return false;">Delete</a>';

$tmp = array(
'id' => $row->id,
'cell' => array(
 # Each column, in order
 $row->code,
 $row->flightnum,
 $row->depicao,
 $row->arricao,
 $row->aircraft,
 $row->registration,
 $route,
 Util::GetDaysCompact($row->daysofweek),
 $row->distance,
 $row->timesflown,
 $edit,
 $delete,
),
);

$json['rows'][] = $tmp;
}

header("Content-type: text/x-json");
echo json_encode($json);
}

public function schedules($type='activeschedules')
{
/* These are loaded in popup box */
if($this->get->action == 'viewroute')
{
$id = $this->get->id;
return;
}
if($this->get->action == 'filter')
{
$this->set('title', 'Filtered Schedules');

if($this->get->type == 'flightnum')
{
$params = array('s.flightnum' => $this->get->query);
}
elseif($this->get->type == 'code')
{
$params = array('s.code' => $this->get->query);
}
elseif($this->get->type == 'aircraft')
{
$params = array('a.name' => $this->get->query);
}
elseif($this->get->type == 'depapt')
{
$params = array('s.depicao' => $this->get->query);
}
elseif($this->get->type == 'arrapt')
{
$params = array('s.arricao' => $this->get->query);
}
elseif($this->get->price == 'price')
{
$params = array('s.price' => $this->get->query);
}

// Filter or don't filter enabled/disabled flights
if(isset($this->get->enabled) && $this->get->enabled != 'all')
{
$params['s.enabled'] = $this->get->enabled;
}

$this->set('schedules', SchedulesData::findSchedules($params));
$this->render('charter/ops_schedules.tpl');
return;
}

switch($this->post->action)
{
case 'addschedule':
$this->add_schedule_post();
break;

case 'editschedule':
$this->edit_schedule_post();
break;

case 'deleteschedule':
$this->delete_schedule_post();
return;
break;
}

if(!isset($this->get->start) || $this->get->start == '')
{
$this->get->start = 0;
}

$num_per_page = 1000;
$start = $num_per_page * $this->get->start;

if($type == 'schedules' || $type == 'activeschedules')
{
$params = array('s.enabled' => 1);
$schedules = SchedulesData::findSchedules($params, $num_per_page, $start);

$this->set('title', 'Viewing Active Schedules');
$this->set('schedules', $schedules);

if(count($schedules) >= $num_per_page)
{
$this->set('paginate', true);
$this->set('start', $this->get->start+1);

if($this->get->start - 1 > 0)
{
 $prev = $this->get->start - 1;
 if($prev == '')
 $prev = 0;

 $this->set('prev', intval($prev));
}
}
}
else
{
$this->set('title', 'Viewing Inactive Schedules');
$this->set('schedules', SchedulesData::findSchedules(array('s.enabled'=>0)));
}

$this->render('charter/ops_schedules.tpl');
}

protected function add_airline_post()
{
$this->post->code = strtoupper($this->post->code);

if($this->post->code == '' || $this->post->name == '')
{
$this->set('message', 'You must fill out all of the fields');
$this->render('charter/core_error.tpl');
return;
}

if(OperationsData::GetAirlineByCode($this->post->code))
{
$this->set('message', 'An airline with this code already exists!');
$this->render('charter/core_error.tpl');
return;
}

OperationsData::AddAirline($this->post->code, $this->post->name);

if(DB::errno() != 0)
{
if(DB::errno() == 1062) // Duplicate entry
$this->set('message', 'This airline has already been added');
else
$this->set('message', 'There was an error adding the airline');
	 $this->render('charter/core_error.tpl');
return;
}
$this->set('message', 'Added the airline "'.$this->post->code.' - '.$this->post->name.'"');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Added the airline "'.$this->post->code.' - '.$this->post->name.'"');
}

protected function edit_airline_post()
{
$this->post->code = strtoupper($this->post->code);

if($this->post->code == '' || $this->post->name == '')
{
$this->set('message', 'Code and name cannot be blank');
$this->render('charter/core_error.tpl');
}

$prevairline = OperationsData::GetAirlineByCode($this->post->code);
if($prevairline && $prevairline->id != $this->post->id)
{
$this->set('message', 'This airline with this code already exists!');
$this->render('charter/core_error.tpl');
return;
}

if(isset($this->post->enabled))
$enabled = true;
else
$enabled = false;

OperationsData::EditAirline($this->post->id, $this->post->code, $this->post->name, $enabled);

if(DB::errno() != 0)
{
$this->set('message', 'There was an error editing the airline');
$this->render('charter/core_error.tpl');
return false;
}
$this->set('message', 'Edited the airline "'.$this->post->code.' - '.$this->post->name.'"');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Edited the airline "'.$this->post->code.' - '.$this->post->name.'"');
}

protected function add_aircraft_post()
{
if($this->post->icao == '' || $this->post->name == ''
|| $this->post->fullname == ''
|| $this->post->registration == '')
{
$this->set('message', 'You must enter the ICAO, name, full name and the registration.');
$this->render('charter/core_error.tpl');
return;
}

if($this->post->enabled == '1')
$this->post->enabled = true;
else
$this->post->enabled = false;

# Check aircraft registration, make sure it's not a duplicate

$ac = OperationsData::GetAircraftByReg($this->post->registration);
if($ac)
{
$this->set('message', 'The aircraft registration must be unique');
$this->render('charter/core_error.tpl');
return;
}

$data = array(
'icao'=>$this->post->icao,
'name'=>$this->post->name,
'fullname'=>$this->post->fullname,
'registration'=>$this->post->registration,
'downloadlink'=>$this->post->downloadlink,
'imagelink'=>$this->post->imagelink,
'range'=>$this->post->range,
'weight'=>$this->post->weight,
'cruise'=>$this->post->cruise,
'maxpax'=>$this->post->maxpax,
'maxcargo'=>$this->post->maxcargo,
'minrank'=>$this->post->minrank,
'enabled'=>$this->post->enabled
);

OperationsData::AddAircaft($data);

if(DB::errno() != 0)
{
if(DB::$errno == 1062) // Duplicate entry
$this->set('message', 'This aircraft already exists');
else
$this->set('message', 'There was an error adding the aircraft');
$this->render('charter/core_error.tpl');
return false;
}
$this->set('message', 'The aircraft has been added');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Added the aircraft "'.$this->post->name.' - '.$this->post->registration.'"');
}

protected function edit_aircraft_post()
{
if($this->post->id == '')
{
$this->set('message', 'Invalid ID specified');
$this->render('charter/core_error.tpl');
return;
}

if($this->post->icao == '' || $this->post->name == ''
|| $this->post->fullname == '' || $this->post->registration == '')
{
$this->set('message', 'You must enter the ICAO, name, full name, and registration');
$this->render('charter/core_error.tpl');
return;
}

$ac = OperationsData::CheckRegDupe($this->post->id, $this->post->registration);
if($ac)
{
$this->set('message', 'This registration is already assigned to another active aircraft');
$this->render('charter/core_error.tpl');
return;
}

if($this->post->enabled == '1')
$this->post->enabled = true;
else
$this->post->enabled = false;

$data = array(
'id' => $this->post->id,
'icao'=>$this->post->icao,
'name'=>$this->post->name,
'fullname'=>$this->post->fullname,
'registration'=>$this->post->registration,
'downloadlink'=>$this->post->downloadlink,
'imagelink'=>$this->post->imagelink,
'range'=>$this->post->range,
'weight'=>$this->post->weight,
'cruise'=>$this->post->cruise,
'maxpax'=>$this->post->maxpax,
'maxcargo'=>$this->post->maxcargo,
'minrank'=>$this->post->minrank,
'enabled'=>$this->post->enabled
);

OperationsData::EditAircraft($data);

if(DB::errno() != 0)
{
$this->set('message', 'There was an error editing the aircraft');
	 $this->render('charter/core_error.tpl');
return;
}

LogData::addLog(Auth::$userinfo->pilotid, 'Edited the aircraft "'.$this->post->name.' - '.$this->post->registration.'"');
$this->set('message', 'The aircraft "'.$this->post->registration.'" has been edited');
$this->render('charter/core_success.tpl');
}

protected function add_airport_post()
{

if($this->post->icao == '' || $this->post->name == ''
|| $this->post->country == ''
|| $this->post->lat == '' || $this->post->lng == '')
{
$this->set('message', 'Some fields were blank!');
$this->render('charter/core_error.tpl');
return;
}
if($this->post->hub == 'true')
$this->post->hub = true;
else
$this->post->hub = false;

$data = array(
'icao' => $this->post->icao,
'name' => $this->post->name,
'country' => $this->post->country,
'lat' => $this->post->lat,
'lng' => $this->post->lng,
'hub' => $this->post->hub,
'chartlink' => $this->post->chartlink,
'fuelprice' => $this->post->fuelprice
);

OperationsData::AddAirport($data);

if(DB::errno() != 0)
{
if(DB::$errno == 1062) // Duplicate entry
$this->set('message', 'This airport has already been added');
else
$this->set('message', 'There was an error adding the airport');
$this->render('charter/core_error.tpl');
return;
}
/*$this->set('message', 'The airport has been added');
$this->render('charter/core_success.tpl');*/

LogData::addLog(Auth::$userinfo->pilotid, 'Added the airport "'.$this->post->icao.' - '.$this->post->name.'"');
}
protected function edit_airport_post()
{
if($this->post->icao == '' || $this->post->name == ''
|| $this->post->country == '' || $this->post->lat == '' || $this->post->lng == '')
{
$this->set('message', 'Some fields were blank!');
$this->render('core_message.tpl');
return;
}
if($this->post->hub == 'true')
$this->post->hub = true;
else
$this->post->hub = false;


$data = array(
'icao' => $this->post->icao,
'name' => $this->post->name,
'country' => $this->post->country,
'lat' => $this->post->lat,
'lng' => $this->post->lng,
'hub' => $this->post->hub,
'chartlink' => $this->post->chartlink,
'fuelprice' => $this->post->fuelprice
);
OperationsData::EditAirport($data);

if(DB::errno() != 0)
{
$this->set('message', 'There was an error adding the airport: '.DB::$error);
$this->render('charter/core_error.tpl');
return;
}
$this->set('message', $icao . ' has been edited');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Edited the airport "'.$this->post->icao.' - '.$this->post->name.'"');
}

protected function add_schedule_post()
{
if($this->post->code == '' || $this->post->flightnum == ''
|| $this->post->deptime == '' || $this->post->arrtime == ''
|| $this->post->depicao == '' || $this->post->arricao == ''
|| $this->post->price == '')
{
$this->set('message', 'Some required fields were blank!');
$this->render('charter/core_error.tpl');

return;
}

# Check if the schedule exists
$sched = SchedulesData::getScheduleByFlight($this->post->code, $this->post->flightnum);
if(is_object($sched))
{
$this->set('message', 'This flight number is already exist!');
$this->render('charter/core_error.tpl');

return;
}


# Check flight number
if($this->post->flightnum < 9000 || $this->post->flightnum > 9999)
{
$this->set('message', 'You must choose a number between 9000 to 9999 as the Flight Number!');
$this->render('charter/core_error.tpl');

return;
}
# Check tour flight!
if($this->post->depicao == $this->post->arricao)
{
$this->set('message', 'Departure airport and Arrival airport must be different!');
$this->render('charter/core_error.tpl');

return;
}
# Check departure airport
if(strlen($this->post->depicao) < 4 || strlen($this->post->depicao) > 4)
{
$this->set('message', 'Departure airport is not valid! check the ICAO CODE!');
$this->render('charter/core_error.tpl');

return;
}
# Check arrival airport
if(strlen($this->post->arricao) < 4 || strlen($this->post->arricao) > 4)
{
$this->set('message', 'Arrival airport is not valid! check the ICAO CODE!');
$this->render('charter/core_error.tpl');

return;
}

# Check pilot id
$pilotid = Auth::$userinfo->pilotid;
if($this->post->price != $pilotid)
{
$this->set('Your ID is not valid!');
$this->render('charter/core_error.tpl');

return;
}

$enabled = ($this->post->enabled == 'on') ? true : false;

# Check the distance
if($this->post->distance == '' || $this->post->distance == 0)
{
$this->post->distance = OperationsData::getAirportDistance($this->post->depicao, $this->post->arricao);
}

# Format the flight level
$this->post->flightlevel = str_replace(',', '', $this->post->flightlevel);
$this->post->flightlevel = str_replace(' ', '', $this->post->flightlevel);
$this->post->route = strtoupper($this->post->route);
$this->post->route = str_replace($this->post->depicao, '', $this->post->route);
$this->post->route = str_replace($this->post->arricao, '', $this->post->route);
$this->post->route = str_replace('SID', '', $this->post->route);
$this->post->route = str_replace('STAR', '', $this->post->route);

$data = array( 'code'=>$this->post->code,
 'flightnum'=>$this->post->flightnum,
 'depicao'=>$this->post->depicao,
 'arricao'=>$this->post->arricao,
 'route'=>$this->post->route,
 'aircraft'=>$this->post->aircraft,
 'flightlevel'=>$this->post->flightlevel,
 'distance'=>$this->post->distance,
 'deptime'=>$this->post->deptime,
 'arrtime'=>$this->post->arrtime,
 'flighttime'=>$this->post->flighttime,
 'price'=>$this->post->price,
 'flighttype'=>$this->post->flighttype,
 'notes'=>$this->post->notes,
 'enabled'=>$enabled);

# Add it in
$ret = SchedulesData::AddSchedule($data);

if(DB::errno() != 0 && $ret == false)
{
	 $this->set('message', 'There was an error adding the schedule, already exists DB error: '.DB::error());
$this->render('charter/core_error.tpl');
return;
}

 $this->set('message', 'The flight "'.$this->post->code.$this->post->flightnum.'" was successfully added to your list.');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Added schedule "'.$this->post->code.$this->post->flightnum.'"');
}
protected function edit_schedule_post()
{
if($this->post->code == '' || $this->post->flightnum == ''
|| $this->post->deptime == '' || $this->post->arrtime == ''
|| $this->post->depicao == '' || $this->post->arricao == '')
{
$this->set('message', 'Some required fields were blank!');
$this->render('charter/core_error.tpl');

return;
}

$enabled = ($this->post->enabled == 'on') ? true : false;
$this->post->route = strtoupper($this->post->route);

# Format the flight level
$this->post->flightlevel = str_replace(',', '', $this->post->flightlevel);
$this->post->flightlevel = str_replace(' ', '', $this->post->flightlevel);

# Clear anything invalid out of the route
$this->post->route = strtoupper($this->post->route);
$this->post->route = str_replace($this->post->depicao, '', $this->post->route);
$this->post->route = str_replace($this->post->arricao, '', $this->post->route);
$this->post->route = str_replace('SID', '', $this->post->route);
$this->post->route = str_replace('STAR', '', $this->post->route);

$data = array( 'code'=>$this->post->code,
 'flightnum'=>$this->post->flightnum,
 'depicao'=>$this->post->depicao,
 'arricao'=>$this->post->arricao,
 'route'=>$this->post->route,
 'aircraft'=>$this->post->aircraft,
 'flightlevel'=>$this->post->flightlevel,
 'distance'=>$this->post->distance,
 'deptime'=>$this->post->deptime,
 'arrtime'=>$this->post->arrtime,
 'flighttime'=>$this->post->flighttime,
 'price'=>$this->post->price,
 'flighttype'=>$this->post->flighttype,
 'notes'=>$this->post->notes,
 'enabled'=>$enabled);

$val = SchedulesData::editScheduleFields($this->post->id, $data);
if(!$val)
{
$this->set('message', 'There was an error editing the schedule: '.DB::error());
$this->render('charter/core_error.tpl');
return;
}


# Check flight number
if($this->post->flightnum < 9000 || $this->post->flightnum > 9999)
{
$this->set('message', 'You must choose a number between 9000 to 9999 as the Flight Number!');
$this->render('charter/core_error.tpl');

return;
}
# Check tour flight!
if($this->post->depicao == $this->post->arricao)
{
$this->set('message', 'Departure airport and Arrival airport must be different!');
$this->render('charter/core_error.tpl');

return;
}
# Check departure airport
if(strlen($this->post->depicao) < 4 || strlen($this->post->depicao) > 4)
{
$this->set('message', 'Departure airport is not valid! check the ICAO CODE!');
$this->render('charter/core_error.tpl');

return;
}
# Check arrival airport
if(strlen($this->post->arricao) < 4 || strlen($this->post->arricao) > 4)
{
$this->set('message', 'Arrival airport is not valid! check the ICAO CODE!');
$this->render('charter/core_error.tpl');

return;
}

# Check pilot id
$pilotid = Auth::$userinfo->pilotid;
if($this->post->price != $pilotid)
{
$this->set('Your ID is not valid!');
$this->render('charter/core_error.tpl');

return;
}


# Parse the route:
SchedulesData::getRouteDetails($this->post->id, $this->post->route);

$this->set('message', 'The flight "'.$this->post->code.$this->post->flightnum.'" was successfully edited!');
$this->render('charter/core_success.tpl');

LogData::addLog(Auth::$userinfo->pilotid, 'Edited schedule "'.$this->post->code.$this->post->flightnum.'"');
}
protected function delete_schedule_post()
{
$schedule = SchedulesData::findSchedules(array('s.id'=>$this->post->id));
SchedulesData::DeleteSchedule($this->post->id);

$params = array();
 if(DB::errno() != 0)
{
$params['status'] = 'There was an error deleting the schedule';
$params['error'] = DB::error();
echo json_encode($params);
return;
}
$params['status'] = 'ok';
echo json_encode($params);

LogData::addLog(Auth::$userinfo->pilotid, 'Deleted schedule "'.$schedule->code.$schedule->flightnum.'"');
}
}

GLO0004.png

Link to comment
Share on other sites

Iva

I changed these lines before its publication here in the forum.

Still requesting the default numbers the system 10001-12000

Check my script Charter.php

ok, you did it right as i said before,

so what do you mean : Still requesting the default numbers the system 10001-12000 !?

you mean you get ERROR when you add a charter with for example with the number 9001 ??

or you refer to the tip in add schedule form .tpl ?

there is the tip (help note) in the .tpl of add schedule form you should change it manually

Link to comment
Share on other sites

Hi,

I followed all the instructions and doesn't work . when everything done i've got that :

Parse error: syntax error, unexpected T_PUBLIC in /home/skyteama/public_html/core/common/SchedulesData.class.php on line 1076

Why?

I found the problem :D (I do the same error here kkkk)

Be careful when editing the SchedulesData.class.php on the last line we have a ¨} ¨ place the code before it.

The original:

/**
 * Search schedules by the equipment type
 *
 * @deprecated
 */
/*public static function getSchedulesByEquip($ac, $onlyenabled = true, $start='', $limit='')
{
 $params = array('a.name' => $ac);
 if($onlyenabled)
  $params['s.enabled'] = '1';

 return self::findSchedules($params, $limit, $start);
}*/
}

The new one will be like this:

/**
 * Search schedules by the equipment type
 *
 * @deprecated
 */
/*public static function getSchedulesByEquip($ac, $onlyenabled = true, $start='', $limit='')
{
 $params = array('a.name' => $ac);
 if($onlyenabled)
  $params['s.enabled'] = '1';

 return self::findSchedules($params, $limit, $start);
}*/
/**
 * Get the total number of schedules based on criterea for charters
 *
 * @param array $params key => value list
 * @return int Returns the total number
 *
 */
public static function CountCharterSchedules($icao, $price)
{ //Count schedules
$query = "SELECT * FROM ".TABLE_PREFIX."schedules WHERE price = '".$price."' AND code = '".$icao."'";
 $results = DB::get_results($query);
 return DB::num_rows($results);
}
}

  • Like 1
Link to comment
Share on other sites

Hi I was wondering about the pilot ID.

For example, in my airline, my PID is 1102

In the charter system it says my ID is 1

Now clearly that is wrong as 1 is not my PID but it is actually 1102

Is this an issue or the way the system is designed to operate?

hi, dont worry about it!

it's OK. actually at the first ,when u creat an account as CEO for your VA, your ID is 0001.

bytheway, there's no matter with the PILOT ID! it can be any thing! but if you creat an charter flight with a Pilot ID , the ID should NOT be change! just it ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...