-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
71 lines (64 loc) · 2.03 KB
/
view.php
File metadata and controls
71 lines (64 loc) · 2.03 KB
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
<?php
define('PCB_DIR', getcwd());
define('PCB_DIR_NAME', basename(PCB_DIR));
require __DIR__ . '/_assets/inc.php';
$layers = [];
if (file_exists(PCB_DIR . '/top.svg')) {
$layers[] = [
'layer' => 'top',
'file' => 'top.svg',
'name' => 'Top Layer',
'id' => 'pcb-top',
];
}
if (file_exists(PCB_DIR . '/bottom.svg')) {
$layers[] = [
'layer' => 'bottom',
'file' => 'bottom.svg',
'name' => 'Bottom Layer',
'id' => 'pcb-bottom',
];
}
$boardData = null;
if (file_exists(PCB_DIR . '/data.json')) {
$boardData = json_decode(file_get_contents(PCB_DIR . '/data.json'), true);
}
?><!DOCTYPE html>
<html>
<head>
<title><?= html(PCB_DIR_NAME) ?></title>
<script src="/bower_components/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
<script src="/_assets/jquery-3.1.0.slim.min.js"></script>
<!--<script src="/_assets/hammer.min.js"></script>-->
<link rel="stylesheet" type="text/css" href="/_assets/style.css">
</head>
<body class="page-view">
<h1>
<a href="/" class="go-back" title="Return to list of PCBs...">« Back</a>
<?= html(PCB_DIR_NAME) ?>
</h1>
<br class="clear">
<?php foreach ($layers as $layer): ?>
<section class="pcb-layer-container">
<h2>
<?= html($layer['name']) ?>
<?php if ($boardData && isset($boardData[$layer['layer']])): ?>
<span class="layer-size">
<?= $boardData[$layer['layer']]['width'] ?> ×
<?= $boardData[$layer['layer']]['height']?>
<?= $boardData[$layer['layer']]['units'] ?>
</span>
<?php endif; ?>
</h2>
<object id="<?= html($layer['id']) ?>"
class="pcb-layer"
type="image/svg+xml"
data="./<?= html($layer['file']) ?>">
Your browser does not support SVG
</object>
</section>
<?php endforeach; ?>
<?php require __DIR__ . '/_assets/footer.php'; ?>
<script src="/_assets/script-view.js"></script>
</body>
</html>