1 |
<?php |
2 |
|
3 |
include_once("find_html_file.inc"); |
4 |
|
5 |
$title.=" : VADEMECUM"; |
6 |
|
7 |
if (isset($smpc) && $smpc >= 1000 && $smpc <= 9999 && find_html_file("vade",$smpc)) { |
8 |
include_once("read_file.inc"); |
9 |
$main = read_file(find_html_file("vade",$smpc)); |
10 |
|
11 |
$sth = $dbh->prepare("select smpc,type,title from vademecum where smpc=$smpc"); |
12 |
$sth->execute(); |
13 |
if ($row=$sth->fetchrow_hash()) { |
14 |
switch ($row[type]) { |
15 |
case 'H' : |
16 |
$title.=" : ZDRAVILA "; |
17 |
break; |
18 |
case 'V' : |
19 |
$title .= " : VETERINA "; |
20 |
break; |
21 |
} |
22 |
|
23 |
$title.=" : $row[title]"; |
24 |
$smarty->assign("mtext",$row[title]); |
25 |
$smarty->assign("back_url",$PHP_SELF."?p=vade"); |
26 |
} |
27 |
} else { |
28 |
|
29 |
|
30 |
if (isset($search) && $search!="" && $search!="all" && $search!="vsi") { |
31 |
$sql_where[]="upper(title) like upper('%$search%')"; |
32 |
} |
33 |
|
34 |
if (isset($type) && $type != "") { |
35 |
$sql_where[]="upper(type)=upper('$type')"; |
36 |
} |
37 |
|
38 |
if (isset($search)) { |
39 |
|
40 |
$sql = "select distinct smpc,type,title from vademecum "; |
41 |
if ($sql_where) { |
42 |
$sql.=" where ".join(" and ",$sql_where); |
43 |
} |
44 |
$sql.=" order by title asc"; |
45 |
# print "<pre>$sql</pre>"; |
46 |
$sth = $dbh->prepare($sql); |
47 |
$sth->execute(); |
48 |
while ($row=$sth->fetchrow_hash()) { |
49 |
$data[]=$row; |
50 |
} |
51 |
|
52 |
if (!$data) { |
53 |
$smarty->assign("data","notfound"); |
54 |
} |
55 |
|
56 |
$smarty->assign("data",$data); |
57 |
$smarty->assign("search",$search); |
58 |
|
59 |
} else { |
60 |
$smarty->assign("search","vsi"); |
61 |
} |
62 |
|
63 |
$types = array ('', 'H', 'V'); |
64 |
$types_desc = array ('vsi', 'Zdravila', 'Veterina'); |
65 |
|
66 |
$smarty->assign( array( |
67 |
type=>$type, |
68 |
types=>$types, |
69 |
types_desc=>$types_desc, |
70 |
self=>$PHP_SELF, |
71 |
title=>$title |
72 |
)); |
73 |
$main=$smarty->fetch("vade.tpl"); |
74 |
|
75 |
} |
76 |
|
77 |
?> |