-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcertificate.php
355 lines (331 loc) · 7.72 KB
/
certificate.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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?php
session_start();
ob_start();
require_once 'inc/config.php';
require_once 'inc/dataclass.php';
include 'inc/logincode.php';
include 'inc/functions.php';
$dc = new Dataclass();
if (!isset($_GET['cid'])) {
header("location: index.php");
}else{
$cid = $_GET['cid'];
}
$totalcnt=$dc->getRow("select count(contentid) as totalcontent from content where courseid='$cid'");
$totalf=$dc->getRow("select noc,cmpdate from cmprecord where courseid='$cid' and regid='$_SESSION[regid]'");
if ($totalf['noc'] == '') {
$totalf['noc'] = 0;
}
if ($totalf['noc'] != $totalcnt['totalcontent']) {
header("location: index.php");
}
$gname = $dc->getRow("(SELECT instname as name FROM instructor WHERE regid = '$_SESSION[regid]') UNION (SELECT name as name FROM student WHERE regid = '$_SESSION[regid]')");
$getc = $dc->getRow("select c.coursename,i.instname from course c, instructor i where c.instid = i.regid and c.courseid = '$cid'");
?>
<html>
<head>
<title>Certificate</title>
<link rel="stylesheet" href="assests/libs/fontawesome/css/fontawesome-all.min.css" />
<style type="text/css">
@font-face {
src: url("assests/font/AB.ttf");
font-family: abfont;
}
.abfont{
font-family: abfont;
}
.myDiv
{
height:550px;
width:75%;
position:relative;
margin:0 auto;
margin-top:30px;
padding: 15px;
border:1px solid #ccc;
background:linear-gradient(to right,rgb(255,255,255),rgb(251,251,251),rgb(237,237,237),rgb(251,251,251),rgb(233,233,233));
border:3px solid #ccc;
box-shadow:0 0 10px rgba(0,0,0,.5),0 0 10px 5px rgba(255,255,255,.5),0px 0px 10px 13px rgba(0,0,0,.3);
overflow:hidden;
}
.certihead
{
width:100%;
position:relative;
left:19%;
transform:translateX(-10%);
top:5%;
}
.certihead img
{
width:120px;
height:50px;
padding:10px 3px;
}
.certi
{
margin:0;
margin-top:12px;
padding:0;
font-size:45px;
color:rgb(176,59,56);
font-family:Algerian;
text-shadow:0 4px 5px rgba(0,0,0,.5);
}
.subcerti
{
position:relative;
font-size:23px;
bottom:10px;
color:rgb(166,166,166);
font-family:Calibri Light;
text-shadow:none;
font-weight:900;
}
.stamp
{
width:255px;
height:255px;
position:absolute;
right:13%;
top:20%;
}
.stamp img
{
width:100%;
height:100%;
}
.stamp h4
{
position:absolute;
top:30%;
left:50%;
transform:translate(-50%,-50%);
font-weight:bold;
color:#fff;
}
.certicontent
{
margin-top:5%;
margin-left:16%;
padding-top:25px;
padding-bottom:2px;
padding-left:2.5%;
border-left:6px solid rgb(144,59,57);
border-radius:2px;
}
.certicontent p,span
{
font-size:21px;
font-family:Arial;
font-weight:bold;
color:#796464;
margin:0;
padding:0;
}
.certicontent h1
{
margin:5px;
padding:0;
font-size:50px;
font-family:Brush Script MT;
}
.certicontent h3{
margin-top:5px;
padding:0;
font-size:30px;
font-family:Arial;
color:#542626;
}
.signature
{
width:60%;
height:100px;
margin:0 auto;
}
.signature .sign1,
.signature .sign2
{
width:50%;
text-align:center;
}
.signature img
{
width:100px;
height:50px;
}
.signature .dperson
{
padding-top:8px;
margin:0;
margin-bottom:3px;
font-family:Arial;
font-weight:bold;
}
.signature .downer
{
margin:0;
padding:0;
font-family:Calibri light;
font-style:italic;
padding-top:4px;
font-weight:bold;
}
.signature .sign1,
.signature .sign2,
.signature .demo
{
float:left;
}
.dtitle
{
padding-bottom:2px;
border-bottom:4px solid rgb(178,77,74);
color:rgb(178,77,74);
border-radius:7px;
}
.sqbl
{
width: 239px;
height: 89px;
background: rgb(156,50,45);
position: absolute;
left: -75px;
bottom: 0;
transform: rotate(45deg);
}
.sqtr
{
width: 239px;
height: 89px;
background: rgb(156,50,45);
position: absolute;
right: -75px;
top: 0;
transform: rotate(45deg);
}
.sqtl {
width: 239px;
height: 89px;
background: rgb(156,50,45);
position: absolute;
left: -75px;
top: 0;
transform: rotate(-45deg);
}
.sqbr
{
width: 239px;
height: 89px;
background: rgb(156,50,45);
position: absolute;
right: -75px;
bottom: 0;
transform: rotate(-45deg);
}
.certibtn
{
margin:0 auto;
margin-top:30px;
width:75%;
}
.btnprint
{
background:green;
color:#fff;
width:20%;
padding: 10px 5px;
font-size:20px;
letter-spacing: 2px;
border-radius: 10px;
float: left;
margin-right:10px;
font-weight: bold;
text-align: center;
text-decoration: none;
}
.btnback
{
background:#007bff;
color:#fff;
width:20%;
padding: 10px 5px;
font-size:20px;
letter-spacing: 2px;
border-radius: 10px;
float: left;
text-align: center;
font-weight: bold;
text-decoration: none;
}
canvas{
max-width: 100%;
max-height: 100%;
}
</style>
<script src="assests/libs/jquery/jquery-3.2.1.min.js"></script>
<script src="assests/js/html2canvas.js"></script>
</head>
<body>
<div class="myDiv" id="pdiv">
<div class="certihead">
<img src="assests/img/taalem-512.png">
<h1 class="certi">Certificate<br><span class="subcerti">OF ACHIEVEMENT</span></h1>
</div>
<div class="certicontent">
<div class="stamp">
<img src="assests/img/stamp.png">
<h4>COMPLETED</h4>
</div>
<p>This certificate is presented to</p>
<h1><?= $gname['name'] ?></h1>
<p>for the successfully completed the</p>
<h3><?= $getc['coursename'] ?><span> course on <?php echo date("F d,Y",strtotime($totalf['cmpdate'])); ?></span></h3>
</div>
<div class="signature">
<div class="sign1" style="margin-top:12px;">
<p class="dperson">
<span style="font-size:14px">Given By</span><br>
<span class="dtitle"><?= $getc['instname'] ?></span>
</p>
<p class="downer">Instructor</p>
</div>
<div class="sign2">
<p style="font-weight: bold;color:gray">Issued by <br><span class="abfont" style="font-size:40px;">Taalem</span> </p>
</div>
</div>
<div class="sqbl"></div>
<div class="sqtr"></div>
<div class="sqtl"></div>
<div class="sqbr"></div>
</div>
<div class="certibtn">
<button type="buttom" class="btnprint" id="pr"><i class="fas fa-download"></i>Download</button>
<a class="btnback" href="index.php"><i class="fas fa-arrow-left"></i> Go Back</a>
</div>
<script>
$(document).ready(function(){
$("#pr").click(function(){
html2canvas($("#pdiv")[0]).then(canvas => {
saveAs(canvas.toDataURL(), 'Certificate.png');
});
});
function saveAs(uri, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = uri;
link.download = filename;
//Firefox requires the link to be in the body
document.body.appendChild(link);
//simulate click
link.click();
//remove the link when done
document.body.removeChild(link);
} else {
window.open(uri);
}
}
});
</script>
</body>
</html>