ladder_new.php
4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
session_start();
require_once 'classes/realops.php';
$get = new Get();
date_default_timezone_set('Australia/Sydney');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'sections/header.php'; ?>
</head>
<body>
<div class="wrapper">
<?php include 'sections/navbar.php' ?>
<div class="container" id="realops-container">
<div class="row">
<article class="col-sm-12 panel panel-default" id="realops-body">
<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++; } } ?>
</article>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.wrapper -->
<?php include 'sections/footer.php'; ?>