/[health_html]/inc/pgBolesti-bolesti.php
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 /inc/pgBolesti-bolesti.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Sep 29 00:57:58 2001 UTC (17 years, 7 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -13 lines
Fixed a bug when displaying pictures with spaces in filename. Enhanced menu display.

1 <?php
2 include("inc/conn.php");
3 function myComp($a, $b) { return MyCompare($a["name"], $b["name"]); }
4 function escape_quote($str) { return str_replace('"', "&quot;", $str); }
5 $tpl->assign("ID", $bid);
6 if ($bid) {
7 list($bid, $aid) = explode("-", $bid);
8 $sql = "SELECT bolesti.naziv, opis, grupe_bolesti.naziv FROM bolesti, grupe_bolesti WHERE (bolesti.bolest_id = $bid) AND (grupe_bolesti.grupa_b_id = bolesti.grupa_bolesti_id)";
9 $sth = $dbh->prepare($sql);
10 if (!$sth) error("Cannot prepare query: \"$sql\"");
11 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
12 $row = $sth->fetchrow_array();
13 $sth->finish();
14 list($snaziv, $opis, $grupa) = $row;
15 array_push($PATH, MyUpper($grupa));
16 array_push($PATH, MyUpper($snaziv));
17 $tpl->assign("bolest", escape_quote($snaziv));
18 $tpl->assign("opis", escape_quote(ParseNewline($opis)));
19 $tpl->assign("grupa", escape_quote($grupa));
20 $sql = "SELECT thumb, thumb_alt, full_pic FROM bolesti_slika WHERE (bolesti_slika.bolest_id = $bid)";
21 $sth = $dbh->prepare($sql);
22 if (!$sth) error("Cannot prepare query: \"$sql\"");
23 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
24 $row = $sth->fetchrow_array();
25 $sth->finish();
26 $tpl->assign("thumb", str_replace("+", "%20", urlencode(escape_quote($row[0]))));
27 $tpl->assign("thumb_alt", MyEscape($row[1]));
28 $tpl->assign("full", str_replace("+", "%20", urlencode(escape_quote($row[2]))));
29 $sql = "SELECT alias FROM bolesti_aliasi WHERE (bolest_id = $bid) ORDER BY alias";
30 $sth = $dbh->prepare($sql);
31 if (!$sth) error("Cannot prepare query: \"$sql\"");
32 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
33 $aliasi = array();
34 while ($row = $sth->fetchrow_array()) array_push($aliasi, MyEscape($row[0]));
35 $sth->finish();
36 $tpl->assign("aliases", $aliasi);
37 } else {
38 $tpl->assign("naslov", "Bolesti");
39 $sql = "SELECT bolesti.bolest_id, bolesti.naziv, grupe_bolesti.naziv FROM bolesti, grupe_bolesti WHERE (bolesti.grupa_bolesti_id = grupe_bolesti.grupa_b_id) AND (NOT grupe_bolesti.plivamed) AND (bolesti.is_bolest)";
40 $sth = $dbh->prepare($sql);
41 if (!$sth) error("Cannot prepare query: \"$sql\"");
42 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
43 $bolesti = array();
44 while ($row = $sth->fetchrow_array()) {
45 array_push($bolesti, array("id" => $row[0]."-0", "name" => MyEscape($row[1]), "grupa" => MyEscape($row[2])));
46 $sql = "SELECT alias_id, alias FROM bolesti_aliasi WHERE (bolesti_aliasi.bolest_id = ".$row[0].")";
47 $sth2 = $dbh->prepare($sql);
48 if (!$sth2) error("Cannot prepare query: \"$sql\"");
49 if (!$sth2->execute()) error("Cannot execute query: \"$sql\"");
50 while ($row2 = $sth2->fetchrow_array())
51 array_push($bolesti, array("id" => $row[0]."-".$row2[0], "name" => MyEscape($row2[1]), "grupa" => MyEscape($row[2])));
52 $sth2->finish();
53 }
54 $sth->finish();
55 usort($bolesti, "myComp");
56 $slova = array();
57 while (list($k, $v) = each($bolesti)) {
58 $fl = $v["name"][0];
59 for ($i = 0; $i < count($slova); $i++) if ($slova[$i]["fl"] == $fl) break;
60 if (!$slova[$i]) $slova[$i] = array("fl" => $fl, "bolesti" => array());
61 array_push($slova[$i]["bolesti"], $v);
62 }
63 $tpl->assign("slova", $slova);
64 }
65 $dbh->disconnect();
66 ?>

  ViewVC Help
Powered by ViewVC 1.1.26