/[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.4 - (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.3: +12 -1 lines
Rearranged the menu system on plivamed.net. Other fixes/improvements.

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

  ViewVC Help
Powered by ViewVC 1.1.26