/[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.3 - (show annotations)
Tue Oct 23 16:13:59 2001 UTC (22 years, 8 months ago) by ravilov
Branch: MAIN
Changes since 1.2: +7 -5 lines
Added an author's CV. Added a secondary main article. Added the Related fields to news editor, and also fixed some bugs in it. Other bugfixes and improvements.

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, pic 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)");
36 if ($year) array_push($uvjeti, "(godina_od >= $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, $pic) = $row;
52 if ($pic) list($w, $h) = PicSize($pic, $sysmydir."/img/kongresi");
53 array_push($dogadjanja, array(
54 "naziv" => MyEscape($naziv),
55 "od_d" => $od, "od_m" => $mj[$om - 1], "od_g" => $og,
56 "do_d" => $dd, "do_m" => $mj[$dm - 1], "do_g" => $dg,
57 "organizator" => MyEscape($org),
58 "mjesto" => MyEscape($mjesto),
59 "url" => $url, "url_title" => MyEscape($title),
60 "domaci" => (!$dom || $dom[0] == "f" || $dom[0] == "F") ? false : true,
61 "napomena" => LinkIt(ParseNewline(MyEscape($nap))),
62 "pic" => MyEscape($pic), "w" => $w, "h" => $h
63 ));
64 }
65 $sth->finish();
66 $tpl->assign("dogadjanja", $dogadjanja);
67 }
68 $dbh->disconnect();
69 ?>

  ViewVC Help
Powered by ViewVC 1.1.26