Jump to content

freshJet

Members
  • Posts

    1470
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by freshJet

  1. The SQL DATE function is needed.

    public static function TotalHoursBetweenDates($icao, $startdate, $enddate) { //Count total hours
    $query = "SELECT SUM(flighttime) as hours FROM phpvms_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND DATE(submitdate) >= '$startdate' AND DATE(submitdate) =< '$enddate'";
    $result = DB::get_row($query);
    return $result->hours;
    }

    That should be it now ;)

  2. This was originally a cry for help, but here's a nifty piece of code for you all to use. It shows the top five most frequent flights flown bu the airline.

    public function topRoutes(){
    $query = "SELECT depicao, arricao, COUNT(*) AS count FROM phpvms_pireps GROUP BY depicao, arricao ORDER BY count DESC LIMIT 5";
    $results = DB::get_results($query);
    return $results;
    }
    

    You can then return the depicao, arricao and count.

    • Like 1
  3. From my PM to Taran, for those interested:

    Using manual dates:

    $start = strtotime("2014-1-1");
    $end= strtotime("2014-2-1");

    If you are doing these dynamically, you need to use:

    $start = date("Y-m-01");
    $end = date("Y-m-t");

  4. Using the bids page as an example, how can success/error messages be displayed at the top of the page?

    For example, if a bid is removed, show the success message at the top of the page. Currently, mine redirects to a new page just to show the message so you then have to go back to view them again.

    I think this is a default function but I did some modifications a while back.

  5. 1. I don't have this module, so I can only guess the module's code.

    In the module's class file (core/common):

    $weekago = strftime("d/m/Y", date() - 60*60*24*7);

    An then, in the SQL code that retrieves the PIREPs, add this:

    AND submitdate > '$weekago'

    2. Here's an example for the most flights per pilot for this month. Variables might not be correct in the table I'm afraid, I'm doing this quickly.

    <table>
    <?php
    $month = date('m');
    $year = date('Y');
    $mostflights = TopPilot::top_pilot_flights($month, $year, 5);
    
    foreach($mostflights as $flight){
    <tr>
    <td><?php echo $flight->pilotid;?></td>
    <td><?php echo $flight->flights;?></td>
    </tr>
    }
    ?>
    </table>
    

    Both untested, give it a go.

  6. <aside>, <section> and <article> are not HTML tags. Use <div> instead.

    Your basic answer is to do this in your CSS:

    #sidebar {
    float:left;
    width:20%;
    }
    
    #main {
    float:left;
    width:70%;
    }
    

    The percentages deliberately add up to 90% to allow for margins and padding.

    Then, in your layout.tpl:

    <div id="sidebar">
    <!-- sidebar content goes here -->
    </div>
    
    <div id="main">
    <?php echo $page_content;?>
    </div>
    

×
×
  • Create New...