|
10 | 10 | echo "Error: Unable to open database\n"; |
11 | 11 | } else { |
12 | 12 |
|
13 | | - $Sql='SELECT idpattern,patternpublisher,publishername,patternnum,patternsize,patternbust,patternwaist,patternhips,patternera,patterngender,patterndesc,patternnotes |
| 13 | + $Sql='SELECT idpattern,patternpublisher,publishername,patternnum,patternsize,patternbust,patternwaist,patternhips,patternera,patterngender,patterndesc,patternnotes,puborder |
14 | 14 | FROM pattern,publisher |
15 | 15 | WHERE patternpublisher=idpublisher '; |
16 | 16 | if(isset($_GET['pubID'])>0){ |
|
41 | 41 | } |
42 | 42 |
|
43 | 43 | $Sql .= ' |
44 | | - ORDER BY patternpublisher,patternnum'; |
| 44 | + ORDER BY puborder,patternnum'; |
45 | 45 | $rs = pg_query($Sql) or die('Query failed: ' .pg_last_error()); |
46 | 46 |
|
47 | 47 | $rows_returned = pg_num_rows($rs); |
48 | 48 | $title="Home"; |
49 | 49 | $bg='butterickL'; |
50 | 50 | include('includes/head.php'); |
| 51 | +echo '<h1 style="h2">'.$title.'</h1>'; |
51 | 52 | echo '<h2>Results from the database: '.$rows_returned.' </h2> |
52 | 53 | <h3><a href="'.$_SERVER['PHP_SELF'].'">Display all results</a> or <a href="protected/new.php?add=1">add a new pattern</a></h3> |
53 | | -<div><span class="h2 text-success bg-secondary">To edit an entry, select its ID in the first column.</span></div> |
| 54 | +<div><span class="h2 text-danger">To edit an entry, select its ID in the first column.</span></div> |
54 | 55 | <!--<form action="'.$_SERVER['PHP_SELF'].'" method="get"> |
55 | 56 | Search word/s in description: <input type="text" name="desc"><br /> |
56 | 57 | Search word/s in notes: <input type="text" name="notes"><br /> |
57 | 58 | <input type="submit" value="Submit"> |
58 | 59 | </form>--> |
59 | | -<input id="pInput" type="text" placeholder="Search all cells">'; |
| 60 | +<label for="pInput">Search all cells</label><input id="pInput" type="text" >'; |
60 | 61 | if($_GET['gender'] == 'Male' || $_GET['gender'] == 'Boy') {$chestName='Chest';} |
61 | 62 | elseif($_GET['gender'] == 'Female') {$chestName='Bust';} |
62 | 63 | else { $chestName='Bust/Chest'; } |
63 | 64 | echo "<table class=\"table table-sm table-hover\" border width=\"100%\">\n"; |
64 | | -echo '<thead class="thead-light"><tr><th class="text-center">DB ID</th><th class="text-center">Publisher</th><th class="text-center">Number<br />(image)</th><th class="text-center">Size</th><th class="text-center">'.$chestName.'</th><th class="text-center">Waist</th><th class="text-center">Hips</th><th class="text-center">Era</th><th class="text-center">Gender</th><th class="text-center">Description</th><th class="text-center">Notes</th></tr></thead> |
| 65 | +echo '<thead class="thead-light"><tr><th class="text-center">DB ID</th> |
| 66 | + <th class="text-center">Publisher</th> |
| 67 | + <th class="text-center">Number<br />(image)</th> |
| 68 | + <th class="text-center">Size</th> |
| 69 | + <th class="text-center">'.$chestName.'</th> |
| 70 | + <th class="text-center">Waist</th> |
| 71 | + <th class="text-center">Hips</th> |
| 72 | + <th class="text-center">Era</th> |
| 73 | + <th class="text-center">Gender</th> |
| 74 | + <th class="text-center">Description</th> |
| 75 | +<th class="text-center">Notes</th> |
| 76 | +</tr> |
| 77 | +</thead> |
65 | 78 | <tbody id="pTable">'; |
66 | 79 | while($row = pg_fetch_assoc($rs)){ |
67 | 80 | $pub=$row['patterngender']; |
68 | 81 | $td='<td>'; |
69 | 82 | switch($pub){ |
70 | 83 | case "Male": |
71 | | - $td='<td style="background-color:#ccccff;opacity:0.7">'; |
| 84 | + $td='<td class="gender male">'; |
| 85 | + break; |
| 86 | + case "Boy": |
| 87 | + $td='<td class="gender male">'; |
72 | 88 | break; |
73 | 89 | case "Child": |
74 | | - $td='<td style="background-color:#ffccff;opacity:0.7">'; |
| 90 | + $td='<td class="gender child">'; |
75 | 91 | break; |
76 | 92 | case "Baby": |
77 | | - $td='<td style="background-color:#ffcccc;opacity:0.7">'; |
| 93 | + $td='<td class="gender baby">'; |
78 | 94 | break; |
79 | 95 | case "Female": |
80 | | - $td='<td style="background-color:pink;opacity:0.7">'; |
| 96 | + $td='<td class="gender female">'; |
81 | 97 | break; |
82 | 98 | case "Girl": |
83 | | - $td='<td style="background-color:#C7EF8A;opacity:0.7">'; |
| 99 | + $td='<td class="gender girl">'; |
84 | 100 | break; |
85 | 101 | case "Decor": |
86 | | - $td='<td style="background-color:#FFFF66;opacity:0.7">'; |
| 102 | + $td='<td class="gender decor">'; |
87 | 103 | break; |
88 | 104 | case "Doll": |
89 | | - $td='<td style="background-color:#FF66FF;opacity:0.7">'; |
| 105 | + $td='<td class="gender doll">'; |
| 106 | + break; |
| 107 | + case "Toddler": |
| 108 | + $td='<td class="gender toddler">'; |
90 | 109 | break; |
91 | 110 | case "Either": |
92 | | - $td='<td style="background-color:#ffffcc;opacity:0.7">'; |
| 111 | + $td='<td class="gender either">'; |
93 | 112 | break; |
94 | 113 | } |
95 | | - echo "<tr>".$td."<a href='protected/edit.php?ID=" . $row['idpattern'] . "'>".$row['idpattern'].'</a></td>'; |
96 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?pubID=" . $row['patternpublisher'] ."'>" . $row['publishername'] . '</a></td>'; |
97 | | - $filename = 'pattern-pics/'.$row['idpattern'].'.jpg'; |
98 | | - if (!file_exists($filename)) echo $td."<a href=\"protected/file_insert.php?ID=".$row['idpattern']."\">upload</a>".$row['patternnum'].'</td>' ; |
99 | | - else echo $td."<a href='display_image.php?id=" . $row['idpattern'] ."'>" . $row['patternnum'] .'</a></td>'; |
100 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?size=" . $row['patternsize'] ."'>" . $row['patternsize'] . '</td>'; |
| 114 | + echo "<tr>"; |
| 115 | + echo $td."<a href='protected/edit.php?ID=" . $row['idpattern'] . "'>".$row['idpattern'].'</a></td>'; # ID column |
| 116 | + echo $td."<a href='".$_SERVER['PHP_SELF']."?pubID=" . $row['patternpublisher'] ."'>" . $row['publishername'] . '</a></td>';# publisher |
| 117 | + $filename = 'pattern-pics/'.$row['idpattern'].'.jpg';# pattern image is <<its ID>>.jpg |
| 118 | + if (!file_exists($filename)) echo $td."<a href=\"protected/file_insert.php?ID=".$row['idpattern']."\">upload</a>".$row['patternnum'].'</td>' ;# if it's not there, offer to upload |
| 119 | + else echo $td."<a href='display_image.php?id=" . $row['idpattern'] ."'>" . $row['patternnum'] .'</a></td>';# otherwise, display and link |
| 120 | + echo $td; # pattern size |
| 121 | + if($row['patternsize']) echo "<a href='".$_SERVER['PHP_SELF']."?size=" . $row['patternsize'] ."'>" . $row['patternsize']; |
| 122 | + echo ' </td>'; |
101 | 123 | $bust = str_replace("NULL","",$row['patternbust']); |
102 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?bust=" . $bust ."'>" . $bust . '</a></td>'; |
| 124 | + echo $td; # bust |
| 125 | + if($bust) echo "<a href='".$_SERVER['PHP_SELF']."?bust=" . $bust ."'>" . $bust . '</a>'; |
| 126 | + echo ' </td>'; |
103 | 127 | $waist = str_replace("NULL","",$row['patternwaist']); |
104 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?waist=" . $waist ."'>" . $waist . '</a></td>'; |
| 128 | + echo $td; # waist |
| 129 | + if($waist) echo "<a href='".$_SERVER['PHP_SELF']."?waist=" . $waist ."'>" . $waist . '</a>'; |
| 130 | + echo ' </td>'; |
105 | 131 | $hips = str_replace("NULL","",$row['patternhips']); |
106 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?hips=" . $hips ."'>" . $hips . '</a></td>'; |
107 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?era=" . $row['patternera'] ."'>" . $row['patternera'] . '</td>'; |
108 | | - echo $td."<a href='".$_SERVER['PHP_SELF']."?gender=" . $row['patterngender'] ."'>" . $row['patterngender'] . '</a></td>'; |
109 | | - echo $td."" . $row['patterndesc'] . '</td>'; |
110 | | - echo $td."" . $row['patternnotes'] . "</td></tr>\n"; |
| 132 | + echo $td; # hips |
| 133 | + if($hips) echo "<a href='".$_SERVER['PHP_SELF']."?hips=" . $hips ."'>" . $hips . '</a>'; |
| 134 | + echo ' </td>'; |
| 135 | + echo $td; # era or year |
| 136 | + if($row['patternera']) echo "<a href='".$_SERVER['PHP_SELF']."?era=" . $row['patternera'] ."'>" . $row['patternera'] ; |
| 137 | + echo ' </td>'; |
| 138 | + echo $td; # gender |
| 139 | + if($row['patterngender']) echo "<a href='".$_SERVER['PHP_SELF']."?gender=" . $row['patterngender'] ."'>" . $row['patterngender'] . '</a>'; |
| 140 | + echo ' </td>'; |
| 141 | + echo $td; # description |
| 142 | + if($row['patterndesc']) echo $row['patterndesc'] ; |
| 143 | + echo ' </td>'; |
| 144 | + echo $td; # notes |
| 145 | + if($row['patternnotes']) $row['patternnotes']; |
| 146 | + echo " </td></tr>\n"; |
111 | 147 | } |
112 | 148 | echo "</tbody>\n</table>"; |
113 | 149 | echo '<script src="/js/jquery-3.3.1.min.js"></script> |
|
0 commit comments