/[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.4 - (show annotations)
Tue Nov 20 11:26:14 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
Changes since 1.3: +14 -0 lines
small fixes

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

  ViewVC Help
Powered by ViewVC 1.1.26