-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathviewGeneratedPDF.php
341 lines (291 loc) · 11 KB
/
viewGeneratedPDF.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
<?php
require_once('lib/dompdf/autoload.inc.php');
use Dompdf\Dompdf;
use Dompdf\Options;
$options = new Options();
$options->set('chroot', realpath(''));
$pdf = new Dompdf($options);
ob_start();
include('viewpdf.php');
$htmlCode = ob_get_clean();
$pdf->loadHtml($htmlCode);
$pdf->setPaper('A4', 'portrait');
$pdf->render();
$pdfDataUri = 'data:application/pdf;base64,' . base64_encode($pdf->output());
error_reporting(0);
ini_set('display_errors', 0);
include('includes/authenticationAdminOrStaff.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Boxicons -->
<link href='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'>
<script src="https://kit.fontawesome.com/3db79b918b.js" crossorigin="anonymous"></script>
<!-- My CSS -->
<link rel="stylesheet" href="css/adminDashboard.css">
<style>
/* Style the container */
.container {
margin-top: 70px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-wrap: wrap;
height: auto;
width: 100%;
}
/* Style the chart container */
.chart-container {
width: 100%;
max-width: auto;
margin-bottom: 20px;
background-color: #fff;
border: 1px solid #ddd;
padding: 10px;
border-radius: 5px;
}
.barchart {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: start;
align-items: start;
gap: 30px;
flex-wrap: wrap;
}
.piechart {
padding: 20px;
display: flex;
flex-direction: row;
justify-content: start;
align-items: start;
flex-wrap: wrap;
}
/* Style the button container */
.barchart .button-container {
display: flex;
gap: 20px;
justify-content: space-between;
align-items: center;
text-align: center;
width: 100%;
}
/* Style the button */
button {
padding: 10px 20px;
background-color: #46abcc;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #1397c2;
}
/* Style the select element */
select[name="select-year"] {
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
width: 200px;
/* Adjust the width as needed */
}
/* Style the selected option */
select[name="select-year"] option[selected] {
background-color: #3498db;
color: #fff;
}
/* Style the options when the select is open */
select[name="select-year"]:focus {
outline: none;
/* Remove the default focus outline */
border-color: #3498db;
box-shadow: 0 0 5px rgba(52, 152, 219, 0.7);
}
/* Style the options in the dropdown */
select[name="select-year"] option {
padding: 5px;
font-size: 14px;
}
/* Style the hover effect on options */
select[name="select-year"] option:hover {
background-color: #f2f2f2;
cursor: pointer;
}
/* Style the apply button */
input[type="submit"][name="apply-button"] {
padding: 10px 20px;
/* Adjust padding as needed */
background-color: #46abcc;
color: #fff;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
/* Style the button on hover */
input[type="submit"][name="apply-button"]:hover {
background-color: #1397c2;
}
</style>
<!-- Add SweetAlert library -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="shortcut icon" type="image/png" href="assets/logo.png" />
<title>PDF Viewer</title>
</head>
<body>
<!-- SIDEBAR -->
<section id="sidebar">
<a href="#" class="brand">
<!-- <i class='bx bxs-smile'></i> -->
<span class="text">
<h6><span><?php echo ucfirst((isset($_GET['who'])) ? $_GET['who'] : ""); ?></span></h6>
<h4>Welcome <span>
<?php echo (string)($_GET['who'] == "admin")?$_SESSION['admin_name'] :(($_GET['who'] == "staff")?$_SESSION['staff_name']:"error"); ?>
</span></h4>
</span>
</a>
<ul class="side-menu top">
<li class="active">
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/">
<i class='bx bxs-dashboard'></i>
<span class="text">Dashboard</span>
</a>
</li>
<li>
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/admissionForm.php">
<i class='bx bxs-book-bookmark'></i>
<span class="text">Book Admission</span>
</a>
</li>
<li style="<?php echo (isset($_GET['who']))?(($_GET['who'] == "staff")? "display:none;": ""):(($_GET['who'] == "staff")? "": "");?>" >
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/analytics">
<i class='bx bxs-bar-chart-alt-2'></i>
<span class="text">Analytics</span>
</a>
</li>
<li class="search">
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/search.php">
<i class='bx bx-search-alt-2'></i>
<span class="text">Search</span>
</a>
</li>
<li>
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/sortData/">
<!-- <i class='bx bxs-bar-chart-alt-2'></i> -->
<i class='bx bxs-data'></i>
<span class="text">Customers Data</span>
</a>
</li>
<li class="time-table">
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/timetable/">
<i class='bx bx-table'></i>
<span class="text">Time Table</span>
</a>
</li>
<li>
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/dueCustomers/">
<i class='bx bxs-user'></i>
<span class="text">Due Amount Customers</span>
</a>
</li>
<li style="<?php echo (isset($_GET['who']))?(($_GET['who'] == "staff")? "display:none;": ""):(($_GET['who'] == "staff")? "": "");?>" >
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/mailSender">
<i class='bx bx-mail-send'></i>
<span class="text">Mail System</span>
</a>
</li>
<li style="<?php echo (isset($_GET['who']))?(($_GET['who'] == "staff")? "display:none;": ""):(($_GET['who'] == "staff")? "": "");?>" >
<a href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>/manageUsers/">
<i class='bx bxs-group'></i>
<span class="text">Manage Users</span>
</a>
</li>
</ul>
<ul class="side-menu">
<!-- <li>
<a href="#">
<i class='bx bxs-cog'></i>
<span class="text">Settings</span>
</a>
</li> -->
<li>
<a href="logout.php" class="logout">
<i class='bx bxs-log-out-circle'></i>
<span class="text">Logout</span>
</a>
</li>
</ul>
</section>
<!-- SIDEBAR -->
<!-- CONTENT -->
<section id="content">
<!-- NAVBAR -->
<nav>
<i class='bx bx-menu'></i>
<!-- <a href="#" class="nav-link">Categories</a> -->
<!-- <form action="" method="get">
<div class="form-input">
<input type="search" name="search-query" placeholder="Search...">
<button type="submit" class="search-btn"><i class='bx bx-search'></i></button>
</div>
</form> -->
<!-- <input type="checkbox" id="switch-mode" hidden>
<label for="switch-mode" class="switch-mode"></label>
<a href="#" class="notification">
<i class='bx bxs-bell'></i>
<span class="num">8</span>
</a> -->
<span class="text">
<h3>Patel Motor Driving School</h3>
<h5>Dashboard</h5>
</span>
<a href="" class="profile">
<img src="assets/logoBlack.png">
</a>
</nav>
<!-- NAVBAR -->
<!-- MAIN -->
<main>
<div class="head-title">
<div class="left">
<h1>PDF Viewer</h1>
<ul class="breadcrumb">
<li>
<a class="active" style=" color: #aaaaaa;"
href="<?php echo (isset($_GET['who'])) ? $_GET['who'] : ""; ?>">Dashboard</a>
</li>
<li><i class='bx bx-chevron-right'></i></li>
<li>
<a class="active" style=" color: #aaaaaa;"
href="<?php echo (isset($_GET['route'])) ? $_GET['route'] : ((isset($_GET['who'])) ? $_GET['who'] : ""); ?>">View
Details</a>
</li>
<li><i class='bx bx-chevron-right'></i></li>
<li>
<a class="active" href="">PDF Viewer</a>
</li>
</ul>
</div>
<!-- <a href="Excel/?export=true" class="btn-download">
<i class='bx bxs-cloud-download'></i>
<span class="text">Data to Excel</span>
</a> -->
</div>
<iframe src="<?php echo $pdfDataUri; ?>"
style="width: 100%;height: 1200px;margin-top: 35px;border: none;border-radius: 10px;"
title="Generated PDF" allowfullscreen loading="lazy"></iframe>
</main>
<!-- MAIN -->
</section>
<!-- CONTENT -->
<script src="js/sweetalert.js"></script>
<script src="js/script.js"></script>
</body>
</html>