root / docs / www / colonyscout / internal / assembly_view.php @ f59acf11
History | View | Annotate | Download (2.09 KB)
1 |
<?php
|
---|---|
2 |
$pageNum = (isset($_GET['page'])) ? $_GET['page'] : 1; // if $_GET['page'] defined, use it as page number |
3 |
$rowsPerPage = 20; // how many rows to show per page |
4 |
$offset = ($pageNum - 1) * $rowsPerPage; // counting the offset |
5 |
?>
|
6 |
|
7 |
<style>
|
8 |
tr.odd {background:#ccc url('images/row_blue.jpg');height:87px;}
|
9 |
tr.even {background:#ccc url('images/row_gray.jpg');height:87px;}
|
10 |
table.system {background-color:#fff;width:920px;color:#000099;font-weight:500;}
|
11 |
table.system td{vertical-align:top;}
|
12 |
table.system img.thumb{border:2px solid #ececec;margin:4px;height:72px;}
|
13 |
</style>
|
14 |
|
15 |
<h1>Assembly Instructions</h1><i>List the tools, parts, and steps necessary to construct a system.</i> |
16 |
|
17 |
<table class="system" cellspacing="1"> |
18 |
<tr>
|
19 |
<th><h2>Image</h2></th> |
20 |
<th width="320px"><h2>Description</h2></th> |
21 |
<th width="90px"><h2>Files</h2></th> |
22 |
<th width="220px"><h2>Tech Specs</h2></th> |
23 |
<th width="160px"><h2>Build Order</h2></th> |
24 |
</tr>
|
25 |
|
26 |
<?php
|
27 |
//gather the inventory based on search term or all
|
28 |
$get_system_sql = "SELECT ID, Name, (SELECT UserName FROM members WHERE members.ID=assemblyinstructions.AuthorID) as AuthorInfo, (SELECT count(assemblyID) from assemblysteps WHERE assemblysteps.AssemblyID=assemblyinstructions.ID) as StepCount FROM assemblyinstructions LIMIT $offset, $rowsPerPage"; |
29 |
$get_system_res = mysqli_query($mysqli, $get_system_sql) or die(mysqli_error($mysqli)); |
30 |
|
31 |
if (mysqli_num_rows($get_system_res) < 1) { |
32 |
$display_block = "</table><br/><h1>No assembly instructions could be found</h1>"; |
33 |
} else {
|
34 |
//create the display string
|
35 |
$display_block = ""; |
36 |
$i = 0; |
37 |
|
38 |
while ($sys = mysqli_fetch_array($get_system_res)) { |
39 |
$class = ($i%2 ? 'odd' : 'even'); |
40 |
|
41 |
$display_block .=
|
42 |
"<tr class=".$class."> |
43 |
<td><img class=\"thumb\" src=\"".getAssemblyThumbFromDisk($sys['Name'])."\"/></td> |
44 |
<td><a href=\"?tab=viewassem&q=".$sys['ID']."\"><h2>".$sys['Name']."</h2></a><br/></td> |
45 |
<td></td>
|
46 |
<td><b>No of Steps: </b>".$sys['StepCount']."<br/><br/><b>Author: </b>".$sys['AuthorInfo']."</td> |
47 |
<td></td>
|
48 |
</tr>
|
49 |
";
|
50 |
$i++;
|
51 |
} |
52 |
$display_block .= "</table><br/><br/>"; |
53 |
} |
54 |
|
55 |
echo $display_block; |
56 |
|
57 |
?>
|
58 |
|
59 |
</table>
|