Jump to content

Ademar Andrade

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by Ademar Andrade

  1. I shall require 78 Smirnoffs, 12 rubber bands, 117 pop-sickle sticks, a bottle of pepto bismol and a bottle of elmers glue. I will PM you with the address where you can ship the supplies.

    Haha, just kidding. here is how I decided to implement that function:

    • I placed the above function in ./core/common/MaintenanceData.class.php
      • ​Now for the following bit you will have to forgive me as I have modded our installation of phpVMS tremendously and can't remember exactally what is in the default package.

    In ./core/common/PilotData.class.php around line 291 I put the following code

    (Keep in mind I have edited this file alot in my installation and might be on a different line for you. The function is changePilotID($old_pilotid, $new_pilotid) and it should go 3 lines after the $pilot_exists line)

    [/size]
    [size=4]	 $avatarFix = MaintenanceData::fixAvatar($old_pilotid, $new_pilotid);
     if($avatarFix !== true){
    	 return $avatarFix;
     }
    

    Now for your convenience I will provide you with the full function that we are currently using on WOAVA, however, I would recommend AGAINST copying and using the code as I have made some security patches to the phpVMS Pilot Groups and this exact code wont work with the current release. (However, it might with the dev release! =] available here: https://github.com/n...archive/dev.zip )

    [/size]
    [size=4]/**
     * PilotData::changePilotID()
     *
     * @param mixed $old_pilotid
     * @param mixed $new_pilotid
     * @return
     */
    public static function changePilotID($old_pilotid, $new_pilotid) {
     if(!PilotGroups::group_has_perm(Auth::$usergroups, EDIT_PILOTS)) {
    	 Debug::showCritical('Unauthorized access - You do not have permissions to edit pilots');
    	 die();
     }
     $pilot_exists = self::getPilotData($new_pilotid);
     if (is_object($pilot_exists)) {
    	 return false;
     }[/size]
    [size=4] $avatarFix = MaintenanceData::fixAvatar($old_pilotid, $new_pilotid);
     if($avatarFix !== true){
    	 return $avatarFix;
     }
     DB::query('SET foreign_key_checks = 0;');
    
     // List of all the tables which need to update
     $table_list = array(
    	 'groupmembers', 'pilots', 'adminlog', 'awardsgranted',
    	 'acarsdata', 'sessions', 'pireps', 'pirepcomments',
    	 'fieldvalues', 'bids');[/size]
    [size=4] foreach ($table_list as $table) {
    	 $sql = 'UPDATE `' . TABLE_PREFIX . $table . '`
     SET `pilotid`=' . $new_pilotid . '
     WHERE `pilotid`=' . $old_pilotid;
    	 DB::query($sql);
     }
    
     return true;
    }[/size]
    [size=4]

    Thanks dude!

    Nice job!

    See you...

  2. Ha ha! Love it. Don't leave home ...er' the airport without it! :rolleyes:

    i like yours @warpennys. Think its ace ahha, well done good job

    Thank you guys!

    Our Pilots have a credit card (mastercard) to buy cars, houses...etc...They are very rich flying with us...hahahahah

  3. that can be a reason! and I would try to echo

    $schedules->flighttime for testing!

    since I have the strong feeling that it returns nothing (when it have no return) the PIREP flightime is always greater and jumps directly into the echo "Delayed"

    The code looks fine, but do you have the flight time set in your schedules?

    Thank you guys...

    Now is working...

    Have a nice day!

  4. Hi all,

    I'm trying to determinate witch flights have been done on time.

    The logic is: if the flight time is bigger than the estimated, the result is Delayed, else On time.

    So i simple code:

      <?php
    			  if ($pirep->flighttime > $schedules->flighttime)
    			  {
    			  echo "Delayed";
    			  }
    			  else
    			  {
    			  echo "On time";
    			  }
      ?>
    

    On results, all flights are "Delayed", and it's not truth.

    Help guys, what is wrong with my code?

    Thanks for attention!

×
×
  • Create New...