//=$_POST["locations"]; populateMapArray($locArray); } ?> <html> <head> <link rel="stylesheet" type="text/css" href="./local-map.css"> <title>Test page</title> </head> <body> <div align="center"><?php fake_main(); genMatrix(); ?> </div> <div style="float:right"> <form method="POST" action=""> <table name="nav_buttons" border=0 align="center"> <tr> <td></td> <td><button>UP</button></td> <td></td> </tr> <tr> <td><button>LEFT</button></td> <td></td> <td><button>RIGHT</button></td>
{ $alloted = array(); $freeSlots = array(); $temp; foreach ($matrix as $course => $rooms) { $alloted[$course] = False; $temp = $course; } foreach ($matrix[$temp] as $room => $value) { $freeSlots[$room] = [1, 2, 3, 4, 5]; } foreach ($matrix as $course => $rooms) { if (!$alloted[$course]) { foreach ($matrix[$course] as $room => $value) { if (count($freeSlots[$room]) > 0 and ($value > 0.8 and $value <= 1)) { $alloted[$course] = [$room, $freeSlots[$room][0]]; unset($freeSlots[$room][0]); $freeSlots[$room] = array_values($freeSlots[$room]); // var_dump($freeSlots[$room]); // echo count($freeSlots[$room]).", "; } } } } return $alloted; } $matrix = genMatrix("time_tables/roomCap.csv", "time_tables/courseCap.csv"); // printArr($matrix["CVL774"]); $t = allotPlan($matrix); // print count($t)."<br>"; // printArr(allotPlan($matrix));