/[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.2 - (hide 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 dpavlin 1.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 dpavlin 1.2 include_once("read_file.inc");
9     $main = read_file(find_html_file("vade",$smpc));
10 dpavlin 1.1
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 dpavlin 1.2 $title.=" : ZDRAVILA ";
17 dpavlin 1.1 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 dpavlin 1.2 if (isset($search) && $search!="" && $search!="all" && $search!="vsi") {
30 dpavlin 1.1 $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 dpavlin 1.2 # print "<pre>$sql</pre>";
45 dpavlin 1.1 $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 dpavlin 1.2 $smarty->assign("search","vsi");
60 dpavlin 1.1 }
61    
62 dpavlin 1.2 $types = array ('', 'H', 'V');
63     $types_desc = array ('vsi', 'Zdravila', 'Veterina');
64    
65 dpavlin 1.1 $smarty->assign( array(
66 dpavlin 1.2 type=>$type,
67     types=>$types,
68     types_desc=>$types_desc,
69 dpavlin 1.1 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