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

Annotation of /inc/pgBolesti-grupe.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sat Sep 29 00:57:58 2001 UTC (22 years, 6 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +5 -4 lines
Fixed a bug when displaying pictures with spaces in filename. Enhanced menu display.

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

  ViewVC Help
Powered by ViewVC 1.1.26