/[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.6 - (hide annotations)
Wed Nov 21 09:16:47 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +5 -3 lines
prijevodi

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

  ViewVC Help
Powered by ViewVC 1.1.26