-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path5_fdc_dashboard.php
More file actions
209 lines (150 loc) · 5.14 KB
/
5_fdc_dashboard.php
File metadata and controls
209 lines (150 loc) · 5.14 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
session_start();
if(!isset($_SESSION['loggedInUser'])){
//send them to login page
header("location:index.php");
}
//connect to database
include("includes/connection.php");
include_once("includes/functions.php");
$fid = $_SESSION['Fac_ID'];
$ans = 'yes';
$fid = $_SESSION['Fac_ID'];
$query1 = "SELECT * FROM faculty where FDC_Y_N = 'no'";
$result1 = mysqli_query($conn,$query1);
if(mysqli_num_rows($result1)>0 ){
//we have data to display
while($row =mysqli_fetch_assoc($result1)){
$paperTitle = $row['Paper_title'];
$query2 = "delete * FROM fdc where Fac_ID = $fid and Paper_title = '$paperTitle'";
$result2 = mysqli_query($conn,$query2);
}
}
//query and result
$query = "SELECT * FROM fdc where Fac_ID ='".$_SESSION['Fac_ID']."';";
$result = mysqli_query($conn,$query);
$successMessage="";
if(isset($_GET['alert'])){
if($_GET['alert']=="success"){
$successMessage='<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
</button>
<strong>Record added successfully</strong>
</div>';
}
elseif($_GET['alert']=="update"){
$successMessage='<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
</button>
<strong>Record updated successfully</strong>
</div>';
}
elseif($_GET['alert']=="delete"){
$successMessage='<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
</button>
<strong>Record deleted successfully</strong>
</div>';
}
}
?>
<?php include_once('head.php'); ?>
<?php include_once('header.php'); ?>
<?php
if($_SESSION['username'] == 'hodextc@somaiya.edu' || $_SESSION['username'] == 'member@somaiya.edu')
{
include_once('sidebar_hod.php');
}
else
include_once('sidebar.php');
?>
<style>
div.scroll
{
overflow:scroll;
}
</style>
<div class="content-wrapper">
<?php
{
echo $successMessage;
}
?>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h2 class="box-title">FDC details</h2>
</div><!-- /.box-header -->
<div class="box-body">
<div class="scroll">
<table class="table table-stripped table-bordered " id = 'example1'>
<thead>
<tr>
<th>Paper</th>
<th>Minutes No.</th>
<th>Serial No.</th>
<th>Period</th>
<th>OD approved</th>
<th>OD availed</th>
<th>Fee Sanctioned</th>
<th>Fee availed</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<?php
if(mysqli_num_rows($result)>0 ){
//we have data to display
while($row =mysqli_fetch_assoc($result)){
if ($row['period'] == 0)
{
$ans1 = "vacational";
}
else if ($row['period'] == 1)
$ans1 = "non vacational";
echo "<tr>";
echo "<td>".$row['Paper_title']."</td>";
echo "<td>".$row['min_no']."</td>";
echo "<td>".$row['serial_no']."</td>";
echo "<td>".$ans1."</td>";
echo "<td>".$row['od_approv']."</td>";
echo "<td>".$row['od_avail']."</td>";
echo "<td>".$row['fee_sac']."</td>";
echo "<td>".$row['fee_avail']."</td>";
$_SESSION['FDC_ID'] = $row['FDC_ID'];
echo "<td>
<form action = '5_fdc_edit.php' method = 'POST'>
<input type = 'hidden' name = 'id' value = '".$row['FDC_ID']."'>
<button type = 'submit' class = 'btn btn-primary btn-sm'>
<span class='glyphicon glyphicon-edit'></span>
</button>
</form>
</td>";
echo "<td>
<form action = '5_fdc_delete.php' method = 'POST'>
<input type = 'hidden' name = 'id' value = '".$row['FDC_ID']."'>
<button type = 'submit' class = 'btn btn-primary btn-sm'>
<span class='glyphicon glyphicon-trash'></span>
</button>
</form>
</td>";
echo"</tr>";
}
}
else{
//if ther are no entries
echo "<div class='alert alert-warning'>You have no fdc</div>";
}
?>
</table>
</div>
<a href="2_dashboard.php" type="button" class="btn btn-primary">Skip</a>
</div>
</div>
</div>
</div>
</section>
</div>
<?php include_once('footer.php'); ?>