/[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

Annotation of /sections/vade.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide 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 dpavlin 1.1 <?php
2    
3     include_once("find_html_file.inc");
4    
5     $title.=" : VADEMECUM";
6    
7 dpavlin 1.4 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 dpavlin 1.1 if (isset($smpc) && $smpc >= 1000 && $smpc <= 9999 && find_html_file("vade",$smpc)) {
18 dpavlin 1.2 include_once("read_file.inc");
19     $main = read_file(find_html_file("vade",$smpc));
20 dpavlin 1.1
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 dpavlin 1.2 $title.=" : ZDRAVILA ";
27 dpavlin 1.1 break;
28     case 'V' :
29     $title .= " : VETERINA ";
30     break;
31     }
32 dpavlin 1.4
33     $row[title]=fix_title($row[title]);
34 dpavlin 1.1
35     $title.=" : $row[title]";
36     $smarty->assign("mtext",$row[title]);
37 dpavlin 1.3 $smarty->assign("back_url",$PHP_SELF."?p=vade");
38 dpavlin 1.1 }
39     } else {
40    
41 dpavlin 1.4 $sql_where=array();
42 dpavlin 1.1
43 dpavlin 1.2 if (isset($search) && $search!="" && $search!="all" && $search!="vsi") {
44 dpavlin 1.1 $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 dpavlin 1.2 # print "<pre>$sql</pre>";
59 dpavlin 1.1 $sth = $dbh->prepare($sql);
60     $sth->execute();
61     while ($row=$sth->fetchrow_hash()) {
62 dpavlin 1.4 $row[title]=fix_title($row[title]);
63 dpavlin 1.1 $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 dpavlin 1.2 $smarty->assign("search","vsi");
75 dpavlin 1.1 }
76    
77 dpavlin 1.2 $types = array ('', 'H', 'V');
78     $types_desc = array ('vsi', 'Zdravila', 'Veterina');
79    
80 dpavlin 1.1 $smarty->assign( array(
81 dpavlin 1.2 type=>$type,
82     types=>$types,
83     types_desc=>$types_desc,
84 dpavlin 1.1 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