mischka, I followed the instructions to add the extended values. For some reason the table on my admin side isn’t showing the extra information, yet it populates when searching and in the db.
Here is what I changed in ops.airportlist.php:
colNames: [‘ICAO’, ‘IATA’, ‘Airport Name’, ‘Hub’, ‘Country’, ‘City’, ‘Fuel Cost’, ‘Altitude’, ‘Lat’, ‘Lng’, ‘TZ Offset’, ‘Timezone’, ‘Edit’],
colModel : [
{index: ‘icao’, name : ‘icao’, width: 30, sortable : true, align: ‘center’, search: ‘true’, searchoptions:{sopt:[‘eq’,‘ne’]}},
{index: ‘iata’, name : ‘iata’, width: 30, sortable : true, align: ‘center’, searchoptions:{sopt:[‘in’]}},
{index: ‘name’, name : ‘name’, width: 65, sortable : true, align: ‘center’, searchoptions:{sopt:[‘in’]}},
{index: ‘hub’, name : ‘hub’, width: 15, sortable : true, align: ‘center’, search: ‘false’},
{index: ‘country’, name : ‘country’, width: 65, sortable : true, align: ‘center’, searchoptions:{sopt:[‘in’]}},
{index: ‘city’, name : ‘city’, width: 65, sortable : true, align: ‘center’, search:false},
{index: ‘fuelprice’, name : ‘fuelprice’, width: 30, sortable : true, align: ‘center’, search:false},
{index: ‘altitude’, name : ‘altitude’, width: 25, sortable : true, align: ‘center’, search:false},
{index: ‘lat’, name : ‘lat’, width: 40, sortable : true, align: ‘center’, search:false},
{index: ‘lng’, name : ‘lng’, width: 40, sortable : true, align: ‘center’, search:false},
{index: ‘timezone’, name : ‘timezone’, width: 40, sortable : true, align: ‘center’, search:false},
{index: ‘dbtimezone’, name : ‘dbtimezone’, width: 65, sortable : true, align: ‘center’, search:false},
{index: ‘’, name : ‘’, width: 100, sortable : true, align: ‘center’, search: false}
This is what was changed in the phpvmsadmin.js:
$.each(data.airports, function(i, item) {
$("#airporticao").val(icao);
$("#airportiata").val(item.iata);
$("#airportname").val(item.name);
$("#airportcity").val(item.city);
$("#airportcountry").val(item.countryName);
$("#airportlat").val(item.lat);
$("#airportlong").val(item.lng);
$("#airportaltitude").val(item.altitude);
$("#fuelprice").val(item.jeta);
$("#airporttimezone").val(item.timezone);
$("#airportdbtimezone").val(item.dbtimezone);
$("#statusbox").html("");
$("#lookupicao").show();
The ops_airportform.php is changed at instructed:
Changed in operations.php:
$data = array('icao' => $this->post->icao, 'iata'=> $this->post->iata, 'name' => $this->post->name, 'hub' => $this->post->hub,
'country' => $this->post->country, 'city'=> $this->post->city, 'fuelprice' => $this->post->fuelprice,
'altitude'=> $this->post->altitude, 'lat' => $this->post->lat, 'lng' => $this->post->lng,
'timezone'=> $this->post->timezone, 'dbtimezone'=> $this->post->dbtimezone, 'chartlink' => $this->post->chartlink);
operationsdata.php:
Line 550:
if ($data[‘icao’] == ‘’) return false;
$data[‘icao’] = strtoupper(DB::escape($data[‘icao’]));
$data[‘name’] = DB::escape($data[‘name’]);
if ($data[‘hub’] === true) $data[‘hub’] = 1;
else $data[‘hub’] = 0;
if ($data[‘fuelprice’] == ‘’) $data[‘fuelprice’] = 0;
if (!isset($data[‘chartlink’])) {
$data[‘chartlink’] = ‘’;
}
if($data[‘timezone’] == ‘’) $data[‘timezone’] = 0;
if($data[‘altitude’] == ‘’) $data[‘altitude’] = 0;
$sql = "INSERT INTO " . TABLE_PREFIX . “airports
( icao, iata, name, hub, country, city, fuelprice, altitude, lat, lng, timezone, dbtimezone, chartlink)
VALUES (
‘{$data[‘icao’]}’, ‘{$data[‘iata’]}’, ‘{$data[‘name’]}’, ‘{$data[‘hub’]}’, ‘{$data[‘country’]}’,
‘{$data[‘city’]}’, ‘{$data[‘fuelprice’]}’, ‘{$data[‘altitude’]}’, ‘{$data[‘lat’]}’, ‘{$data[‘lng’]}’, ‘{$data[‘timezone’]}’, ‘{$data[‘dbtimezone’]}’, ‘{$data[‘chartlink’]}’)”;
$res = DB::query($sql);
if (DB::errno() != 0) return false;
CodonCache::delete(‘all_airports’);
CodonCache::delete(‘all_airports_json’);
CodonCache::delete(‘get_airport_’ . $data[‘icao’]);
return true;
}
Line 596:
public static function editAirport($data) {
$data[‘icao’] = strtoupper(DB::escape($data[‘icao’]));
$data[‘name’] = DB::escape($data[‘name’]);
if ($data[‘hub’] === true) $data[‘hub’] = 1;
else $data[‘hub’] = 0;
if ($data[‘fuelprice’] == ‘’) $data[‘fuelprice’] = 0;
if($data[‘timezone’] == ‘’) $data[‘timezone’] = 0;
if($data[‘altitude’] == ‘’) $data[‘altitude’] = 0;
$sql = "UPDATE " . TABLE_PREFIX . “airports
SET icao=‘{$data[‘icao’]}’, iata=‘{$data[‘iata’]}’, name=‘{$data[‘name’]}’,hub={$data[‘hub’]}‘, country=’{$data[‘country’]}‘,
city=’{$data[‘city’]}‘, fuelprice={$data[‘fuelprice’]}’, altitude={$data[‘altitude’]}‘,
lat={$data[‘lat’]}’, lng={$data[‘lng’]}‘, timezone={$data[‘timezone’]}’, dbtimezone=‘{$data[‘dbtimezone’]}’,
chartlink=‘{$data[‘chartlink’]}’
WHERE icao=‘{$data[‘icao’]}’”;
$res = DB::query($sql);
if (DB::errno() != 0) return false;
CodonCache::delete(‘get_airport_’ . $data[‘icao’]);
CodonCache::delete(‘all_airports_json’);
CodonCache::delete(‘all_airports’);
return true;
}
I’m scratching my head over this and can’t figure out how to get the columns to give the correct information. Any suggestions?