-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
64 lines (51 loc) · 1.68 KB
/
categories.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
<?php
/**
* Created By: Hisham Shawky
* Email: [email protected]
*/
// Require Config
require_once $_SERVER['DOCUMENT_ROOT'] . '/answers/inc/config.php';
// Check if the id is empty
if (empty($_GET['id']))
header("Location:".BASE_URL."");
// Get header
include ROOT_BATH . '/template-parts/header.php';
// Check if the id isset
if (isset($_GET['id'])) {
$lessons = read_lessons($_GET['id']);
$lesson_num = 1;
} else
header("Location:".BASE_URL."");
?>
<div class="container">
<main class="col-sm-8" id="main" role="main">
<section class="lessons">
<h2>الدروس الحالية: </h2>
</section>
<table class="table table-responsive table-bordered">
<thead>
<tr>
<th>رقم الدرس</th>
<th>عنوان الدرس</th>
</tr>
</thead>
<tbody>
<?php
foreach ($lessons as $lesson) :
$lesson_title = $lesson['title'];
$lesson_id = intval($lesson['id']);
$lesson_url = BASE_URL."/lessons.php?id={$lesson_id}&lesson_name=".urlencode($lesson_title);
?>
<tr>
<td class="text-center"><h4><?php echo $lesson_num++ ?></h4></td>
<td><a href="<?php echo $lesson_url ?>"><h4><?php echo $lesson_title?></h4></a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</main>
<aside id="sidbar" role="sidebar">
</aside>
</div>
<?php // Get Footer
include ROOT_BATH . '/template-parts/footer.php';