This repository has been archived by the owner on Jun 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathindex.php
executable file
·60 lines (53 loc) · 2.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
<!DOCTYPE html>
<html>
<head>
<title>Cards Generator</title>
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-2.0.3.min.js"></script>
<script>
$(document).ready(function () {
$('#gen-card-button').click(function () {
var template_html = $("#gen-template-frame").contents().find('html').html();
$('#gen-html-textarea').val(template_html);
$('#gen-create-form').submit();
});
});
</script>
</head>
<body>
<div id="header">
<span>Card Generator</span>
</div>
<div class="gen-select-template-container">
Select card template:
<select id="gen-select-template" class="">
<?php
$dir = '/home/dev/card-generator/templates';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
$template_name = rtrim($file, '.html');
echo "<option value='". $template_name ."'>". $template_name ."</option>";
}
}
closedir($dh);
}
}
?>
</select>
</div>
<iframe id="gen-template-frame" src="templates/reps-card.html"></iframe>
<form id="gen-create-form" action="generate.php" method="post">
<input name="paper" type="hidden" value="card"/>
<input name="orientation" type="hidden" value="portrait"/>
<textarea name="html" id="gen-html-textarea"></textarea>
<div style="text-align: center; margin-top: 1em;">
<input type="button" value="Generate Card" id="gen-card-button" class="button" />
</div>
</form>
<br/>
<br/>
<div id="footer">Made by fox lovers in Kerala | <a href="#">Grab the code</a> and improve this.</div>
</body>
</html>