This commit is contained in:
Marcel Kapfer (mmk2410) 2016-04-10 19:18:26 +02:00
parent ab70dabcd7
commit a39fde6e01
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -10,8 +10,8 @@
function getFullDay($day) { function getFullDay($day) {
if ($day == "Mon") { if ($day == "Mon") {
return "Monday"; return "Monday";
} else if ($day == "Thu") { } else if ($day == "Tue") {
return "Thusday"; return "Tuesday";
} else if ($day == "Wed") { } else if ($day == "Wed") {
return "Wednesday"; return "Wednesday";
} else if ($day == "Thur") { } else if ($day == "Thur") {
@ -210,7 +210,7 @@ if ($conn->error) {
</section> </section>
<?php <?php
} }
$days = array("Mon", "Thu", "Wed", "Thur", "Fri"); $days = array("Mon", "Tue", "Wed", "Thur", "Fri");
foreach ($days as $day) { foreach ($days as $day) {
$sql = "SELECT * FROM Titama WHERE day='$day'"; $sql = "SELECT * FROM Titama WHERE day='$day'";
$res = $conn->query($sql); $res = $conn->query($sql);
@ -219,19 +219,23 @@ foreach ($days as $day) {
<section class="card"> <section class="card">
<div class="headline"><?php echo getFullDay($day) ?></div> <div class="headline"><?php echo getFullDay($day) ?></div>
<?php <?php
$courses = $res->fetch_all(); $courses = array();
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$courses[] = $row;
}
usort($courses, function($a, $b) { usort($courses, function($a, $b) {
return $a[5] - $b[5]; return $a[5] - $b[5];
}); });
foreach ($courses as $course) { foreach ($courses as $course) {
?> ?>
<div class="course"> <div class="course">
<div class="c_name" id="c_name_<?php echo $course[0] ?>"><?php echo $course[1]; ?></div> <div class="c_name" id="c_name_<?php echo $course["id"] ?>"><?php echo $course["name"]; ?></div>
<div class="c_time"><?php echo $course[5]; ?>:00</div> <div class="c_time"><?php echo $course["time"]; ?>:00</div>
<div class="c_id">Id: <?php echo $course[0]; ?></div> <div class="c_id">Id: <?php echo $course["id"]; ?></div>
<div class="c_kind">Kind: <?php echo $course[2]; ?></div> <div class="c_kind">Kind: <?php echo $course["kind"]; ?></div>
<div class="c_place">Place: <?php echo $course[3]; ?></div> <div class="c_place">Place: <?php echo $course["room"]; ?></div>
<div class="c_prof">Prof: <?php echo $course[6]; ?></div> <div class="c_prof">Prof: <?php echo $course["prof"]; ?></div>
</div> </div>
<?php <?php
} }
@ -282,7 +286,7 @@ include './res/php/closedb.php';
</form> </form>
</section> </section>
</section> </section>
<div class="footer">Marcel Kapfer (mmk2410) - 2015</div> <div class="footer">Marcel Kapfer (mmk2410) - 2015-2016</div>
<script src="./res/jquery-2.1.4.min.js"></script> <script src="./res/jquery-2.1.4.min.js"></script>
<script src="./res/js/titama.js"></script> <script src="./res/js/titama.js"></script>
</body> </body>