This repository has been archived by the owner on Jan 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.php
executable file
·46 lines (44 loc) · 1.57 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
<?php
// To keep the code as clean as possible, separation of concerns and all that,
// put the main logic for this application in a file separate from the HTML
require_once 'lib/save-signature.php';
?><!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Saving a Signature · Signature Pad</title>
<link rel="stylesheet" href="signature-pad/build/jquery.signaturepad.css">
<!--[if lt IE 9]><script src="signature-pad/build/flashcanvas.js"></script><![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<?php
// A small trigger to flip between showing the signature form and the regeneration screen
if ($show_form) {
require_once 'views/accept.php';
} else {
require_once 'views/regenerate.php';
}
?>
<script src="signature-pad/build/jquery.signaturepad.min.js"></script>
<?php
// Another trigger to write the appropriate Javascript to the page:
// If we are showing the form, write the initialization code
// If we are showing the final signature, write the regeneration code
if ($show_form) :
?>
<script>
$(document).ready(function () {
$('.sigPad').signaturePad({drawOnly : true});
});
</script>
<?php else : ?>
<script>
$(document).ready(function () {
// Write out the complete signature from the database to Javascript
var sig = <?php echo $output; ?>;
$('.sigPad').signaturePad({displayOnly : true}).regenerate(sig);
});
</script>
<?php endif; ?>
<script src="signature-pad/build/json2.min.js"></script>
</body>