Jump to content

kenny

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

1 Follower

About kenny

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. kenny

    Free flight

    thanks sir, i will look
  2. kenny

    Free flight

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

    Charter Flight System v1.1.0 (UPDATED!)

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

    Rank with numberflight conditions

    thanks for your reply
  5. kenny

    Rank with numberflight conditions

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

    Rank with numberflight conditions

    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), )); } } }
  7. kenny

    Rank with numberflight conditions

    Thanks for your reply sir, but the system doesn't check a variable minflight.
  8. 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?
  9. kenny

    VMSEditor 1.1

    hi man, where i can download this add-on? Thanks.
  10. kenny

    Current Flights

    Thanks sir!
  11. kenny

    Current Flights

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

    Charter Flight System v1.1.0 (UPDATED!)

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

    Roster Page

    I solved . Thanks sir!
  14. kenny

    Roster Page

    Thanks for your reply! Now i see "There are no pilots".
  15. kenny

    Roster Page

    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?
×