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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Sep 28 23:34:37 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.1: +60 -1 lines
Added some new pages to PLIVAmed. Some bugfixes.

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 $grupe = array();
7 $sql = "SELECT naziv FROM grupe_bolesti WHERE (grupa_b_id = $id)";
8 $sth = $dbh->prepare($sql);
9 if (!$sth) error("Cannot prepare query: \"$sql\"");
10 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
11 $grupa = $sth->fetchrow_array();
12 $sth->finish();
13 if ($grupa) $grupa = array_shift($grupa);
14 $tpl->assign("naslov", $grupa);
15 $grupe = array();
16 $sql = "SELECT bolest_id, naziv FROM bolesti WHERE (grupa_bolesti_id = $id) AND (is_bolest)";
17 $sth = $dbh->prepare($sql);
18 if (!$sth) error("Cannot prepare query: \"$sql\"");
19 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
20 while ($row = $sth->fetchrow_array()) {
21 array_push($grupe, array("id" => $row[0]."-0", "name" => MyEscape($row[1])));
22 $sql = "SELECT alias_id, alias FROM bolesti_aliasi WHERE (bolest_id = ".$row[0].")";
23 $sth2 = $dbh->prepare($sql);
24 if (!$sth2) error("Cannot prepare query: \"$sql\"");
25 if (!$sth2->execute()) error("Cannot execute query: \"$sql\"");
26 while ($row2 = $sth2->fetchrow_array())
27 array_push($grupe, array("id" => $row[0]."-".$row2[0], "name" => MyEscape($row2[1])));
28 $sth2->finish();
29 }
30 $sth->finish();
31 usort($grupe, "myComp");
32 $slova = array();
33 while (list($k, $v) = each($grupe)) {
34 $fl = $v["name"][0];
35 for ($i = 0; $i < count($slova); $i++) if ($slova[$i]["fl"] == $fl) break;
36 if (!$slova[$i]) $slova[$i] = array("fl" => $fl, "grupe" => array());
37 array_push($slova[$i]["grupe"], $v);
38 }
39 $tpl->assign("slova", $slova);
40 } else {
41 $tpl->assign("naslov", "Grupe bolesti");
42 $grupe = array();
43 $sql = "SELECT grupa_b_id, naziv FROM grupe_bolesti WHERE (grupa_b_id <> 0) AND (NOT plivamed)";
44 $sth = $dbh->prepare($sql);
45 if (!$sth) error("Cannot prepare query: \"$sql\"");
46 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
47 while ($row = $sth->fetchrow_array())
48 array_push($grupe, array("id" => $row[0], "name" => MyEscape($row[1])));
49 $sth->finish();
50 usort($grupe, "myComp");
51 $slova = array();
52 while (list($k, $v) = each($grupe)) {
53 $fl = $v["name"][0];
54 for ($i = 0; $i < count($slova); $i++) if ($slova[$i]["fl"] == $fl) break;
55 if (!$slova[$i]) $slova[$i] = array("fl" => $fl, "grupe" => array());
56 array_push($slova[$i]["grupe"], $v);
57 }
58 $tpl->assign("slova", $slova);
59 }
60 $tpl->assign("ID", $id);
61 $dbh->disconnect();
62 ?>

  ViewVC Help
Powered by ViewVC 1.1.26