/[pliva-si]/sections/vade.inc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sections/vade.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Nov 19 11:20:40 2001 UTC (22 years, 4 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +12 -6 lines
file function has a bug?

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 }
26 } else {
27
28
29 if (isset($search) && $search!="" && $search!="all" && $search!="vsi") {
30 $sql_where[]="upper(title) like upper('%$search%')";
31 }
32
33 if (isset($type) && $type != "") {
34 $sql_where[]="upper(type)=upper('$type')";
35 }
36
37 if (isset($search)) {
38
39 $sql = "select distinct smpc,type,title from vademecum ";
40 if ($sql_where) {
41 $sql.=" where ".join(" and ",$sql_where);
42 }
43 $sql.=" order by title asc";
44 # print "<pre>$sql</pre>";
45 $sth = $dbh->prepare($sql);
46 $sth->execute();
47 while ($row=$sth->fetchrow_hash()) {
48 $data[]=$row;
49 }
50
51 if (!$data) {
52 $smarty->assign("data","notfound");
53 }
54
55 $smarty->assign("data",$data);
56 $smarty->assign("search",$search);
57
58 } else {
59 $smarty->assign("search","vsi");
60 }
61
62 $types = array ('', 'H', 'V');
63 $types_desc = array ('vsi', 'Zdravila', 'Veterina');
64
65 $smarty->assign( array(
66 type=>$type,
67 types=>$types,
68 types_desc=>$types_desc,
69 self=>$PHP_SELF,
70 title=>$title
71 ));
72 $main=$smarty->fetch("vade.tpl");
73
74 }
75
76 ?>

  ViewVC Help
Powered by ViewVC 1.1.26