-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.php
76 lines (60 loc) · 2.12 KB
/
display.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
<div >
<ol id="selectable">
<?php $cc=1?>
<script>
var num = 10;
var available = [7,9,8];
var occupied = [4,5,6,10];
var consulted =[1,2,3];
</script>
<?php include "gridFiles.php"; ?>
<script> Grid_genarator(num,available,occupied,consulted)</script>
<form method="post">
<button name="inc">Increment</button>
</form>
<form method="post">
<button name="dec">Decrement</button>
</form>
</ol>
</div>
<?php
if(isset($_POST['inc'])){
if (count($c)>0){
if($c[count($c)-1]<$numOfSlots){
$last=$c[count($c)-1];
$nxt=$last+1;
if(in_array($nxt,$a)){
$key=array_search($nxt,$a);
\array_splice($a, $key, 1);
array_push($c,$nxt);
}
else if(in_array($nxt,$o)){
$key=array_search($nxt,$o);
\array_splice($o, $key, 1);
array_push($c,$nxt);
}
$SlotID=$startingSlotIDNumbers[$n]+$nxt-1;
//code to update slot status
}
else if($c[count($c)-1]==$numOfSlots){
}
}
else if(count($c)==0){
if(in_array(1,$a)){
\array_splice($a, 1, 1);
array_push($c,1);
}
else if(in_array(1,$o)){
\array_splice($o, 1, 1);
array_push($c,1);
}
$slotID=$startingSlotIDNumbers[$n];
}
}
if(isset($_POST['dec'])){
// $last=end($c);
// if($last<$numOfSlots){
// }
echo "dddd";
}
?>