-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilities.php
More file actions
38 lines (34 loc) · 848 Bytes
/
utilities.php
File metadata and controls
38 lines (34 loc) · 848 Bytes
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
<?php
define("SQL_GP_WITH_BOCK", " SUM(game_points) ");
define("SQL_GP_WITHOUT_BOCK", " SUM(CASE WHEN bock THEN game_points / 2 ELSE game_points END) ");
function highlight_diff($difference)
{
echo "(";
if ($difference > 0) {
echo "<span style=\"color:green\">+";
} else if ($difference < 0) {
echo "<span style=\"color:red\">";
}
echo number_format($difference * 100, 3);
if ($difference != 0) {
echo "</span>";
}
echo ")";
}
function table_sort($array, $key, $order = "DESC")
{
for ($i = 0; $i < sizeof($array); $i++) {
$sort_values[$i] = $array[$i][$key];
}
if ($order == "DESC") {
arsort($sort_values);
} else {
asort($sort_values);
}
reset($sort_values);
while (list ($arr_key, $arr_val) = each($sort_values)) {
$sorted_arr[] = $array[$arr_key];
}
return $sorted_arr;
}
?>