forked from nisiya/MaristIDCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_student_program_home.php
119 lines (119 loc) · 5.09 KB
/
edit_student_program_home.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!--Shows programs enrollment info for student-->
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<?php
$title = "IDCP - Edit Student's Programs";
$page = 'student';
$page_name = 'edit_stu_prg';
require('includes/header.php');
# Connect to MySQL server and the database
require( 'includes/connect_db_c9.php' ) ;
# Includes these helper functions
require( 'includes/student_helpers.php' ) ;
$stu_id = $_SESSION['STU_ID'];
?>
<!-- Bread Crumbs -->
<ol class = "breadcrumb">
<li><a href = "home.php">Home</a></li>
<li><a href = "student.php">Student</a></li>
<li><a href = "student_search.php">Student Search</a></li>
<li><a href = "student_profile.php">Student Profile</a></li>
<li class = "active">Student Program Info</li>
</ol>
<!-- Page Content -->
<div id="page-content-wrapper" style="margin-left: 50px;">
<div class="container-fluid">
<div class="dropdown">
<div class="row">
<div class="page-header">
<?php
$stu_id = $_SESSION['STU_ID'];
$name = get_stu_name($dbc, $stu_id);
if($user_role != "User")
echo '<h1>Programs for ' . "$name" . ' <small>Click a row to edit</small></h1>';
else
echo '<h1>Programs for ' . "$name" . '</h1>';
?>
</div>
</div>
<div class = "row">
<div class = "butspan" style = "width: 300px;">
<button type="button" class="btn btn-primary btn-block" style = "margin-right: 50px; height: 50px; <?php if($user_role=='User') echo 'display:none;';?> " onclick="location.href='add_edit_student_program.php';">Add a Program</button>
</div>
</div>
<div class="row">
<h3>Active Programs</h3>
</div>
<!--List the student's active courses-->
<div class="row">
<?php
$stu_id = $_SESSION['STU_ID'];
show_active_programs($dbc, $stu_id);
?>
</div>
<div class="row">
<h3>Completed Programs</h3>
</div>
<!--List the student's completed courses-->
<div class="row">
<?php
show_completed_programs($dbc, $stu_id);
?>
</div>
<div class="row">
<h3>Inactive Programs</h3>
</div>
<!--List the student's completed courses-->
<div class="row">
<?php
show_inactive_programs($dbc, $stu_id);
?>
</div>
<div class="row">
<div class = "butspan" style = "width: 300px;">
<button class="btn btn-default" onclick ="location.href='student_profile.php';">Back to Profile</button>
<button class="btn btn-primary" style="<?php if($user_role=='User') echo 'display:none;';?>" onclick ="location.href='add_edit_student_program.php';">Add a Program</button>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<!--Footer-->
<?php require('includes/footer.php'); ?>
</div>
<!-- /#wrapper -->
<!--<script type="text/javascript" src="js/jquery.js"></script>-->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Validator Bootstrap Plugin-->
<script src="js/validator.js"></script>
<?php if($user_role != "User"){ ?>
<!--Makes table rows clickable-->
<script>
jQuery(document).ready(function($) {
$('.table > tbody > tr').click(function() {
var prgname = $(this).find('td:first').text();
var prgenrollstart = $(this).find('td:nth-child(2)').text();
jQuery.ajax({
url: 'backendprg.php',
type: 'POST',
data: {
'PRG_NAME': prgname,
'PRG_ENROLL_START': prgenrollstart,
},
dataType : 'json',
success: function(data, textStatus, xhr) {
window.location.href = "edit_student_program.php";
console.log(data); // do with data e.g success message
},
error: function(xhr, textStatus, errorThrown) {
console.log(textStatus.reponseText);
window.location.href = "edit_student_program.php";
}
});
});
});
</script>
<?php } ?>
</body>
</html>