forked from nisiya/MaristIDCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructor_profile.php
130 lines (129 loc) · 5.03 KB
/
instructor_profile.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
120
121
122
123
124
125
126
127
128
129
130
<!--Shows more information about a course-->
<?php
$title = "IDCP - Instructor Profile";
$page = 'idcp_settings';
$page_name = 'idcp_instructor';
require('includes/header.php');
require( 'includes/connect_db_c9.php' ) ;
require( 'includes/instructor_helpers.php' ) ;
$ins_lname = $_SESSION['INS_LNAME'];
$ins_fname = $_SESSION['INS_FNAME'];
$query = "SELECT INS_ID FROM INSTRUCTOR WHERE INS_FNAME = '$ins_fname' AND INS_LNAME = '$ins_lname'";
$result = mysqli_query($dbc, $query);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC) ;
$ins_id = $row['INS_ID'];
$_SESSION['INS_ID'] = $ins_id;
?>
<style>
.inline {
display: inline;
}
.link-button {
background: none;
border: none;
}
.link-button:focus {
outline: none;
}
.link-button:hover {
outline: none;
}
.link-button:active {
color:white;
}
</style>
<!-- Bread Crumbs -->
<ol class = "breadcrumb">
<li><a href = "home.php">Home</a></li>
<li><a href = "idcp_settings.php">IDCP Settings</a></li>
<li><a href = "instructor_search.php">Search Instructor</a></li>
<li class = "active">Instructor Profile</li>
</ol>
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="page-header">
<h1>
<?php
echo $ins_fname . " " . $ins_lname;
?>
</h1>
</div>
<div class="row">
<div class="col-sm-4">
<div class="panel panel-red">
<div class="panel-heading">
<h3 class="panel-title">Instructor Info</a></h3>
</div>
<div class="panel-body">
<div class="form-group">
<p><label>First Name: </label><br>
<?php
echo $ins_fname;
?>
</p>
<p><label>Last Name:</label><br>
<?php
echo $ins_lname;
?>
</p>
<p><label>Initial:</label><br>
<?php
echo get_ins_initial($dbc, $ins_id);
?>
</p>
<p><label>Email:</label><br>
<?php
echo get_ins_email($dbc, $ins_id);
?>
</p>
<button class="btn btn-default btn-sm" style="<?php if($user_role=='User') echo 'display:none;';?>" onclick ="location.href='edit_instructor.php';">Edit</button>
</div>
</div>
</div>
<h3>Courses Being Taught<br><small>Click on a course to view it</small></h3><hr>
<?php
echo get_ins_courses($dbc, $ins_id);
?>
<button class="btn btn-default btn-sm" onclick ="location.href='instructor_search.php';">Back</button>
<!--<button class="btn btn-danger btn-sm" style="<?php if($user_role=='User') echo 'display:none;';?>" onclick ="location.href='delete_course_confirm.php';">Delete Course</button>-->
</div>
</div>
</div>
<!-- /#container close -->
</div>
<!-- /#page-content-wrapper -->
<!--Footer-->
<?php require('includes/footer.php'); ?>
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script>
//Clicking on table row redirects user to course profile page
jQuery(document).ready(function($) {
$('.table > tbody > tr').click(function() {
var value = $(this).find('td:first').text();
jQuery.ajax({
url: 'backendcrs.php',
type: 'POST',
data: {
'CRS_ID': value,
},
dataType : 'json',
success: function(data, textStatus, xhr) {
window.location.href = "course_profile.php";
console.log(data); // do with data e.g success message
},
error: function(xhr, textStatus, errorThrown) {
console.log(textStatus.reponseText);
window.location.href = "course_profile.php";
}
});
});
});
</script>
</body>
</html>