Jump to content

freshJet

Members
  • Posts

    1470
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by freshJet

  1. This works

    <?php
    $deptime = str_replace(':', '', $schedule->deptime);
    $arrtime = str_replace(':', '', $schedule->arrtime);
    
    $dephour = substr($deptime, 0, 2);
    $depmin = substr($deptime, -2);
    $arrhour = substr($arrtime, 0, 2);
    $arrmin = substr($arrtime, -2);
    
    echo $dephour.' <br />';
    echo $depmin.' <br />';
    echo $arrhour.' <br />';
    echo $arrmin.' <br />';
    ?>
    

  2. Sorry the times should be:

    <?php
    $deptime = str_replace(':', '', $schedule->deptime);
    $arrtime = str_replace(':', '', $schedule->arrtime);
    $dephour = substr($deptime, 0, 5);
    $depmin = substr($deptime, -2);
    $arrhour = substr($arrtime, 0, 5);
    $arrmin = substr($arrtime, -2);
    
    echo $dephour;
    echo $depmin;
    echo $arrhour;
    echo $arrmin;
    ?>
    

    The ICAO is $schedule->depicao and $schedule->arricao.

    • Like 1
  3. UPDATE as of 10th December 2015

    For those looking for an update on this project, it has been very much abandoned for several months now. I have been busy with work, plus I have not been involved in the VA scene for about a year now. phpVMS development came to a standstill as well.

    If there is enough demand for this then I might consider completing it.

    I am considering developing a new module. The module would be used for admin staff only, and would not be accessible by pilots.

    The concept is a schedule builder. Many VAs will assign any odd time and aircraft to their flights without a thought, however this module is intended for those who wish to build their schedules in a realistic way.

    The module would allow the user to add flights onto a timeline by aircraft, so that flights would be organised in an illustrative manner. Each flight will be represented by a block, which shows only basic information such as departure/arrival airports and departure/arrival times, but the block will hold all relevant schedule data such as flight number, route, price, etc, Once the user is happy, they can then export the data to a .csv file which can then be imported to the phpVMS schedules.

    This will be a fairly complex development, so, if it were to go ahead then I would have to consider whether or not this will be a free product or whether it will come with a fee. If a fee were to be used, it will likely cost no more than £20 (around $30 or 25€).

    • Like 5
  4. Registration, flight number and route are easy:

    <?php echo $schedule->registration;?>
    

    <?php echo $schedule->flightnum;?>
    

    <?php echo $schedule->route;?>
    

    Splitting up the times is a bit more tricky. This will only work if your times are in the HH:MM format, not HHMM.

    <?php
    $deptime = str_replace(':', '', $schedule->deptime);
    $arrtime = str_replace(':', '', $schedule->arrtime);
    $dephour = substr($deptime, -2);
    $depmin = substr($deptime, 2);
    $arrhour = substr($arrtime, -2);
    $arrmin = substr($arrtime, 2);
    
    echo $dephour;
    echo $depmin;
    echo $arrhour;
    echo $arrmin;
    

    • Like 1
  5. That would get the flights by a specific pilot

    To get flights for all pilots at a hub it would be something like:

    public static function CountFlightsForPilotsOfHub($icao) { //Number of flights just for pilots at this hub
    $query = "SELECT COUNT(pirepid) as count FROM ".TABLE_PREFIX."pireps WHERE (arricao = '".$icao."' OR depicao = '".$icao."') AND pilotid IN(SELECT pilotid FROM ".TABLE_PREFIX."pilots WHERE hub = '".$icao."')";
    $results = DB::get_row($query);
    return $results->count;
    }
    

    You could probably make it more efficient using a JOIN instead but I don't have time to work it out right now

    Isn't that what he wants? Per pilot from the hub?

  6. i am having 2 issues

    1. I am trying to add rank images to my ranks and when i enter the url for it it doesnt read the image url correctly can some one show me the proper format that the url needs to be in.

    2. I am adding airports and the look up button does not work it will say fetching but nothing happens and i have to manually add airports to my airline, is there a way to fix this?

    1. http://www.yoursite....older/image.jpg

    Doesn't really matter where it's uploaded to, just make sure the path is correct.

    2. http://forum.phpvms....so/#entry111443

  7. You can do #2 by:

    public static function FlightsByPilotByHub($pilotid, $icao) {
    $query = "SELECT COUNT(id) as flights FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND pilotid = '$pilotid' AND accepted = '1'";
    $result = DB::get_row($query);
    return $result->flights;
    }
    

    Not tested.

  8. This looks promising. As I told you before I am already making my own OFP system but it is extremely complex in some aspects. Most of it is OK, however this may be the breakthrough weneed to get it fully functional.

    I've just given it ago, it seems like a simpler solution than I'd thought. I have to agree with Tom.

  9. Only thing I can suggest is that you don't have phpvms_ as your table prefix. Other than that, you could always do

    $startdate = date("Y-m-01");
    $enddate = date("Y-m-t");
    HubStats::TotalHoursBetweenDates('PANC', date("Y-m-01"), date("Y-m-t"));
    

    Shouldn't make a difference but give it shot.

    EDIT: You might have to set your timezone:

    date_default_timezone_set('Europe/London');

    Change as necessary of course.

  10. I use this script in my briefings, so schedule_briefing.tpl.

    If you want it in that, use:

    <?php
    function get_metar($location){
    $fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
           $metar = '';
           $fileData = @file($fileName) or die('METAR not available');
           if ($fileData != false) {
                   list($i, $date) = each($fileData); 
    
                   $utc = strtotime(trim($date));
                   $time = date("D, F jS Y g:i A",$utc);
    
                   while (list($i, $line) = each($fileData)) {
                           $metar .= ' ' . trim($line);
                           }
                   $metar = trim(str_replace('  ', ' ', $metar));
                   }
           echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
    }
    
    echo get_metar($schedule->depicao);
    echo "</br>";
    echo get_metar($schedule->arricao);
    ?>

×
×
  • Create New...