blob: e61bf00e7dcb23898865c28e92ca2a304a984a8d (
plain)
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
|
<? if ($error): ?>
<h1>Error:</h1>
<h3 style="color: red;"><?=$error?></h3>
<? else: ?>
<h1><?=$part->get('name')?>, a <a href="/type/<?=$part->get('type')?>"><?=UniquePart::typeToEnglish($part->get('type'))?></a> type part.</h1>
<p>
<?=$part->get('description')?>
</p>
<? if ($part->get('url')): ?>
<p>
More information: <a href="<?=$part->get('url')?>"><?=parse_url($part->get('url'), PHP_URL_HOST)?></a>
</p>
<? endif ?>
<? if ($part->get('type') == 'module'): ?>
<h2>Generate Part List</h2>
<form action="/uniqueparts" method="post">
<input type="hidden" name="module_id" value="<?=$part->id?>"/>
Quantity: <input type="text" name="quantity" value="1" size="3">
<input type="submit" value="Go"/>
</form>
<? endif ?>
<? if ($part->get('type') == 'module' || $part->get('type') == 'assembly' || $part->get('type') == 'kit'): ?>
<h2>Component Parts</h2>
<? if (!empty($list->type_list)): ?>
<table width="100%">
<tr>
<th>Part</th>
<th>Type</th>
<th>Quantity</th>
</tr>
<? foreach ($list->type_list AS $type => $data): ?>
<? foreach ($data AS $unique_id): ?>
<? $unique = $list->getUnique($unique_id); ?>
<tr>
<td><a href="<?=$unique->getViewUrl()?>"><?=$unique->get('name')?></a></td>
<td><a href="/type/<?=$type?>"><?=UniquePart::typeToEnglish($type)?></a></td>
<td><?=$list->getUniqueQuantity($unique->id)?> <?=$unique->get('units')?></td>
</tr>
<? endforeach ?>
<? endforeach ?>
</table>
<? else: ?>
<b>No parts found.</b>
<? endif ?>
<? endif ?>
<h2>Suppliers</h2>
<? if (!empty($suppliers)): ?>
<table width="100%">
<tr>
<th width="33%">Name</th>
<th>Info</th>
</tr>
<? foreach ($suppliers AS $row): ?>
<? $supplier = $row['Supplier'] ?>
<? $spart = $row['SupplierPart'] ?>
<? $url = $spart->getBuyUrl() ?>
<tr>
<td><b><a href="<?=$supplier->getViewUrl()?>"><?=$supplier->get('name')?></a></b></td>
<? if ($url): ?>
<td><a href="<?=$url?>"><?=$spart->get('part_num')?></a></td>
<? else: ?>
<td><?=$spart->get('part_num')?></td>
<? endif ?>
</tr>
<? endforeach ?>
</table>
<? else: ?>
<b>No suppliers found.</b>
<? endif ?>
<h2>Where is it used?</h2>
<? if (!empty($modules)): ?>
<table width="100%">
<tr>
<th width="33%">Module</th>
<th>Subassembly</th>
</tr>
<? foreach ($modules AS $row): ?>
<? $upart = $row['UniquePart'] ?>
<? $raw = $row['RawPart'] ?>
<?
if (!$upart->id):
$parent = new RawPart($raw->get('parent_id'));
$upart = new UniquePart($parent->get('part_id'));
?>
<tr>
<td><b><a href="<?=$upart->getViewUrl()?>"><?=$upart->get('name')?></a></b></td>
<td><?=$raw->get('raw_text')?></td>
</tr>
<? else: ?>
<tr>
<td><b><a href="<?=$upart->getViewUrl()?>"><?=$upart->get('name')?></a></b></td>
<td><?=$upart->get('description')?></td>
</tr>
<? endif ?>
<? endforeach ?>
</table>
<? else: ?>
<b>This part is not used anywhere.</b>
<? endif ?>
<h2>Embed this part list:</h2>
<textarea style="width: 600px; height: 50px;"><iframe src="<?=$part->getEmbedUrl()?>" width="600" height="500" frameborder="0">Visit <?=$part->getEmbedUrl()?></iframe></textarea>
<h2><a href="http://www.wikidot.com">Wikidot.com</a> embed:</h2>
<textarea style="width: 600px; height: 50px;">[[iframe <?=$part->getEmbedUrl()?> width="600" height="500" frameborder="0"]]</textarea>
<? endif ?>
|