Jump to content

Charter Flight System v1.1.0 (UPDATED!)


  

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

Posted

Hi great module thanks. Just one thing I have been trying to change the blue background to 600px wide as it goes over my side aera. Can you tell me what I need to change thank you.

Alan

Posted

Sorted it. I had to change one of the images to a smaller size.

Still not having any luck with this. I have tried changing the WIDTH in the .tpl files but nothing happens

Hi great module thanks. Just one thing I have been trying to change the blue background to 600px wide as it goes over my side aera. Can you tell me what I need to change thank you.

Alan

hi , sorry for delay responding your reply!

thanks, it's kind of you.

to do so...

if you want to change the background or any graphic! you don't need to change the .tpl file. just make your own image in any size you want and replace it with the name of current graphic item. just keep its own name as it is!

just in one case you need to edit .tpl file! just if you want to changethe address of the graphics on your local host server.

hope it works

  • 2 weeks later...
Posted

I'm getting this error can someone please help me.

Parse error: syntax error, unexpected T_PUBLIC in /home/caribbea/public_html/en/core/common/SchedulesData.class.php on line 1077

Posted

I'm getting this error can someone please help me.

Parse error: syntax error, unexpected T_PUBLIC in /home/caribbea/public_html/en/core/common/SchedulesData.class.php on line 1077

hi ,

thanks for using this module.

this error is already reports and solved in this topic.its not a big problem ,you just miss some codes or you added theme in the wrong place.

please read the issues that other users report here.

you will fix this and also tou will get much info about this module.

by the way the manual is completely explain everything.

please follow the instructions step by step.

best regards

  • 6 months later...
Posted

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:

i have a question, when is it done? that pilots can buy a charter plane?

  • 9 months later...
  • Administrators
Posted

I dont have "SchedulesData.class" ??

You should have it in the /core/common/ folder, this base file is part of the standard phpVMS package.

Posted

Hi,

I've installed this and got it all set up, but at /index.php/charter I just get this?

charterflightsystem-fq3sm7.png

I have set the required hours to 0, as I want this to be the primary system for pilots reporting their flights, rather than having a schedule. Any thoughts as to what I might be missing?

Posted (edited)

I have installed everything and when i had:

  /**
			 * 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);
			}

to my schedulesdata.class my site is all messed up??

Edited by servetas
put the part of code inside code brackets in order to be easily readable.
Posted
<?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/
*/

class SchedulesData extends CodonData
{ 

/**
* A generic find function for schedules. As parameters, do:
* 
* $params = array( 's.depicao' => 'value',
* 's.arricao' => array ('multiple', 'values'),
* );
* 
* Syntax is ('s.columnname' => 'value'), where value can be
* an array is multiple values, or with a SQL wildcard (%) 
*  if that's what is desired.
* 
* Columns from the schedules table should be prefixed by 's.',
* the aircraft table as 'a.'
* 
* You can also pass offsets ($start and $count) in order to 
* facilitate pagination
* 
* @tutorial http://docs.phpvms.net/media/development/searching_and_retriving_schedules
*/
public static function findSchedules($params, $count = '', $start = '')
{
$sql = 'SELECT s.*, 
a.id as aircraftid, a.name as aircraft, a.registration,
a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel,
dep.name as depname, dep.lat AS deplat, dep.lng AS deplng,
arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng
FROM '.TABLE_PREFIX.'schedules AS s
LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao
LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao
LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft ';

/* Build the select "WHERE" based on the columns passed, this is a generic function */
$sql .= DB::build_where($params);

// Order matters
if(Config::Get('SCHEDULES_ORDER_BY') != '')
{
$sql .= ' ORDER BY '.Config::Get('SCHEDULES_ORDER_BY');
}

if(strlen($count) != 0)
{
$sql .= ' LIMIT '.$count;
}

if(strlen($start) != 0)
{
$sql .= ' OFFSET '. $start;
}

$ret = DB::get_results($sql);
return $ret;
}


/**
* Get the total number of schedules based on criterea
*
* @param array $params key => value list
* @return int Returns the total number
*
*/
public static function countSchedules($params)
{
$sql = 'SELECT COUNT(s.id) as total
FROM '.TABLE_PREFIX.'schedules AS s
LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao
LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao
LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft ';

$sql .= DB::build_where($params);
$res = DB::get_row($sql);

return $res->total;
}

/**
* Return information about a schedule (pass the ID)
*/
public static function getSchedule($id)
{
return self::getScheduleDetailed($id);
}


/**
* Return a flight given the airline code and flight number
*
* @deprecated
* 
* @param string $code Airline code
* @param mixed $flightnum Flight number
* @return array Returns a full flight
*
*/
public static function getScheduleByFlight($code, $flightnum)
{
$params = array(
's.code' => strtoupper($code),
's.flightnum' => strtoupper($flightnum),
);

$schedule = self::findSchedules($params);
return $schedule[0];
}


/**
* Find a flight on the flightnumber and departure airport
*
* @param string $flightnum Flight numbers
* @param string $depicao Departure airport
* @return array Returns one flight
*
*/
public static function findFlight($flightnum, $depicao='')
{
$params = array('s.flightnum' => strtoupper($flightnum));

if($depicao != '')
{
$params['s.depicao'] = $depicao;
}

$schedule = self::findSchedules($params);
return $schedule[0];
}

/**
* Extract the code and flight number portions from the flight number
* Ensures that the code and number are properly split
*/
public static function getProperFlightNum($flightnum)
{
if($flightnum == '')
return false;

$ret = array(); 
$flightnum = strtoupper($flightnum);
$airlines = OperationsData::getAllAirlines(false);

foreach($airlines as $a)
{
$a->code = strtoupper($a->code);

if(strpos($flightnum, $a->code) === false)
{
continue;
}

$ret['code'] = $a->code;
$ret['flightnum'] = str_ireplace($a->code, '', $flightnum);

return $ret;
}

# Invalid flight number
$ret['code'] = '';
$ret['flightnum'] = $flightnum;
return $ret;
}


/**
* Increment the flown count for a schedule
*
* @param string $code Airline code
* @param int $flightnum Flight number
* @return bool 
*
*/
public static function IncrementFlownCount($code, $flightnum)
{
$schedid = intval($schedid);

$code = strtoupper($code);
$flightnum = strtoupper($flightnum);

$sql = 'UPDATE '.TABLE_PREFIX."schedules 
SET timesflown=timesflown+1
WHERE code='{$code}' AND flightnum='{$flightnum}'";

$res = DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}


/**
* Get detailed information about a schedule 
*
* @param int $id ID of the schedule
* @return array Schedule details
*
*/
public static function getScheduleDetailed($id)
{
$schedules = self::findSchedules(array('s.id' => $id));
if(!$schedules)
return false;

$schedule =  $schedules[0];
unset($schedules);

/*$schedule->route_details = unserialize($schedule->route_details);
if(!empty($schedule->route) && !$schedule->route_details)
{
$schedule->route_details = SchedulesData::getRouteDetails($schedule->id, $schedule->route);
}*/

if($schedule->route != '')
{
$schedule->route_details = NavData::parseRoute($schedule);
}

return $schedule;
}

/**
* Return all the airports by depature, which have a schedule, for
* a certain airline. If the airline
* @return object_array
*/
public static function getDepartureAirports($airlinecode='', $onlyenabled=false)
{
$airlinecode = DB::escape($airlinecode);

if($onlyenabled)
$enabled = 'AND s.enabled=1';
else
$enabled = '';

$sql = 'SELECT DISTINCT s.depicao AS icao, a.name
FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'airports a
WHERE s.depicao = a.icao '.$enabled;

if($airlinecode != '')
$sql .= " AND s.code='{$airlinecode}' ";

$sql .= ' ORDER BY depicao ASC';

return DB::get_results($sql);
}

/**
* Get all of the airports which have a schedule, from
* a certain airport, using the airline code. Code
* is optional, otherwise it returns all of the airports.
* 
* @return database object
*/
public static function getArrivalAiports($depicao, $airlinecode='', $onlyenabled=true)
{
$depicao = strtoupper($depicao);
$airlinecode = strtoupper($airlinecode);
$depicao = DB::escape($depicao);

if($onlyenabled)
$enabled = 'AND s.enabled=1';
else
$enabled = '';

$sql = 'SELECT DISTINCT s.arricao AS icao, a.name
FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'airports a
WHERE s.arricao = a.icao '.$enabled;

if($airlinecode != '')
$sql .= " AND s.code='{$airlinecode}' ";

$sql .= ' ORDER BY depicao ASC';

return DB::get_results($sql);
}

/**
* Get all the schedules, $limit is the number to return
*/
public static function getSchedules($onlyenabled=true, $limit='', $start='')
{
$params = array();
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* This gets all of the schedules which are disabled
*/
/*public static function getInactiveSchedules($count='', $start='')
{
$params = array('s.enabled'=>0);
return self::findSchedules($params, $count, $start);
}*/


/**
* Calculate the distance between two coordinates
* Using a revised equation found on http://www.movable-type.co.uk/scripts/latlong.html
* 
* Also converts to proper type based on UNIT setting
*
*/
public static function distanceBetweenPoints($lat1, $lng1, $lat2, $lng2)
{
/* Use a radius depending on the final units we want to be in 
New formula, from http://jan.ucc.nau.edu/~cvm/latlon_formula.html
*/
if(strtolower(Config::Get('UNITS')) === 'mi') # miles
$radius = 3963.192;
elseif(strtolower(Config::Get('UNITS')) === 'km') # Convert to km
$radius = 6378.14;
else
$radius = 3443.92;

/*
$distance = ($radius * 3.1415926 * sqrt(($lat2-$lat1) * ($lat2-$lat1)
+cos($lat2/57.29578) * cos($lat1/57.29578) * ($lng2-$lng1) * ($lng2-$lng1))/180);

return $distance;
*/
$lat1 = deg2rad(floatval($lat1));
$lat2 = deg2rad(floatval($lat2));
$lng1 = deg2rad(floatval($lng1));
$lng2 = deg2rad(floatval($lng2));

$a = sin(($lat2 - $lat1)/2.0);
$b = sin(($lng2 - $lng1)/2.0);
$h = ($a*$a) + cos($lat1) * cos($lat2) * ($b*$;
$theta = 2 * asin(sqrt($h)); # distance in radians

$distance = $theta * $radius;

return $distance;

/* Convert all decimal degrees to radians */

$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;

$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$distance = $r * $c;

return $distance;
/*$distance = acos(cos($lat1)*cos($lng1)*cos($lat2)*cos($lng2) 
+ cos($lat1)*sin($lng1)*cos($lat2)*sin($lng2) 
+ sin($lat1)*sin($lat2)) * $r;

return floatval(round($distance, 2));*/
}

/**
* Update a distance
* 
* @deprecated
*/
/*public static function UpdateDistance($scheduleid, $distance)
{
$sql = 'UPDATE '.TABLE_PREFIX."schedules 
SET distance='{$distance}'
WHERE id={$scheduleid}";

$res = DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}*/

/**
* Add a schedule
* 
* Pass in the following:
$data = array( 'code'=>'',
'flightnum'=''
'depicao'=>'',
'arricao'=>'',
'route'=>'',
'aircraft'=>'',
'distance'=>'',
'deptime'=>'',
'arrtime'=>'',
'flighttime'=>'',
'notes'=>'',
'enabled'=>'',
'price'=>''
'flighttype'=>'');
*/
public static function addSchedule($data)
{
if(!is_array($data))
return false;

# Commented out to allow flights to/from the same airport
#if($data['depicao'] == $data['arricao'])
# return false;

$data['code'] = strtoupper($data['code']);
$data['flightnum'] = strtoupper($data['flightnum']); 
$data['deptime'] = strtoupper($data['deptime']);
$data['arrtime'] = strtoupper($data['arrtime']);
$data['depicao'] = strtoupper($data['depicao']); 
$data['arricao'] = strtoupper($data['arricao']);

if($data['enabled'] == true)
$data['enabled'] = 1;
else
$data['enabled'] = 0;

# If they didn't specify 
$data['flighttype'] = strtoupper($data['flighttype']);
if($data['flighttype'] == '')
$data['flighttype'] = 'P';

$data['flightlevel'] = str_replace(',', '', $data['flightlevel']);

if(isset($fields['route']))
{
$fields['route'] = str_replace('SID', '', $fields['route']);
$fields['route'] = str_replace('STAR', '', $fields['route']);
$fields['route'] = trim($fields['route']);
$fields['route_details'] = '';
}

foreach($data as $key=>$value)
{
$data[$key] = DB::escape($value);
}

$data['flighttime'] = str_replace(':', '.', $data['flighttime']);

$sql = "INSERT INTO " . TABLE_PREFIX ."schedules
(`code`, `flightnum`, 
`depicao`, `arricao`, 
`route`, `route_details`,
`aircraft`, `flightlevel`, `distance`, 
`deptime`, `arrtime`, 
`flighttime`, `daysofweek`, `price`, 
`flighttype`, `notes`, `enabled`)
VALUES ('{$data['code']}', 
'{$data['flightnum']}',
'{$data['depicao']}', 
'{$data['arricao']}', 
'{$data['route']}',
'{$data['route_details']}',
'{$data['aircraft']}', 
'{$data['flightlevel']}',
'{$data['distance']}',
'{$data['deptime']}', 
'{$data['arrtime']}',
'{$data['flighttime']}',
'{$data['daysofweek']}',
'{$data['price']}', 
'{$data['flighttype']}',
'{$data['notes']}', 
{$data['enabled']})";

$res = DB::query($sql);

if(!empty($data['route']))
{
self::getRouteDetails(DB::$insert_id, $data['route']);
}

if(DB::errno() != 0)
return false;

return true;
}

/**
* Edit a schedule
*  Pass in the columns - deprecated
*/

public static function editSchedule($data)
{
if(!is_array($data))
return false;

$id = $data['id'];
unset($data['id']);

self::editScheduleFields($id, $data);
}


/**
* Parse a schedule's route, and store it in the route_details
* column for later on. It will store a serialized array of the
* route's details. 
*
* @param int $schedule_id ID of the schedule to parse
* @param string $route Optional route to parse, otherwise it will look it up
* @return array Returns the route's details
*
*/
public static function getRouteDetails($schedule_id, $route = '')
{
$schedule = self::findSchedules(array('s.id' => $schedule_id), 1);
$schedule = $schedule[0];

if(empty($schedule->route))
{
return;
}

$route_details = NavData::parseRoute($schedule);
$store_details = DB::escape(serialize($route_details));

$val = self::editScheduleFields($schedule_id, array('route_details' => $store_details));

return $route_details;
}

/**
* Update any fields in a schedule, other update functions come down to this
*
* @param int $scheduleid ID of the schedule to update
* @param array $fields Array, column name as key, with values to update
* @return bool 
*
*/
public static function updateScheduleFields($scheduleid, $fields)
{
return self::editScheduleFields($scheduleid, $fields);
}

/**
* Update any fields in a schedule, other update functions come down to this
*
* @param int $scheduleid ID of the schedule to update
* @param array $fields Array, column name as key, with values to update
* @return bool 
*
*/
public static function editScheduleFields($scheduleid, $fields)
{
if(!is_array($fields))
{
return false;
}

if(isset($fields['depicao']) && isset($fields['arricao']))
{
if($fields['depicao'] == $fields['arricao'])
{
return false;
}
}

/* Ensure data is ok and formatted properly */
if(isset($fields['code']))
{
$fields['code'] = strtoupper($fields['code']);
}

if(isset($fields['flightnum']))
{
$fields['flightnum'] = strtoupper($fields['flightnum']);
}

if(isset($fields['depicao']))
{
$fields['depicao'] = strtoupper($fields['depicao']);
}

if(isset($fields['arricao']))
{
$fields['arricao'] = strtoupper($fields['arricao']);
}

if(isset($fields['deptime']))
{
$fields['deptime'] = strtoupper($fields['deptime']);
}

if(isset($fields['arrtime']))
{
$fields['arrtime'] = strtoupper($fields['arrtime']);
}

if(isset($fields['enabled']))
{
if($fields['enabled'] == true)
$fields['enabled'] = 1;
else
$fields['enabled'] = 0;
}

# If they didn't specify a flight type, just default to pax
if(isset($fields['flighttype']))
{
$fields['flighttype'] = strtoupper($fields['flighttype']);
if($fields['flighttype'] == '')
{
$fields['flighttype'] = 'P';
}
}

if(isset($fields['flightlevel']))
{
$fields['flightlevel'] = str_replace(',', '', $fields['flightlevel']);
}


if(isset($fields['flighttime']))
{
$fields['flighttime'] = str_replace(':', '.', $fields['flighttime']);
}

if(isset($fields['route']))
{
$fields['route'] = str_replace('SID', '', $fields['route']);
$fields['route'] = str_replace('STAR', '', $fields['route']);
$fields['route'] = trim($fields['route']);
}

foreach($fields as $key=>$value)
{
$fields[$key] = DB::escape($value);
}

$sql = "UPDATE `".TABLE_PREFIX."schedules` SET ";
$sql .= DB::build_update($fields);
$sql .= ' WHERE `id`='.$scheduleid;

$res = DB::query($sql);

if(DB::errno() != 0)
{
return false;
}

return true;
}

/**
* Delete a schedule
*/
public static function deleteSchedule($scheduleid)
{
$scheduleid = DB::escape($scheduleid);
$sql = 'DELETE FROM ' .TABLE_PREFIX.'schedules 
WHERE id='.$scheduleid;

$res = DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}

public static function deleteAllSchedules()
{
$sql = 'DELETE FROM ' .TABLE_PREFIX.'schedules';

$res = DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}

public static function deleteAllScheduleDetails()
{
$sql = 'UPDATE '.TABLE_PREFIX."schedules 
SET `route_details` = ''";

$res = DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}

public static function getAllBids()
{
$sql = 'SELECT  p.*, s.*, 
b.bidid as bidid, b.dateadded, a.name as aircraft, a.registration
FROM '.TABLE_PREFIX.'schedules s, 
'.TABLE_PREFIX.'bids b,
'.TABLE_PREFIX.'aircraft a,
'.TABLE_PREFIX.'pilots p
WHERE b.routeid = s.id AND s.aircraft=a.id AND p.pilotid = b.pilotid
ORDER BY b.bidid DESC';

return DB::get_results($sql);
}

/**
* Get the latest bids
*/

public static function getLatestBids($limit=5)
{
$sql = 'SELECT  p.*, s.*, 
b.bidid as bidid, a.name as aircraft, a.registration
FROM '.TABLE_PREFIX.'schedules s, 
'.TABLE_PREFIX.'bids b,
'.TABLE_PREFIX.'aircraft a,
'.TABLE_PREFIX.'pilots p
WHERE b.routeid = s.id AND s.aircraft=a.id AND p.pilotid = b.pilotid
ORDER BY b.bidid DESC
LIMIT '.$limit;

return DB::get_results($sql);
}

public function getLatestBid($pilotid)
{
$pilotid = DB::escape($pilotid);

$sql = 'SELECT s.*, b.bidid, a.id as aircraftid, a.name as aircraft, a.registration, a.maxpax, a.maxcargo
FROM '.TABLE_PREFIX.'schedules s, 
'.TABLE_PREFIX.'bids b,
'.TABLE_PREFIX.'aircraft a
WHERE b.routeid = s.id 
AND s.aircraft=a.id
AND b.pilotid='.$pilotid.'
ORDER BY b.bidid ASC LIMIT 1';

return DB::get_row($sql);
}

/**
* Get a specific bid with route information
*
* @param unknown_type $bidid
* @return unknown
*/
public static function getBid($bidid)
{
$bidid = DB::escape($bidid);

$sql = 'SELECT s.*, b.bidid, b.pilotid, b.routeid, 
a.name as aircraft, a.registration
FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b,
'.TABLE_PREFIX.'aircraft a
WHERE b.routeid = s.id 
AND s.aircraft=a.id
AND b.bidid='.$bidid;

return DB::get_row($sql);
}

/**
* Get all of the bids for a pilot
*
* @param unknown_type $pilotid
* @return unknown
*/
public static function getBids($pilotid)
{ 
$pilotid = DB::escape($pilotid);
$sql = 'SELECT s.*, b.bidid, a.name as aircraft, a.registration
FROM '.TABLE_PREFIX.'schedules s, '.TABLE_PREFIX.'bids b,
'.TABLE_PREFIX.'aircraft a
WHERE b.routeid = s.id 
AND s.aircraft=a.id
AND b.pilotid='.$pilotid;

return DB::get_results($sql);
}

/**
* Get find a bid for the pilot based on ID,
* the airline code for the flight, and the flight number
*/
public static function getBidWithRoute($pilotid, $code, $flightnum)
{
if($pilotid == '')
return;

$sql = 'SELECT b.bidid 
FROM '.TABLE_PREFIX.'bids b, '.TABLE_PREFIX.'schedules s
WHERE b.pilotid='.$pilotid.' 
AND b.routeid=s.id
AND s.code=\''.$code.'\' 
AND s.flightnum=\''.$flightnum.'\'';

return DB::get_row($sql);
}

public function setBidOnSchedule($scheduleid, $bidid)
{
$scheduleid = intval($scheduleid);
$bidid = intval($bidid);

$sql = 'UPDATE '.TABLE_PREFIX.'schedules
SET `bidid`='.$bidid.'
WHERE `id`='.$scheduleid;

DB::query($sql);

if(DB::errno() != 0)
return false;

return true;
}

/**
* Add a bid
*/ 
public static function addBid($pilotid, $routeid)
{
$pilotid = DB::escape($pilotid);
$routeid = DB::escape($routeid);

if(DB::get_row('SELECT bidid FROM '.TABLE_PREFIX.'bids
WHERE pilotid='.$pilotid.' AND routeid='.$routeid))
{
return false;
}

$pilotid = DB::escape($pilotid);
$routeid = DB::escape($routeid);

$sql = 'INSERT INTO '.TABLE_PREFIX.'bids (pilotid, routeid, dateadded)
VALUES ('.$pilotid.', '.$routeid.', NOW())';

DB::query($sql);

self::setBidOnSchedule($routeid, DB::$insert_id);

if(DB::errno() != 0)
return false;

return true;
}

public static function deleteExpiredBids()
{ 
$cache_time = Config::Get('BID_EXPIRE_TIME');
if($cache_time == '')
{
return;
}

$sql = 'DELETE FROM '.TABLE_PREFIX."bids
WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()";

DB::query($sql);

}
/**
* Remove a bid, by passing it's bid id
*/
public static function deleteBid($bidid)
{
self::removeBid($bidid);
}

/**
* Remove a bid, by passing it's bid id
*/
public static function removeBid($bidid)
{
$bidid = intval($bidid);
$bid_info = self::getBid($bidid);

$sql = 'DELETE FROM '.TABLE_PREFIX.'bids 
WHERE `bidid`='.$bidid;

DB::query($sql);

self::SetBidOnSchedule($bid_info->routeid, 0);

if(DB::errno() != 0)
return false;

return true;
}


/**
* @deprecated
*
*/
public static function getScheduleFlownCounts($code, $flightnum, $days=7)
{
$max = 0;


$code = strtoupper($code);
$flightnum = strtoupper($flightnum);

$start = strtotime("- $days days");
$end = time();
$data = array();

# Turn on caching: 
DB::enableCache();

do 
{ 
$count = PIREPData::getReportCountForRoute($code, $flightnum, $start);
$date = date('m-d', $start);

$data[$date] = $count; 

$start += SECONDS_PER_DAY;

}  while ($start <= $end);

DB::disableCache();

return $data;
}

/**
* Show the graph of the past week's reports. Outputs the
* image unless $ret == true
* 
* @deprecated
*/
public static function showReportCounts()
{
// Recent PIREP #'s
$max = 0;
$data = array();

$time_start = strtotime('-7 days');
$time_end = time();

// This is for the past 7 days
do {
$count = PIREPData::getReportCount($time_start);

$data[] = $count;

if($count > $max)
$max = $count;

$time_start += SECONDS_PER_DAY;
} while ($time_start < $time_end);

return $data;
}

/* Below here, these are all deprecated. In your code, you should use
the query structure, defined within the functions

/**
* @deprecated
*/
/*public static function getSchedulesWithCode($code, $onlyenabled=true, $limit='', $start='')
{
$params = array('s.code' => strtoupper($code));
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* @deprecated
*/
/*public static function getSchedulesWithFlightNum($flightnum, $onlyenabled=true, $limit='', $start='')
{
$params = array('s.flightnum' => $flightnum);
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* Return all of the routes give the departure airport
* 
* @deprecated
*/
/*public static function getSchedulesWithDeparture($depicao, $onlyenabled = true, $limit = '', $start='')
{
self::getRoutesWithDeparture($depicao, $onlyenabled, $limit);
}*/

/**
* @deprecated
*/
/*public static function getRoutesWithDeparture($depicao, $onlyenabled=true, $limit='', $start='')
{
$params = array('s.depicao' => strtoupper($depicao));
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* @deprecated
*/
/*public static function getRoutesWithArrival($arricao, $onlyenabled=true, $start='', $limit='')
{
return self::getSchedulesWithArrival($arricao, $onlyenabled, $limit);
}*/

/**
* @deprecated
*/
/*public static function getSchedulesWithArrival($arricao, $onlyenabled=true, $start='', $limit='')
{
$params = array('s.arricao' => strtoupper($arricao));
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* @deprecated
*/
/*public static function getSchedulesByDistance($distance, $type, $onlyenabled=true, $start='', $limit='')
{
if($type == '')
$type = '>';

$params = array('s.distance' => trim($type).' '.$distance);
if($onlyenabled)
$params['s.enabled'] = '1';

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

/**
* 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);
}*/
}

  • 1 month later...
Posted

Wanted to share what I did with Charter Flight system in last few hours:

We didn't want to change our VA CallSign (AirMAK - MKD) when pilots fly charters (representing our VA on VATSIM).

So, I added VA with 4-characters ICAO: MKD0 -- Of course, I had to change structure of database (length of code txt field needs to be 4 - in all tables that uses it).

Then, I removed (changed flight numbers) flights from regular schedule that start with 0 - so, from now on, charter flights, created with Charter Filght System addon will be MKD0###, Charters that pilots fly without booking will be MKD0## and all Scheduled flights are MKD1## to MKD9#### ;)

And, of course, to solve the problem with empty "Flight Type" field, I replaced "CH" in all files with "MKD0" !!

Now, let's give it to some pilots to test this hehehe...

Cheerz!!!

  • 1 month later...
  • 2 months later...
  • 3 weeks later...
Posted

It's located in the ops_scheduleform.tpl, starting around line 459. The red is what you want to change as far as numbers go. I use 25 hours, as I figure that way they have proven to me they can somewhat fly. lol

<?php

}

?>

<?php

}

elseif ((Auth::$userinfo->totalhours + Auth::$userinfo->transferhours)<25)

{

?>

<table border="0" width="90%">

<tr>

<td dir="ltr">

<p align="center"> </p>

<p align="center"> </p>

<p align="center"><b>

<font color="#000080" size="2">

<img border="0" src="<?php echo SITE_URL?>/lib/images/charter/error.png"></font></b></p>

<p align="center"><b><font face="Tahoma" color="#FF5353">You do

not have permission to access this page</font><font face="Tahoma" color="#FF5353" size="3">!</font><font size="2" color="#000080" face="Tahoma"><span lang="fa"><br>

</span></font><font face="Tahoma"><span lang="fa">

<font color="#800000" size="2"><br>

</font>

</span><font size="2" color="#FFFF00">You should have at least

25 flight hours to access the Charter Flight System</font></font><span lang="fa"><font face="Tahoma" size="2" color="#FFFF00">!</font></span></b></p>

</td>

</tr>

Posted

It's located in the ops_scheduleform.tpl, starting around line 459. The red is what you want to change as far as numbers go. I use 25 hours, as I figure that way they have proven to me they can somewhat fly. lol

Thanks for trying to help. I just tried changing what you highlighted, but the web page is still saying you need to have 142 hours.

Here's what my code looks like:

<?php

}

?>

<?php

}

elseif ((Auth::$userinfo->totalhours + Auth::$userinfo->transferhours)<25)

{

?>

<table border="0" width="90%">

<tr>

<td dir="ltr">

<p align="center"> </p>

<p align="center"> </p>

<p align="center"><b>

<font color="#000080" size="2">

<img border="0" src="<?php echo SITE_URL?>/lib/images/charter/error.png"></font></b></p>

<p align="center"><b><font face="Tahoma" color="#FF5353">You do

not have permission to access this page</font><font face="Tahoma" color="#FF5353" size="3">!</font><font size="2" color="#000080" face="Tahoma"><span lang="fa"><br>

</span></font><font face="Tahoma"><span lang="fa">

<font color="#800000" size="2"><br>

</font>

</span><font size="2" color="#FFFF00">You should have at least

25 flight hours to access the Charter Flight System</font></font><span lang="fa"><font face="Tahoma" size="2" color="#FFFF00">!</font></span></b></p>

</td>

</tr>

Posted

I've been working on trying to install this for a week now.

I get this error when I'm logged in and go to the Charter page:

Fatal error: Call to undefined method SchedulesData::countCharterSchedules() in /home/bluehawk/public_html/core/templates/charter/ops_schedules.tpl on line 65

What do I do to fix this? It seems the SchedulesData.class.php file is missing!

Posted

Thanks for trying to help. I just tried changing what you highlighted, but the web page is still saying you need to have 142 hours.

Here's what my code looks like:

<?php

}

?>

<?php

}

elseif ((Auth::$userinfo->totalhours + Auth::$userinfo->transferhours)<25)

{

?>

<table border="0" width="90%">

<tr>

<td dir="ltr">

<p align="center"> </p>

<p align="center"> </p>

<p align="center"><b>

<font color="#000080" size="2">

<img border="0" src="<?php echo SITE_URL?>/lib/images/charter/error.png"></font></b></p>

<p align="center"><b><font face="Tahoma" color="#FF5353">You do

not have permission to access this page</font><font face="Tahoma" color="#FF5353" size="3">!</font><font size="2" color="#000080" face="Tahoma"><span lang="fa"><br>

</span></font><font face="Tahoma"><span lang="fa">

<font color="#800000" size="2"><br>

</font>

</span><font size="2" color="#FFFF00">You should have at least

25 flight hours to access the Charter Flight System</font></font><span lang="fa"><font face="Tahoma" size="2" color="#FFFF00">!</font></span></b></p>

</td>

</tr>

There is another file that you have to edit as well, for the life of me I can't remember what is was. lemmie check thru mine and see if I can remember. the 142 hours thing is located in like 2 or 3 places

Posted

There is another file that you have to edit as well, for the life of me I can't remember what is was. lemmie check thru mine and see if I can remember. the 142 hours thing is located in like 2 or 3 places

Thanks for the help!

I've found what files need to be changed. My next problem is when I go to the charters page, all it says is Charter Flight System with the logo next to it. How do you create/book a flight? I'm assuming it's me doing something wrong, but I can't figure out what it is.

Thanks again for your help.

Posted

If you put all the files where they are supposed to go, then at the bottom of your Charter Flight plage should be a icon with a plus in it that says "add new charter". If not, double check your file placement, and go back thru the module and template files to make sure they are correct. If everything is correct you should have the button at the bottom of the page.

  • 4 weeks later...
Posted

I'm back again, but still having the issue. I've double checked and everything looks like it is installed in the correct location. There is one folder called charter in core/, a folder called Charter in core/modules/, a folder called charter in core/templates/, and the last is charter in lib/images/. The only other thing I can think of is that I don't have any flights yet. Could that be causing this?

I've also attached a screenshot of the webpage.

post-45765-0-37952900-1421021231_thumb.jpg

Posted

I'm back again, but still having the issue. I've double checked and everything looks like it is installed in the correct location. There is one folder called charter in core/, a folder called Charter in core/modules/, a folder called charter in core/templates/, and the last is charter in lib/images/. The only other thing I can think of is that I don't have any flights yet. Could that be causing this?

I've also attached a screenshot of the webpage.

post-45765-0-37952900-1421021231_thumb.jpg

The only way I was able to find most of the items to change according to the documentation ( still have a few issue's myself) was to use the Find and Replace option in my text editor. I looked for these items forever till I realized I had an easier way to do it. Having said that I am having issues with the code that hides the CH, Charter, airline from new registrations.

Good Luck...

Here is my Charter System I am in the process of customizing and fixing things that do no work:

http://simbreak.com/index.php/charter

Some screen shots:

http://screencast.com/t/73Ln2qWU8oV

http://screencast.com/t/OmaeUjxsD

http://screencast.com/t/QyiFOHxO3

Still have a lot of customizing and fixing to do!

Posted

I can't get the images to show up in flight briefing ????

Untitled_zpsc9df8a24.png

The images for that area are not in the included download. I do not know why! I am going to make some kind of custom ones or find ones! I have a bunch of icons somewhere on a hard drive :)

  • Like 1

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...