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 |
$main=join('',file(find_html_file("vade",$smpc))); |
9 |
|
10 |
$sth = $dbh->prepare("select smpc,type,title from vademecum where smpc=$smpc"); |
11 |
$sth->execute(); |
12 |
if ($row=$sth->fetchrow_hash()) { |
13 |
switch ($row[type]) { |
14 |
case 'H' : |
15 |
$title.=" : HUMAN "; |
16 |
break; |
17 |
case 'V' : |
18 |
$title .= " : VETERINA "; |
19 |
break; |
20 |
} |
21 |
|
22 |
$title.=" : $row[title]"; |
23 |
$smarty->assign("mtext",$row[title]); |
24 |
} |
25 |
} else { |
26 |
|
27 |
|
28 |
if (isset($search) && $search!="" && $search!="all") { |
29 |
$sql_where[]="upper(title) like upper('%$search%')"; |
30 |
} |
31 |
|
32 |
if (isset($type) && $type != "") { |
33 |
$sql_where[]="upper(type)=upper('$type')"; |
34 |
} |
35 |
|
36 |
if (isset($search)) { |
37 |
|
38 |
$sql = "select distinct smpc,type,title from vademecum "; |
39 |
if ($sql_where) { |
40 |
$sql.=" where ".join(" and ",$sql_where); |
41 |
} |
42 |
$sql.=" order by title asc"; |
43 |
print "<pre>$sql</pre>"; |
44 |
$sth = $dbh->prepare($sql); |
45 |
$sth->execute(); |
46 |
while ($row=$sth->fetchrow_hash()) { |
47 |
$data[]=$row; |
48 |
} |
49 |
|
50 |
if (!$data) { |
51 |
$smarty->assign("data","notfound"); |
52 |
} |
53 |
|
54 |
$smarty->assign("data",$data); |
55 |
$smarty->assign("search",$search); |
56 |
|
57 |
} else { |
58 |
$smarty->assign("search","all"); |
59 |
} |
60 |
|
61 |
$smarty->assign( array( |
62 |
type=>"$type", |
63 |
self=>$PHP_SELF, |
64 |
title=>$title |
65 |
)); |
66 |
$main=$smarty->fetch("vade.tpl"); |
67 |
|
68 |
} |
69 |
|
70 |
?> |