-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortingfunctions.php
More file actions
72 lines (64 loc) · 1.69 KB
/
sortingfunctions.php
File metadata and controls
72 lines (64 loc) · 1.69 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
<?php
function byHighest($a, $b) {
$highestA = max(strlen($a['blackstickers']), strlen($a['greystickers']), strlen($a['whitestickers']));
$highestB = max(strlen($b['blackstickers']), strlen($b['greystickers']), strlen($b['whitestickers']));
return strnatcmp($highestA, $highestB);
}
function byAlpha($a, $b) {
return strnatcmp($a["classname"],$b["classname"]);
}
function byFacil($a, $b) {
return strnatcmp($a["facilitator"],$b["facilitator"]);
}
function byCategory($a, $b) {
return strnatcmp($a["category"],$b["category"]);
}
function byBlock($a, $b) {
return strnatcmp($a["block"],$b["block"]);
}
function byBlackStickers($a, $b) {
$aStickers = explode(',', $a["blackstickers"]);
if (in_array($_SESSION['id'], $aStickers)) {
$astr = "a";
} else {
$astr = "b";
}
$bStickers = explode(',', $b["blackstickers"]);
if (in_array($_SESSION['id'], $bStickers)) {
$bstr = "a";
} else {
$bstr = "b";
}
return strnatcmp($astr,$bstr);
}
function byGreyStickers($a, $b) {
$aStickers = explode(',', $a["greystickers"]);
if (in_array($_SESSION['id'], $aStickers)) {
$astr = "a";
} else {
$astr = "b";
}
$bStickers = explode(',', $b["greystickers"]);
if (in_array($_SESSION['id'], $bStickers)) {
$bstr = "a";
} else {
$bstr = "b";
}
return strnatcmp($astr,$bstr);
}
function byWhiteStickers($a, $b) {
$aStickers = explode(',', $a["whitestickers"]);
if (in_array($_SESSION['id'], $aStickers)) {
$astr = "a";
} else {
$astr = "b";
}
$bStickers = explode(',', $b["whitestickers"]);
if (in_array($_SESSION['id'], $bStickers)) {
$bstr = "a";
} else {
$bstr = "b";
}
return strnatcmp($astr,$bstr);
}
?>