-
Notifications
You must be signed in to change notification settings - Fork 6
/
printer_list.php
69 lines (52 loc) · 1.68 KB
/
printer_list.php
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
<?php
include('inc/common.php');
$PAGE->setPageTitle('Printer List');
$PAGE->setActiveID('printer');
$PAGE->addBreadCrumb('Printers',$CONF->baseURL.'printers/');
if(isset($_GET['action'])) {
if($_GET['action']=='search'){
if( isset($_POST['manufacturer']) && isset($_POST['model']) ){
header( 'location: /printer/'.$_POST['manufacturer'].'/'.urlencode($_POST['model']));
}
else{
// Load manufacturers
$res = $DB->query("
SELECT DISTINCT make
FROM printer
ORDER BY make");
$makes = array();
while($r = $res->getRow()) $makes[$r['make']] = $r['make'];
$SMARTY->assign('makes',$makes);
$SMARTY->assign('errorMessage',"Please select a manufacturer and model to continue.");
$SMARTY->display('printers/searchform.tpl');
}
}
if($_GET['action']=='searchall'){
if( isset($_POST['showby_manufacturer']) && $_POST['showby_manufacturer'] != "" ){
header( 'location: /printers/manufacturer/'.$_POST['showby_manufacturer']);
}
else{
$res = $DB->query("
SELECT DISTINCT make
FROM printer
ORDER BY make");
$makes = array();
while($r = $res->getRow()) $makes[$r['make']] = $r['make'];
$SMARTY->assign('makes',$makes);
$SMARTY->assign('errorMessage',"Please select a manufacturer to continue.");
$SMARTY->display('printers/searchform.tpl');
}
}
}
else {
// Load manufacturers
$res = $DB->query("
SELECT DISTINCT make
FROM printer
ORDER BY make");
$makes = array();
while($r = $res->getRow()) $makes[$r['make']] = $r['make'];
$SMARTY->assign('makes',$makes);
$SMARTY->display('printers/searchform.tpl');
}
?>