1 |
dpavlin |
1.1 |
<?php |
2 |
|
|
require("Smarty.class.php"); |
3 |
|
|
require("conn.inc"); |
4 |
|
|
|
5 |
|
|
$smarty = new Smarty; |
6 |
|
|
|
7 |
|
|
$smarty->assign( array ( Title=>"Pliva d.d." ) ); |
8 |
|
|
|
9 |
|
|
$section="products"; |
10 |
|
|
|
11 |
|
|
$title="Products : Human Health"; |
12 |
|
|
$lpic="products"; $lext=".jpg"; |
13 |
|
|
$mpic="products.gif"; |
14 |
|
|
$back_url="products.php"; |
15 |
|
|
|
16 |
|
|
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); |
17 |
|
|
|
18 |
dpavlin |
1.4 |
$sth = $dbh->prepare("select type,description from prod_type"); |
19 |
dpavlin |
1.1 |
$sth->execute(); |
20 |
|
|
$types[]="any"; |
21 |
|
|
while ($row=$sth->fetchrow_array()) { |
22 |
|
|
$types[]=$row[0]; |
23 |
dpavlin |
1.4 |
$type_desc[]=$row[1]; |
24 |
dpavlin |
1.1 |
} |
25 |
dpavlin |
1.4 |
$smarty->assign(array( |
26 |
|
|
types=>$types, |
27 |
|
|
type_desc=>$type_desc |
28 |
|
|
)); |
29 |
dpavlin |
1.1 |
|
30 |
|
|
$sql_where=""; |
31 |
|
|
|
32 |
|
|
if (isset($type) && $type!="any") { |
33 |
|
|
$sql_where.=" type='$type'"; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
if (isset($search) && $search!="" && $search!="all") { |
37 |
|
|
if ($sql_where != "") { |
38 |
|
|
$sql_where.=" and "; |
39 |
|
|
} |
40 |
|
|
$sql_where.=" (upper(brand) like upper('%$search%') or |
41 |
|
|
upper(form) like upper('%$search%') or |
42 |
|
|
upper(generic) like upper('%$search%') or |
43 |
|
|
upper(description) like upper('%$search%') ) |
44 |
|
|
"; |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
if ($sql_where != "") { |
48 |
|
|
$sql_where=" where $sql_where"; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
if (isset($search)) { |
52 |
|
|
|
53 |
dpavlin |
1.3 |
$sth = $dbh->prepare("select distinct brand,form,generic,description,type,atc,town,smpc,have_smpc from products $sql_where order by brand asc"); |
54 |
dpavlin |
1.1 |
$sth->execute(); |
55 |
|
|
while ($row=$sth->fetchrow_hash()) { |
56 |
|
|
$data[]=$row; |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
if (!$data) { |
60 |
|
|
$smarty->assign("data","notfound"); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
$smarty->assign("data",$data); |
64 |
|
|
$smarty->assign("search",$search); |
65 |
|
|
|
66 |
|
|
} else { |
67 |
|
|
$smarty->assign("search","all"); |
68 |
|
|
} |
69 |
|
|
|
70 |
dpavlin |
1.2 |
$smarty->assign( array(type=>"$type", |
71 |
|
|
show_description=>$show_description |
72 |
|
|
)); |
73 |
dpavlin |
1.1 |
$main=$smarty->fetch("human_health.tpl"); |
74 |
|
|
|
75 |
|
|
include("common.inc"); |
76 |
|
|
$smarty->assign( array(back_url=>$back_url, MAIN=>$main)); |
77 |
|
|
|
78 |
|
|
$smarty->display("index.tpl"); |
79 |
|
|
?> |