-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanageClasses.php
72 lines (67 loc) · 3.98 KB
/
manageClasses.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
<?php
include 'header.php';
checkAndRedirectNotAuthorizedUsers($_SESSION, array("ADMIN", "SECRETARY"));
?>
<script src="classesAjax.js"></script>
<script src="formSubmitAjax.js"></script>
<div class="formContainer">
<div id="msg"></div>
<div class="class" id="add">
<h4>Add Class</h4>
<form action="manageClassesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityAdd');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentAdd');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedProfessorId', 'selectedProfessorAdd');
echo generateDropDownListWithFirstOption(null, "Select Professor First", 'selectedCourseId', 'selectedCourseAdd');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' name='selectedDepartmentId' id='selectedDepartmentIdSec' value='$departmentId'>";
echo generateDropDownListWithSpecifiedValueKey(getProfessors($departmentId), 'selectedProfessorId', 'selectedProfessorAddSec', 'professorId', 'professorUsername');
echo generateDropDownListWithSpecifiedValueKey(getCourses($departmentId), 'selectedCourseId', 'selectedCourseAddSec', 'courseId', 'courseName');
}
?>
<input type="text" name="className" placeholder="Class Name"><br>
<input type="submit" name="submit" value="add">
</form>
</div>
<div class="class" id="rename">
<h4>Rename Class</h4>
<form action="manageClassesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityChange');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentChange');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedClassId', 'selectedClassChange');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithSpecifiedValueKey(getClasses($departmentId), 'selectedClassId', 'selectedClassChange', 'classId', 'className');
}
?>
<input type="text" name="className" placeholder="Class Name"><br>
<input type="submit" name="submit" value="rename">
</form>
</div>
<div class="class" id="remove">
<h4>Remove Class</h4>
<form action="manageClassesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityRemove');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentRemove');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedClassId', 'selectedClassRemove');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithSpecifiedValueKey(getClasses($departmentId), 'selectedClassId', 'selectedClassRemove', 'classId', 'className');
}
?>
<input type="submit" name="submit" class="warningButton" value="remove">
</form>
</div>
</div>
<?php
include 'footer.php';
?>