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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Sat Oct 27 16:54:50 2001 UTC (22 years, 5 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -1 lines
Rearranged the menu system on plivamed.net. Other fixes/improvements.

1 <?php
2 function myCmp($a, $b) { return MyCompare($a["naslov"], $b["naslov"]); }
3 function myCmp2($a, $b) { return MyCompare($a["naziv"], $b["naziv"]); }
4 $naslov = "";
5 if ($spec) $grupa = $spec;
6 if ($grupa) {
7 $sql = "SELECT opis FROM specijalizacije WHERE (link) AND (spec_id = $grupa)";
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 if ($row) $row = array_shift($row);
14 if ($row) $naslov = $row;
15 $sql = "SELECT url, naslov, opis FROM linkovi".($spec?", link_spec":"")." WHERE (linkovi.link_id = link_spec.link_id) AND (link_spec.spec_id = $grupa)".($spec?" AND (link_spec.spec_id = $spec)":"");
16 $sth = $dbh->prepare($sql);
17 if (!$sth) error("Cannot prepare query: \"$sql\"");
18 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
19 $linkovi = array();
20 while ($row = $sth->fetchrow_array())
21 array_push($linkovi, array("url" => MyEscape($row[0]), "naslov" => MyEscape($row[1]), "opis" => MyEscape($row[2])));
22 $sth->finish();
23 usort($linkovi, "myCmp");
24 $tpl->assign("linkovi", $linkovi);
25 } else {
26 $sql = "SELECT spec_id, opis FROM specijalizacije WHERE (link)";
27 $sth = $dbh->prepare($sql);
28 if (!$sth) error("Cannot prepare query: \"$sql\"");
29 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
30 $grupe = array();
31 while ($row = $sth->fetchrow_array())
32 array_push($grupe, array("id" => $row[0], "naziv" => MyEscape($row[1])));
33 $sth->finish();
34 usort($grupe, "myCmp2");
35 $tpl->assign("grupe", $grupe);
36 }
37 if ($spec) {
38 $sql = "SELECT opis FROM specijalizacije WHERE spec_id = $spec";
39 $sth = $dbh->prepare($sql);
40 if (!$sth) error("Cannot prepare query: \"$sql\"");
41 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
42 $row = $sth->fetchrow_array();
43 $sth->finish();
44 if ($row) $row = array_shift($row);
45 if ($row) {
46 if ($naslov) $naslov .= " - ";
47 $naslov .= $row;
48 }
49 }
50 $tpl->assign("grupa", $grupa);
51 $tpl->assign("naslov", $naslov);
52 $dbh->disconnect();
53 ?>

  ViewVC Help
Powered by ViewVC 1.1.26