Jump to content

kenny

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by kenny

  1. thanks sir, i will look
  2. Hi man! I wanted to know if you can also pay for free flights or charter . Now if a pilot makes a flight by checking the " charter flight" option in the ACARS , it is not paid and are not even calculated fuel costs . I wish I could also pay those who make free flights , perhaps by calculating a percentage less than the full pay ... Thanks
  3. Can i set a Type of Flight? In database a system inser a "P" in field "flighttype", and i would like that it will be a cargo flight.... Thanks
  4. yes, i have disable a RANKS_AUTOCALCULATE , but doesn't work. When i reaching a minimun hours for next rank a system assign a new ranks, without check a flight condition....
  5. Mmm... i'm not sure what do you mean... sorry. I copy my rankdataclass with my modify. <?php /** * phpVMS - Virtual Airline Administration Software * Copyright © 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum'>http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs'>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 © 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class RanksData extends CodonData { static $lasterror; /** * Return information about the rank, given the ID */ public static function getRankInfo($rankid) { $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'ranks WHERE rankid=' . $rankid; return DB::get_row($sql); } public static function getRankByName($name) { $sql = 'SELECT * FROM `' . TABLE_PREFIX . "ranks` WHERE `rank`='{$name}'"; return DB::get_row($sql); } /** * Returns all the ranks, and the total number of pilots * on each rank */ public static function getAllRanks() { $allranks = CodonCache::read('all_ranks'); if ($allranks === false) { $sql = 'SELECT r.*, (SELECT COUNT(*) FROM ' . TABLE_PREFIX .'pilots WHERE rank=r.rank) as totalpilots FROM ' . TABLE_PREFIX . 'ranks r ORDER BY r.minhours ASC'; $allranks = DB::get_results($sql); CodonCache::write('all_ranks', $allranks, 'long'); } return $allranks; } public static function getRankImage($rank) { $sql = 'SELECT `rankimage` FROM ' . TABLE_PREFIX . 'ranks WHERE rank="' . $rank . '"'; return DB::get_var($sql); } /** * Get the level the passed rank is in the list */ public static function getRankLevel($rankid) { if ($rankid == 0) { return 0; } $all_ranks = self::getAllRanks(); $i = 0; foreach ($all_ranks as $rank) { $i++; if ($rank->rankid == $rankid) { return $i; } } return 0; } /** * Give the number of hours and flights, return the next rank */ public static function getNextRank($hours, $flights) { $sql = "SELECT * FROM " . TABLE_PREFIX . "ranks WHERE MinHours<=$hours AND MinFlights<=$flights ORDER BY MinHours DESC LIMIT 1"; return DB::get_row($sql); } /** * Add a ranking. This will automatically call * CalculatePilotRanks() at the end */ public static function addRank($title, $minhours, $minflighs, $imageurl, $payrate) { $minhours = intval($minhours); $minflights = intval($minflights); $payrate = floatval($payrate); $sql = "INSERT INTO " . TABLE_PREFIX . "ranks (rank, rankimage, minhours, minflights, payrate) VALUES('$title', '$imageurl', '$minhours', '$minflights', $payrate)"; $ret = DB::query($sql); if (DB::$errno == 1062) { self::$lasterror = 'This already exists'; return false; } CodonCache::delete('all_ranks'); self::calculatePilotRanks(); return true; } /** * Update a certain rank */ public static function updateRank($rankid, $title, $minhours, $minflights, $imageurl, $payrate) { $minhours = intval($minhours); $minflights = intval($minflights); $payrate = floatval($payrate); $sql = "UPDATE " . TABLE_PREFIX . "ranks SET rank='$title', rankimage='$imageurl', minhours='$minhours', minflights='$minflights', payrate=$payrate WHERE rankid=$rankid"; $res = DB::query($sql); if (DB::errno() != 0) return false; CodonCache::delete('all_ranks'); self::calculatePilotRanks(); return true; } /** * Delete a rank, and then recalculate */ public static function deleteRank($rankid) { $sql = 'DELETE FROM ' . TABLE_PREFIX . 'ranks WHERE rankid=' . $rankid; DB::query($sql); if (DB::errno() != 0) return false; CodonCache::delete('all_ranks'); self::CalculatePilotRanks(); return true; } /** * Go through each pilot, check their hours, and see where they * stand in the rankings. If they are above the minimum hours * for that rank level, then make $last_rank that text. At the * end, update that */ public static function calculatePilotRanks() { /* Don't calculate a pilot's rank if this is set */ if (Config::Get('RANKS_AUTOCALCULATE') === false) { return; } $ranks_list = self::getAllRanks(); $pilots = PilotData::getAllPilots(); if (count($pilots) == 0 || !is_array($pilots)) { return; } foreach ($pilots as $pilot) { self::calculateUpdatePilotRank($pilot->pilotid, $ranks_list); } } public static function calculateUpdatePilotRank($pilotid, $ranks_list = null) { /* Don't calculate a pilot's rank if this is set */ if (Config::Get('RANKS_AUTOCALCULATE') == false) { return; } if($ranks_list === null) { $ranks_list = self::getAllRanks(); } $pilotid = intval($pilotid); $pilot = PilotData::getPilotData($pilotid); $pilothours = $pilot->totalhours; $pilotflights = $pilot->totalflights; if (Config::Get('TRANSFER_HOURS_IN_RANKS') == true) { $pilothours += $pilot->transferhours; } $i = 0; foreach ($ranks_list as $rank) { $i++; if ($pilothours >= intval($rank->minhours)) { $rank_level = $i; $last_rank = $rank->rank; $last_rankid = $rank->rankid; } } $update = array( 'rankid' => $last_rankid, 'rank' => $last_rank, 'ranklevel' => $rank_level, ); PilotData::updateProfile($pilot->pilotid, $update); if($pilot->rank != $last_rank) { $message = Lang::get('activity.pilot.promotion'); $message = str_replace('$rank', $last_rank, $message); # Add it to the activity feed ActivityData::addActivity(array( 'pilotid' => $pilotid, 'type' => ACTIVITY_PROMOTION, 'refid' => $pilotid, 'message' => htmlentities($message), )); } } }
  6. Thanks for your reply sir, but the system doesn't check a variable minflight.
  7. Hello guys, I need a little help. I wish the ranks were awarded not only based on the hours but also the number of flights made. I was able to bring up the function in the admin panel and make it work. The table in the database is updated correctly, but if I add the hours to a pilot with the "transert hours" the rank is increased even if there isn't a number of required flights. Can anyone help me?
  8. kenny

    VMSEditor 1.1

    hi man, where i can download this add-on? Thanks.
  9. Hi man, I would like to know if i can set the display time of the flights in the current flights map. Yesterday I made a flight and an hour after landing still saw my flight on the map .... Thanks
  10. Thanks for this fantastic module! It's a very beatiful!!! Only 1 question: is possible to add a ticket/cargo price, a pay for flight, an the type of flight? Thanks
  11. kenny

    Roster Page

    I solved . Thanks sir!
  12. kenny

    Roster Page

    Thanks for your reply! Now i see "There are no pilots".
  13. Hi man, i would like to have a pilot roser without Hub separations. I would like a single list. I have insert this code in Pilots.php, but i have this error in roster page: Warning: Invalid argument supplied for foreach() in /home/hfrjgrdn/sites/phpvms/core/templates/pilots_list.php on line 33. Can you help me?
  14. Thanks sir! I will try to download a phpvms 5.5 and upload a file on my ftp.
  15. Hi sir, i have install your version of phpvms, but i have a problem with Captcha. In a registration form, when click on register, i see this error: Fatal error: Class 'ReCaptcha' not found in /home/hfrjgrdn/sites/dfyvanet/phpvms/core/modules/Registration/Registration.php on line 178 Can you help me please?
  16. yes... i attack it. PIREPData.class.php
  17. i have add an admin code but doesn't work. This module need a cronjob?
  18. i don't see any request in admin section... What can i do? Thanks
  19. ...thanks for your reply!
  20. Hello everyone, I have installed the module following the instructions, but the PIREP are not validated. I see no error. Anyone have any ideas?
  21. can you copy your code in "HubTransfertData.class.php" from line 51 to exd of modify? Thanks
  22. kenny

    Hi Sava , I'm CEO af a little VA and i serching a good repainter . Can you help me ?

    I need help for NGX 738 PMDG . I have already designed the master livery , but I can not cut it.

    Thanks

×
×
  • Create New...