forked from Mahmoudb7/faculty_meeting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_formation.php
103 lines (94 loc) · 4.16 KB
/
add_formation.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
require_once "db.php";
require_once "functions.php";
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
?>
<!DOCTYPE html>
<html lang="en">
<?php
Head("اضافة تشكيل");
?>
<body dir="rtl">
<?php Headers(); ?>
<?php if (is_admin()): ?>
<?php Nav();?>
<main class="add-member-page">
<div class="container">
<?php
$last_formation_stmt = $conn->prepare("SELECT
formation_number
FROM
p39_formation
WHERE
formation_id = (SELECT
max(formation_id)
FROM
p39_formation)");
$last_formation_stmt->execute();
$last_formation_result = $last_formation_stmt->get_result();
$last_formation_row = $last_formation_result->fetch_assoc();
@$last_formation_number = $last_formation_row["formation_number"];
?>
<!-- عنوان الصفحة -->
<div class="title">
<h1>إضافة تشكيل جديد</h1>
</div>
<form class="box" method="post" action="addition_code.php" enctype="multipart/form-data">
<div class="col">
<div class="row">
<h4>رقم التشكيل</h4><input type="number" name="formation_number" min="1" required/>
<?php if (!empty(@$last_formation_number)) { ?>
<h6>رقم التشكيل السابق: <?= $last_formation_number ?></h6>
<?php } ?>
</div>
<div class="row">
<h4>الفترة الزمنية</h4>
<div class="select-basic">
<select name="start_year" required>
<option>اختر</option>
<?php
$formation_years_stmt = $conn->prepare("SELECT start_year FROM p39_formation");
$formation_years_stmt->execute();
$formation_years_result = $formation_years_stmt->get_result();
$years = array();
while ($formation_years_row = $formation_years_result->fetch_assoc())
{
$years[] = $formation_years_row["start_year"];
}
$formation_years_stmt->close();
for ($i = date("Y") - 4; $i <= date("Y") + 4; $i++)
{
if (in_array($i, $years))
{
continue;
}
else
{
?>
<option value="<?= $i ?>"><?= ($i + 1) . "-" . $i ?></option>;
<?php
}
}
?>
</select>
</div>
</div>
<div class="row">
<button type="submit" class="btn-basic" name="add_formation_btn">اضافة تشكيل جديد</button>
</div>
</div>
</form>
</div>
</main>
<?php
endif;
footer();
?>
<!-- Js Scripts and Plugins -->
<script type="module" src="./js/main.js"></script>
<!-- font Awesome -->
<script src="https://kit.fontawesome.com/eb7dada2f7.js" crossorigin="anonymous"></script>
</body>
</html>