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

Diff of /sections/vade.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Mon Nov 19 09:11:36 2001 UTC revision 1.6 by dpavlin, Wed Nov 21 09:16:47 2001 UTC
# Line 4  include_once("find_html_file.inc"); Line 4  include_once("find_html_file.inc");
4    
5  $title.=" : VADEMECUM";  $title.=" : VADEMECUM";
6    
7    $all_local = "vse";
8    
9    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  if (isset($smpc) && $smpc >= 1000 && $smpc <= 9999 && find_html_file("vade",$smpc)) {  if (isset($smpc) && $smpc >= 1000 && $smpc <= 9999 && find_html_file("vade",$smpc)) {
20          $main=join('',file(find_html_file("vade",$smpc)));          include_once("read_file.inc");
21            $main = read_file(find_html_file("vade",$smpc));
22    
23          $sth = $dbh->prepare("select smpc,type,title from vademecum where smpc=$smpc");          $sth = $dbh->prepare("select smpc,type,title from vademecum where smpc=$smpc");
24          $sth->execute();          $sth->execute();
25          if ($row=$sth->fetchrow_hash()) {          if ($row=$sth->fetchrow_hash()) {
26                  switch ($row[type]) {                  switch ($row[type]) {
27                          case 'H' :                          case 'H' :
28                                  $title.=" : HUMAN ";                                  $title.=" : ZDRAVILA ";
29                                  break;                                  break;
30                          case 'V' :                          case 'V' :
31                                  $title .= " : VETERINA ";                                  $title .= " : VETERINA ";
32                                  break;                                  break;
33                  }                  }
34    
35                    $row[title]=fix_title($row[title]);
36                                    
37                  $title.=" : $row[title]";                  $title.=" : $row[title]";
38                  $smarty->assign("mtext",$row[title]);                  $smarty->assign("mtext",$row[title]);
39                    $smarty->assign("back_url",$PHP_SELF."?p=vade");
40          }          }
41  } else {  } else {
42    
43            $sql_where=array();
44    
45          if (isset($search) && $search!="" && $search!="all") {          if (isset($search) && $search!="" && $search!="all" && $search!=$all_local) {
46                  $sql_where[]="upper(title) like upper('%$search%')";                  $sql_where[]="upper(title) like upper('%$search%')";
47          }          }
48    
# Line 40  if (isset($smpc) && $smpc >= 1000 && $sm Line 57  if (isset($smpc) && $smpc >= 1000 && $sm
57                          $sql.=" where ".join(" and ",$sql_where);                          $sql.=" where ".join(" and ",$sql_where);
58                  }                  }
59                  $sql.=" order by title asc";                  $sql.=" order by title asc";
60                  print "<pre>$sql</pre>";  #               print "<pre>$sql</pre>";
61                  $sth = $dbh->prepare($sql);                  $sth = $dbh->prepare($sql);
62                  $sth->execute();                  $sth->execute();
63                  while ($row=$sth->fetchrow_hash()) {                  while ($row=$sth->fetchrow_hash()) {
64                            $row[title]=fix_title($row[title]);
65                          $data[]=$row;                          $data[]=$row;
66                  }                  }
67    
# Line 55  if (isset($smpc) && $smpc >= 1000 && $sm Line 73  if (isset($smpc) && $smpc >= 1000 && $sm
73                  $smarty->assign("search",$search);                  $smarty->assign("search",$search);
74    
75          } else {          } else {
76                  $smarty->assign("search","all");                  $smarty->assign("search",$all_local);
77          }          }
78    
79            $types = array ('', 'H', 'V');
80            $types_desc = array ('kjerkoli', 'zdravila', 'veterina');
81    
82          $smarty->assign( array(          $smarty->assign( array(
83                          type=>"$type",                          type=>$type,
84                          self=>$PHP_SELF,                          types=>$types,
85                            types_desc=>$types_desc,
86                          title=>$title                          title=>$title
87                  ));                  ));
88          $main=$smarty->fetch("vade.tpl");          $main=$smarty->fetch("vade.tpl");

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.26