-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathviewtraining.php
182 lines (166 loc) · 5.22 KB
/
viewtraining.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
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
<?php
include("sqlcon.php");
if(!isset($_SESSION['type']))
{
echo "<script>window.location=index.php;</script>";
}
if(isset($_GET[aid]))
{
$date = date("Y-m-d");
$rs = mysqli_query($con,"insert into tbltrainingappln(trainid,alimniid,confirmdate,status) values(".$_GET[aid].",".$_SESSION[uid].",$date,Pending)");
if($rs)
{
echo "<script>alert(Success!!);window.location=viewtraining.php</script>";
}
}
/* ### */ ?>
<?php
include("header.php")
/* ### */ ?>
<div class="container">
<div class="page">
<h3>View Training</h3>
<?php
if($_SESSION['type'] == "admin")
{
/* ### */ ?>
<div style="text-align:right; padding-right:20px;">
<a href="training.php">
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add New</button></a>
<p> </p>
<div class="btn-group">
</div>
</div>
<?php
}
/* ### */ ?>
<div class="bs-example" data-example-id="contextual-table" style="border: 1px solid #eee">
<table class="table" id="dataTables-example">
<thead>
<tr>
<th >#</th>
<th >Topic Name</th>
<th >Description</th>
<th >Course</th>
<th >Detail</th>
<th>Reference contact</th>
<th >Participation Last Date</th>
<?php
if($_SESSION['type'] == "admin")
{
echo "<th>View Participants</th>";
}
/* ### */ ?>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$qry = "Select * from tbltraining inner join tblcourse on tbltraining.courseid=tblcourse.courseid where status=Active and trainingdate >= CURDATE() order by trainingid desc";
$res = mysqli_query($con, $qry);
$c = 1;
if(mysqli_num_rows($res) > 0)
{
while($row = mysqli_fetch_array($res))
{ echo "<tr>
<td>".$c++."</td>
<td>".$row[1]."</td>
<td>".$row[2]."</td>
<td>".$row[coursename]."</td>
<td>Training Date: ".$row[trainingdate]."<br/>Duration: ".$row[duration]." hr. <br/>Venue: ".$row[venue]."</td>
<td>Name: ".$row[refcontactname]."<br/>Phone: ".$row[refcontactno]."</td>
<td>".$row[participationdate]."</td>";
if($_SESSION['type'] == "alumni")
{
$rst = mysqli_query($con, "select * from tbltrainingappln where trainid=$row[0] and alimniid=".$_SESSION[uid]);
if(mysqli_num_rows($rst) > 0)
{
$r = mysqli_fetch_array($rst);
echo "<td>Already Participated.<br/> Status: ".$r[4]."</td>";
}
else{
$date1 = date("Y/m/d");
if(strtotime($date1) <= strtotime($row[trainingdate]))
{
echo "<td><a href=viewtraining.php?aid=$row[0]>Participate</a></td>";
}
else
{
echo "<td>Participation Closed</td>";
}
}
}
else if($_SESSION['type'] == "admin")
{
echo "<td> <a href=#myModalEdit class=open-EditRow id=custId data-toggle=modal data-id=".$row[0]." data-backdrop=static data-keyboard=false>View Participants</a></td>";
echo "<td><a href=viewtraining.php?id=$row[0] >Delete</a> / <a href=training.php?eid=$row[0]>Edit</a></td>";
}
echo "</tr>";
}
}
/* ### */ ?>
</tbody>
</table>
<div class="modal fade" id="myModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Paricipants List</h4>
</div>
<div class="modal-body">
<div class="fetched-data">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="DataTables-1.10.12/extensions/Buttons/css/buttons.dataTables.css">
<link rel="stylesheet" type="text/css" href="DataTables-1.10.12/media/css/jquery.dataTables.css">
<script type="text/javascript" language="javascript" src="DataTables-1.10.12/media/js/jquery.dataTables.js">
</script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.12/extensions/Buttons/js/dataTables.buttons.js">
</script>
<script type="text/javascript" language="javascript" src="Stuk-jszip-6d2b991/dist/jszip.min.js">
</script>
<script type="text/javascript" language="javascript" src="pdfmake-master/build/pdfmake.min.js">
</script>
<script type="text/javascript" language="javascript" src="pdfmake-master/build/vfs_fonts.js">
</script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.12/extensions/Buttons/js/buttons.html5.js">
</script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.12/examples/resources/syntax/shCore.js">
</script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.12/examples/resources/demo.js">
</script>
<script>
$(document).ready(function () {
$(#dataTables-example).dataTable({
dom: Bfrtip,
lengthMenu: [
[ 10, 25, 50, -1 ],
[ 10 rows, 25 rows, 50 rows, Show all ]
],
buttons: [
pageLength,
pdfHtml5
]
} );
});
</script>
<?php
include("footer.php");
/* ### */ ?>
<script>
$(.open-EditRow).click(function(){
$(#myModalEdit).on(show.bs.modal, function (e) {
var rowid = $(e.relatedTarget).data(id);
$(.fetched-data).load("participant.php?edit_id="+rowid);
});
});
</script>