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

Annotation of /inc/pgBolesti-bolesti.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Fri Sep 28 23:34:37 2001 UTC (22 years, 6 months ago) by ravilov
Branch: MAIN
Added some new pages to PLIVAmed. Some bugfixes.

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

  ViewVC Help
Powered by ViewVC 1.1.26