-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
374 lines (345 loc) · 17 KB
/
index.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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<?php
if(isset($_POST['submit'])){
//Hent data fra form
//Pers info
// navn adresse telefon epost linkedin fodselsdato
$navn = $_POST['navn'];
$adresse = $_POST['adresse'];
$telefon = $_POST['telefon'];
$epost = $_POST['epost'];
$linkedin = $_POST['linkedin'];
$fodselsdato = $_POST['fodselsdato'];
//Utdanning
$tab_utdanning_sted = $_POST['tab_utdanning_sted'];
$tab_utdanning_start = $_POST['tab_utdanning_start'];
$tab_utdanning_slutt = $_POST['tab_utdanning_slutt'];
$tab_utdanning_info = $_POST['tab_utdanning_info'];
// Erfaring
$tab_erfaring_firma = $_POST['tab_erfaring_firma'];
$tab_erfaring_stilling = $_POST['tab_erfaring_stilling'];
$tab_erfaring_info = $_POST['tab_erfaring_info'];
$tab_erfaring_start = $_POST['tab_erfaring_start'];
$tab_erfaring_slutt = $_POST['tab_erfaring_slutt'];
$tab_erfaring_adresse = $_POST['tab_erfaring_adresse'];
// Annet
$tab_annet_type = $_POST['tab_annet_type'];
$tab_annet_info = $_POST['tab_annet_info'];
// Interesser
$interesser_info = $_POST['interesser_info'];
// Referanser
$tab_referanse_navn = $_POST['tab_referanse_navn'];
$tab_referanse_firma = $_POST['tab_referanse_firma'];
$tab_referanse_stilling = $_POST['tab_referanse_stilling'];
$tab_referanse_nummer = $_POST['tab_referanse_nummer'];
$tab_referanse_epost = $_POST['tab_referanse_epost'];
//Skjekke om navnet er ført inn
if($navn ==''){
$error[] = 'Vennligst oppgi navn';
}
// Skjekke om adresse er ført inn
if($adresse ==''){
$error[] = 'Vennligst oppgi adresse';
}
// Skjekke om telefonnummer er ført inn
if($telefon == ''){
$error[] = 'Vennligst oppgi telefonnummer';
}
//Skjekke om epost addressen er på riktig format
if(!filter_var($epost, FILTER_VALIDATE_EMAIL)){
$error[] = 'Vennligst oppgi en gyldig epost adresse!';
}
//Visst det er ingen error, fortsett scriptet
if(!isset($error)){
//Lag html kode av dataen
ob_clean();
ob_start();
?>
<?php
include('oppsett.php');
include('dokument.php');
$body = ob_get_clean();
$body = iconv("UTF-8","UTF-8//IGNORE",$body);
$path = (getenv('MPDF_ROOT')) ? getenv('MPDF_ROOT') : __DIR__;
require_once $path . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf(["mode -> 'c'"]);
//skriv html koden om til et PDF dokument
$mpdf->WriteHTML($body);
//Skriv ut PDF dokumentet, og åpne det i en ny fane
$mpdf->Output();
}
}
//Visst det er noen feil, viser de på skjermen
if(isset($error)){
foreach($error as $error){
echo "<p style='color:#ff0000'>$error</p>";
}
}
?>
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fra CV Til PDF</title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- Datetimepicker css -->
<link rel="stylesheet" type="text/css" href="dist/css/bootstrap-datepicker.css">
<!-- Min css for footer og main -->
<link rel="stylesheet" type="text/css" href="css/footer.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<header>
<?php include('../module/headermenu.php');?>
<div class="container text-left" style="margin-top: 50px;">
<h1><strong>Fra CV til PDF!</strong></h1>
<p>Før inn all informasjon du måtte ønske til din CV, og trykk <strong>generer min CV!</strong> for å få en perfekt formatert CV</p>
</div>
</header>
<div class="container">
<form action='' method='post'>
<div class="row">
<div class="col-md-3">
<div class="row form-group">
<fieldset>
<legend>Personlig info</legend>
<table>
<tbody>
<tr>
<p>
<td>
<label>Navn</label><br><input class="form-control" type='text' name='navn' placeholder="Navn" required>
</td>
</p>
</tr>
<tr>
<p>
<td>
<label>Epost</label><br><input class="form-control" type='email' name='epost' placeholder="Epost" required>
</td>
</p>
</tr>
<tr>
<p>
<td>
<label>Telefon</label><br><input class="form-control" type='tel' name='telefon' maxlength="8" placeholder="Telefon" required>
</td>
</p>
</tr>
<tr>
<p>
<td>
<label>Adresse</label><br><input class="form-control" type='text' name='adresse' placeholder="Adresse" required>
</td>
</p>
</tr>
<tr>
<p>
<td>
<label>LinkedIn</label><br><input class="form-control" type='url' name='linkedin' placeholder='LinkedIn' required>
</td>
</p>
</tr>
<tr>
<p>
<td>
<label>Fødselsdato</label><br><input class="form-control" type='text' name='fodselsdato' id="fodselsdato" placeholder="Fødselsdato" required>
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="row form-group">
<div class = "col-lg">
<fieldset>
<legend>Interesser</legend>
<table id="interesserTable">
<tbody>
<tr>
<p>
<td>
<textarea class="form-control" type="text" name="interesser_info" rows="6" cols="35" placeholder="Mine interesser er..."></textarea>
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
</div>
</div>
<div class="col-md-1">
</div>
<div class="col-md-8">
<div class="row form-group">
<fieldset>
<legend>Utdanning</legend>
<p>
<input type="button" class="btn btn-primary" value="Legg til utdanning" onClick="addRow('utdanningTable')" />
<input type="button" class="btn btn-primary" value="Fjern utdanning" onClick="deleteRow('utdanningTable')" />
<p>(Marker en boks for å slette.)</p>
</p>
<table id="utdanningTable">
<tbody>
<tr>
<p>
<td><input type="checkbox" name="chk[]"/><br><br></td>
<td>
<label>Utdanningssted</label><br><input class="form-control" type="text" name="tab_utdanning_sted[]" placeholder="Utdanningssted">
</td>
<td>
<label>Info om utdanning</label><br><input class="form-control" type='text' name="tab_utdanning_info[]" placeholder="Info om utdanning">
</td>
<td>
<label>Fra</label><br><input class="form-control datepicker" type='text' name="tab_utdanning_start[]" placeholder="Fra">
</td>
<td>
<label>Til</label><br><input class="form-control datepicker" type='text' name="tab_utdanning_slutt[]" placeholder="Til">
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="row form-group">
<fieldset>
<legend>Erfaring</legend>
<p>
<input type="button" class="btn btn-primary" value="Legg til arbeidssted" onClick="addRow('erfaringTable')" />
<input type="button" class="btn btn-primary" value="Fjern arbeidssted" onClick="deleteRow('erfaringTable')" />
<p>(Marker en boks for å slette.)</p>
</p>
<table id="erfaringTable">
<tbody>
<tr>
<p>
<td><input type="checkbox" name="chk[]"/></td>
<td>
<label>Firma</label><br><input class="form-control" type="text" name="tab_erfaring_firma[]" placeholder="Firma">
</td>
<td>
<label>Type</label><br>
<select class="form-control" name="tab_erfaring_stilling[]">
<option value="">----
</option>
<option value="Deltid">Deltid
</option>
<option value="Heltid">Heltid
</option>
</select>
</td>
<td>
<label>Info om stilling</label><br><input class="form-control" type='text' name="tab_erfaring_info[]" placeholder="Info om stilling">
</td>
<td>
<label>Sted</label><br><input class="form-control" type='text' name="tab_erfaring_adresse[]" placeholder="Sted">
</td>
<td>
<label>Fra</label><br><input class="form-control datepicker" type='text' name="tab_erfaring_start[]" placeholder="Fra">
</td>
<td>
<label>Til</label><br><input class="form-control datepicker" type='text' name="tab_erfaring_slutt[]" placeholder="Til">
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="row form-group">
<fieldset>
<legend>Referanser</legend>
<p>
<input type="button" class="btn btn-primary" value="Legg til referanse" onClick="addRow('referanseTable')" />
<input type="button" class="btn btn-primary" value="Fjern referanse" onClick="deleteRow('referanseTable')" />
<p>(Marker en boks for å slette.)</p>
</p>
<table id="referanseTable">
<tbody>
<tr>
<td><input type="checkbox" name="chk[]" /></td>
<p>
<td>
<label>Navn</label><br>
<input class="form-control" type="text" name="tab_referanse_navn[]" placeholder="Navn">
</td>
<td>
<label>Firma</label><br>
<input class="form-control" type="text" name="tab_referanse_firma[]" placeholder="Firma">
</td>
<td>
<label>Stilling</label><br>
<input class="form-control" type="text" name="tab_referanse_stilling[]" placeholder="Stilling">
</td>
<td>
<label>Telefon</label><br>
<input class="form-control" type="tel" name="tab_referanse_nummer[]" maxlength="8" placeholder="Telefon">
</td>
<td>
<label>Epost</label><br>
<input class="form-control" type="text" name="tab_referanse_epost[]" placeholder="Epost">
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="row form-group">
<fieldset>
<legend>Annet</legend>
<p>
<input type="button" class="btn btn-primary" value="Legg til annet" onClick="addRow('annetTable')" />
<input type="button" class="btn btn-primary" value="Fjern annet" onClick="deleteRow('annetTable')" />
<p>(Marker en boks for å slette.)</p>
</p>
<table id="annetTable">
<tbody>
<tr>
<p>
<td><input type="checkbox" name="chk[]" /></td>
<td>
<label>Type</label><br>
<input class="form-control" type="text" name="tab_annet_type[]" placeholder="Type">
</td>
<td>
<label>Info</label><br>
<input class="form-control" type="text" name="tab_annet_info[]" placeholder="Info">
</td>
</p>
</tr>
</tbody>
</table>
</fieldset>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<p><input class="btn-lg btn-danger" type='submit' name='submit' value='Generer min CV!'></p>
</div>
</div>
</form>
</div>
<?php include("footer.php") ?>
<!-- jQuery -->
<script src="vendor/jquery/jquery.min.js"></script>
<!-- Theme JavaScript -->
<script src="js/clean-blog.min.js"></script>
<!-- Datetimepicker js -->
<script src="dist/js/bootstrap-datepicker.js"></script>
<script src="dist/js/bootstrap-datepicker.min.js"></script>
<script src="dist/locales/bootstrap-datepicker.nb.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Mitt skript, for sletting av rader, og datepicker -->
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="js/datepicker.js"></script>
</body>
</html>