Jakubovsky Posted January 14, 2014 Report Share Posted January 14, 2014 Hello, inetersted help with code source. 1) schedule routes For exmp. We have flight ABC0001 from AAAA to BBBB only for one a/c, can its possible choise with wich one a/c operate this schedule route. 2) insert on schedule alternative airport with route. AAAA-BBBB with alternative CCCC and route from BBBB to CCCC is thx. Sergejs Quote Link to comment Share on other sites More sharing options...
MaciejO Posted January 16, 2014 Report Share Posted January 16, 2014 Hi! 1) You could possibly achieve desired effect through SimPilot's Real Schedule module. 2) You would have to add new rows in schedules table called altnIcao and altnAptRoute and then modify schedules module within admin area and schedules data within core to allow adding data into this columns through admin panel. Then it would be matter of displaying it. Though I have no idea what impact could this have as I never tried modyfing phpvms tables directly. Other way would be creating another database table with name of something like phpvms_alternates and having id, scheduleId, altnIcao, altnAptRoute and then creating an admin module to handle this data with reference to scheduleId from your phpvms_schedules table. Hope that helps, Mac! Quote Link to comment Share on other sites More sharing options...
Felipe Posted January 16, 2014 Report Share Posted January 16, 2014 Right now, I'm trying to set this altnicao on my schedule module. Since I'm just a newbie in PHP and MySQL, I ask you guys for some help, that might be usefull to our friend Jacubovsky too. These are the steps I took up to now: 1. Added a new column on phpvms_schedules ALTER TABLE `phpvms_schedules` ADD column `altnicao` VARCHAR( 4 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ; 2. Set the view inside a table with the other ready data on schedule_briefing.tpl. It is already working, since I tested it manually, filling the altnicao column on the DB. But I'll tell you what my "problem" is in the end.. Keep reading, please. <th class="col-lg-3">Aeroporto de Origem</th> <td> <?="{$schedule->depname} ($schedule->depicao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->depicao; ?>" target="_blank">cartas aéreas</a>.</em> </td> </tr> <tr> <th class="col-lg-3">Aeroporto de Destino</th> <td> <?="{$schedule->arrname} ($schedule->arricao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->arricao; ?>" target="_blank">cartas aéreas</a>.</em> </td> </tr> <tr> <th class="col-lg-3">Aeroporto de Alternativa</th> <td> <?="{$schedule->altnname} ($schedule->altnicao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->altnicao; ?>" target="_blank">cartas aéreas</a>.</em> </td> </tr> 3. Then, I began to search in the core/modules/Schedules/Schedules.php which method I should modify. I found it at: public function brief($routeid = ''){ if($routeid == '') { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } $schedule = SchedulesData::getScheduleDetailed($routeid); $this->set('schedule', $schedule); $this->render('schedule_briefing.tpl'); } 4. So I headed to the "public static function getScheduleDetailed($id)" at core/common/SchedulesData.class.php. Actually, It took me some lines up to this: 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; } So I guess it is in there where my problem is... Since I know the "$schedule->altnicao" is already woking fine on schedule_briefing.tpl, I guess that first query on that $sql variable needs some extra instructions, so I can have the "$schedule->altnname" also working on my schedule_briefing.tpl. I guess this altnicao name would come from the phpvms_airports table... Since I know almost nothing on inner, left or right join, I ask you guys for the solution for that, please. Later I'll try to modified the admin schedules module to add the altnicao through the admin center, instead of directly on the DB. If I get it working, I'll post it in here. Otherwise, I'll come back for help once again. Thanks! Quote Link to comment Share on other sites More sharing options...
Felipe Posted January 16, 2014 Report Share Posted January 16, 2014 Later I'll try to modified the admin schedules module to add the altnicao through the admin center, instead of directly on the DB. If I get it working, I'll post it in here. Otherwise, I'll come back for help once again. Thanks! I couldn't. Too far advanced for my skills... Quote Link to comment Share on other sites More sharing options...
Jakubovsky Posted January 16, 2014 Author Report Share Posted January 16, 2014 Felipe, very big THX. Trying now do same in our site. Quote Link to comment Share on other sites More sharing options...
Kapitan Posted November 6, 2014 Report Share Posted November 6, 2014 Thats what im try to do , also with extra pax option for my new acars Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.