Project

General

Profile

Statistics
| Branch: | Revision:

colonymech / docs / www / colonyscout / internal / inventory_manage_systems.php @ f59acf11

History | View | Annotate | Download (2.58 KB)

1 f59acf11 Dan Shope
<?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
/* SYSTEMS:
7
view (list)
8
add
9
remove (admin only option, and just makes it inactive)
10
modify (add remove items, edit details)
11

12
probably 10-30 systems total (including charging, diagnostics, etc)
13

14
tech specs contains number of parts used, type of system
15

16
*/
17
18
?>
19
20
<style>
21
        tr.odd {background:#ccc url('images/row_blue.jpg');height:87px;}
22
        tr.even {background:#ccc url('images/row_gray.jpg');height:87px;}
23
        table.system {background-color:#fff;width:920px;color:#000099;font-weight:500;}
24
        table.system td{vertical-align:top;}
25
        table.system img.thumb{border:2px solid #ececec;margin:4px;height:72px;}
26
</style>
27
28
<h1>Systems</h1><i>are comprised of multiple parts, and range from single circuit boards to full-blown accessory packs.</i>
29
30
<table class="system" cellspacing="1">
31
        <tr>
32
                <th><h2>Image</h2></th>
33
                <th width="320px"><h2>Description</h2></th>
34
                <th width="90px"><h2>Files</h2></th>
35
                <th width="220px"><h2>Tech Specs</h2></th>
36
                <th width="160px"><h2>Build Order</h2></th>
37
        </tr>
38
        
39
<?php
40
//gather the inventory based on search term or all
41
$get_system_sql = "SELECT ID, name, revision, active, left(notes,140) as notes_trunc, tags, contact, (SELECT count(systemid) from syspartlinks WHERE systems.id=syspartlinks.systemid) as partcount FROM systems ORDER BY active DESC LIMIT $offset, $rowsPerPage";
42
$get_system_res = mysqli_query($mysqli, $get_system_sql) or die(mysqli_error($mysqli));
43
44
if (mysqli_num_rows($get_system_res) < 1) {
45
        $display_block = "</table><br/><h1>No inventory matched those search terms.</h1>";
46
} else {
47
        //create the display string
48
        $display_block = "";
49
        $i = 0;
50
        
51
        while ($sys = mysqli_fetch_array($get_system_res)) {
52
                $class = ($i%2 ? 'odd' : 'even');
53
                $img_active = ($sys['active']!=0) ? "images/active_true.png" : "images/active_false.png";
54
                
55
                $display_block .=
56
                "<tr class=".$class.">
57
                        <td><img class=\"thumb\" src=\"".getSystemThumbFromDisk($sys['name']."_".$sys['revision'])."\"/></td>
58
                        <td><a href=\"?tab=viewsys&q=".$sys['ID']."\"><h2>".$sys['name']." ".$sys['revision']."</h2></a><img src=\"".$img_active."\"/><br/>".$sys['notes_trunc']."</td>
59
                        <td></td>
60
                        <td><b>Contact: </b>".$sys['contact']."<br/><br/><b>Part Count: </b>".getPartCountForSystem($sys['ID'])."</td>
61
                        <td></td>
62
                </tr>
63
                ";
64
                $i++;
65
        }
66
        $display_block .= "</table><br/><br/>";
67
}
68
69
        echo $display_block;
70
        
71
?>
72
        <tr>
73
                <td></td><td></td><td></td><td></td><td></td>
74
        </tr>
75
76
77
78
79
</table>