-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoreTable.php
98 lines (87 loc) · 2.51 KB
/
scoreTable.php
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
<?php
if(!isset($_SESSION["username"])){
echo "<h1>Bu Sayfaya Girmeye Yetkiniz Yok</h1>";
header("Refresh: 2; url=index.php");
exit;
}
session_start();
ob_start();
$skorTablosu = $db->query("SELECT * FROM skortablosu20192020",PDO::FETCH_ASSOC)->fetchAll();
$takimIsim = $db->query("SELECT * FROM takim",PDO::FETCH_ASSOC)->fetchAll();
function quickSort($arr)
{
$count = count($arr);
if ($count < 2) {
return $arr;
}
$leftArray = $rightArray = array();
$middle = $arr[0];
for($i = 1; $i < $count ; $i++){
if($middle->puan < $arr[$i]->puan){
$leftArray[] = $arr[$i];
}elseif($middle->puan == $arr[$i]->puan) {
if($middle->avaraj < $arr[$i]->avaraj){
$leftArray[] = $arr[$i];
}else{
$rightArray[] = $arr[$i];
}
}else{
$rightArray[] = $arr[$i];
}
}
$leftArray = quickSort($leftArray);
$rightArray = quickSort($rightArray);
return array_merge($leftArray, array($middle), $rightArray);
}
$takimlarDizisi = quickSort($takimlarDizisi);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="scoreTable.css">
<title>Document</title>
</head>
<body>
<div class="ptable" >
<h1 class="headin">Skor Tablosu</h1>
<table>
<tr class="col">
<th>#</th>
<th>Team</th>
<th>O</th>
<th>G</th>
<th>B</th>
<th>M</th>
<th>A</th>
<th>Y</th>
<th>AV</th>
<th>P</th>
</tr>
<?php
$sira = 0;
for($i = 0 ; $i <=22;$i++)
{ ?>
<tr class=<?php
if($i <= 3){ echo "wpos";}else{ echo "pos";} ?>>
<?php
$id = $skorTablosu[$i]['takimId'];
if($takimlarDizisi[$i]->oynananmac != 0){ $sira++;
?>
<td><?php echo $sira ?></td>
<td><?php echo $takimlarDizisi[$i]->takimAdi?></td>
<td><?php echo $takimlarDizisi[$i]->oynananmac?></td>
<td><?php echo $takimlarDizisi[$i]->galibiyet?></td>
<td><?php echo $takimlarDizisi[$i]->beraberlik?></td>
<td><?php echo $takimlarDizisi[$i]->maglubiyet?></td>
<td><?php echo $takimlarDizisi[$i]->atilangol?></td>
<td><?php echo $takimlarDizisi[$i]->yenilengol?></td>
<td><?php echo $takimlarDizisi[$i]->avaraj?></td>
<td><?php echo $takimlarDizisi[$i]->puan?></td>
<?php } } ?>
</table>
</div>
</body>
</html>