ladder.php 4.07 KB
<?php 
require_once '/../../realops.php';
$get = new Get();
date_default_timezone_set('Australia/Sydney');
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Virtual Airline Ladder - RealOps</title>
    <?php include 'sections/header.php'; ?>
</head>

<body>
<div class="wrapper">
<?php include 'sections/navbar.php'; ?>
<div class="container-fluid">
    <div class="row">
        <?php include 'sections/sidebar.php'; ?>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h2 class="sub-header">Virtual Airline Ladder<a href="vaRegister.php" class="btn btn-info pull-right">+ Add Virtual Airline</a></h2>
<div class="well">
    <div class="row">
        <?php $leadingVA = $get->leadingVA(); ?>
        <div class="col-md-4 pull-right"><img src="logos/vas/<?php echo $leadingVA['logo']; ?>" /><br /><br /><?php echo $leadingVA['description'] ?></div>
        <div class="col-md-8">

        <div style="font-size:48px;"><strong>#1 - <?php echo $leadingVA['name'] ?><br /></strong> </div>
        <div style="font-size:24px;"><?php echo $leadingVA['value_occurrence'] ?> flights // <a href="<?php echo $leadingVA['url']; ?>"><?php echo $leadingVA['url']; ?></a></div>
        </div>
        
    </div>
</div>
        <div class="panel panel-default">
      <!-- Default panel contents -->
      <div class="panel-heading"><strong>Leading Virtual Airline:</strong><br />
</div>

      <!-- Table -->
      <table class="table">
        <thead>
          <tr>
            <th>#</th>
            <th>Logo</th>
            <th>Name</th>
            <th>Number of Flights</th>
          </tr>
        </thead>
        <tbody>
            <?php $vas = $get->vas(); 
            $position = 0;
            $airlinesArray = array();
foreach($vas as $row)
{ 
    $row['flights'] = $get->totalFlightsForVA($row['id']);
    $airlinesArray[$row['id']]['id'] = $row['id'];
    $airlinesArray[$row['id']]['flights'] = $row['flights']; 
    $airlinesArray[$row['id']]['name'] = $row['name']; 
    $airlinesArray[$row['id']]['logo'] = $row['logo']; 
    $airlinesArray[$row['id']]['url'] = $row['url']; 
    $airlinesArray[$row['id']]['description'] = $row['description']; 
}
    function cmp($a, $b) {
        return $b["flights"] - $a["flights"];
}
    usort($airlinesArray, "cmp");
    foreach($airlinesArray as $row)
    {
    if($previousFlight != $row['flights'])
    {
        $position++;
    }
$previousFlight = $row['flights'];
    ?>
          <tr>
            <th scope="row"><?php echo $position ?></th>
            <td><img src="logos/vas/<?php echo $row['logo'] ?>" style="max-height:20px;" /></td>
            <td><?php if($position == 1) echo "<strong>" . $row['name'] . "</strong>"; else echo $row['name']; ?></td>
            <td><?php echo $row['flights']; ?></td>
          </tr>
         <?php }
?>
        </tbody>
      </table>
    </div>
    <?php $x = 1;

    foreach($airlinesArray as $row)
    {
        if($x == 1)
        {
            $x++;
            continue;
        }
        else
        { 
             ?>
    <div class="col-md-6">
<div class="well">
    
<div style="font-size:24px;"><strong>#<?php echo $x; ?></strong> - <?php echo $row['name']; ?> <img style="max-height:50px; float:right;" src="logos/vas/<?php echo $row['logo'] ?>" /></div>
<?php echo $row['description']; ?><br />
<a class="btn btn-default" target="_blank" href="<?php echo $row['url'] ?>"><?php echo $row['url']; ?></a>
</div>
</div>
<?php $x++; } } ?>
    </div>
</div>
<?php include 'sections/loginBox.php'; ?>


</div>


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<?php include 'sections/footer.php'; ?>
</body>
</html>