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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Oct 12 09:22:02 2001 UTC (22 years, 6 months ago) by ravilov
Branch: MAIN
Changes since 1.1: +51 -2 lines
Added Kalendar dogaðanja to PLIVAmed.net. Moved HTTP auth to external .htaccess files. Other bugfixes.

1 <?php
2 include("inc/conn.php");
3 $date = getdate();
4 if (!isset($type)) $type = 1;
5 $tpl->assign("type", $type);
6 if (!isset($month)) $month = $date["mon"];
7 $tpl->assign("month", $month);
8 if (!isset($year)) $year = $date["year"];
9 $tpl->assign("year", $year);
10 if (!isset($sort)) $sort = 2;
11 $tpl->assign("sort", $sort);
12 $tpl->assign("kreni", $kreni);
13 $mjeseci = array("sijeèanj", "veljaèa", "o¾ujak", "travanj", "svibanj", "lipanj", "srpanj", "kolovoz", "rujan", "listopad", "studeni", "prosinac");
14 $mj = array("sijeènja", "veljaèe", "o¾ujka", "travnja", "svibnja", "lipnja", "srpnja", "kolovoza", "rujna", "listopada", "studenog", "prosinca");
15 $tpl->assign("mjeseci", $mjeseci);
16 $sql = "SELECT DISTINCT godina_od, godina_do FROM kongresi";
17 $sth = $dbh->prepare($sql);
18 if (!$sth) error("Cannot prepare query: \"$sql\"");
19 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
20 $godine = array();
21 while ($row = $sth->fetchrow_array()) {
22 list($od, $do) = $row;
23 $fnd = false;
24 for ($i = 0; $i < count($godine); $i++) if ($godine[$i] == $od) $fnd = true;
25 if (!$fnd) array_push($godine, $od);
26 for ($i = 0; $i < count($godine); $i++) if ($godine[$i] == $do) $fnd = true;
27 if (!$fnd) array_push($godine, $do);
28 }
29 $sth->finish();
30 $tpl->assign("godine", $godine);
31 if ($kreni) {
32 $sql = "SELECT DISTINCT kongresi.kon_id, naziv, dan_od, mjesec_od, godina_od, dan_do, mjesec_do, godina_do, mjesto, organizator, domaci, url, url_naziv, napomena FROM kongresi, kon_spec";
33 $uvjeti = array();
34 if ($type) array_push($uvjeti, "(".(($type == 1) ? "" : "NOT ")."domaci)");
35 if ($month) array_push($uvjeti, "(mjesec_od >= $month) AND (mjesec_do <= $month)");
36 if ($year) array_push($uvjeti, "(godina_od >= $year) AND (godina_do <= $year)");
37 if ($spec) array_push($uvjeti, "(kon_spec.spec_id = $spec) AND (kon_spec.kon_id = kongresi.kon_id)");
38 $uvjeti = implode(" AND ", $uvjeti);
39 if ($uvjeti) $sql .= " WHERE $uvjeti";
40 if ($sort) {
41 if ($sort == 1) $sql .= " ORDER BY naziv";
42 if ($sort == 2) $sql .= " ORDER BY godina_od, mjesec_od, dan_od, godina_do, mjesec_do, dan_do";
43 if ($sort == 3) $sql .= " ORDER BY mjesto";
44 if ($sort == 4) $sql .= " ORDER BY organizator";
45 }
46 $sth = $dbh->prepare($sql);
47 if (!$sth) error("Cannot prepare query: \"$sql\"");
48 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
49 $dogadjanja = array();
50 while ($row = $sth->fetchrow_array()) {
51 list($id, $naziv, $od, $om, $og, $dd, $dm, $dg, $mjesto, $org, $dom, $url, $title, $nap) = $row;
52 array_push($dogadjanja, array(
53 "naziv" => MyEscape($naziv),
54 "od_d" => $od, "od_m" => $mj[$om - 1], "od_g" => $og,
55 "do_d" => $dd, "do_m" => $mj[$dm - 1], "do_g" => $dg,
56 "organizator" => MyEscape($org),
57 "mjesto" => MyEscape($mjesto),
58 "url" => $url, "url_title" => MyEscape($title),
59 "domaci" => (!$dom || $dom[0] == "f" || $dom[0] == "F") ? false : true,
60 "napomena" => LinkIt(ParseNewline(MyEscape($nap)))
61 ));
62 }
63 $sth->finish();
64 $tpl->assign("dogadjanja", $dogadjanja);
65 }
66 $dbh->disconnect();
67 ?>

  ViewVC Help
Powered by ViewVC 1.1.26