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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Fri Sep 7 15:07:17 2001 UTC (22 years, 9 months ago) by ravilov
Branch: MAIN
Changes since 1.3: +19 -21 lines
Modularized some pages. Some pages are now printable. Added a JavaScript date-checking module. Minor bugfixes.

1 <?php
2 $dalje = $dalje ? true : false;
3 $tpl->assign("DALJE", $dalje);
4 $foo = getdate();
5 $tpl->assign("year", $foo["year"]);
6 $tpl->assign("ME", $PHP_SELF.HTMLSpecialChars("?section=$section&section_menu=$section_menu&dalje=$dalje"));
7 $godine = array();
8 for ($i = $foo["year"] - 1; $i <= $foo["year"] + 1; $i++) array_push($godine, $i);
9 $tpl->assign("godine", $godine);
10 $mjeseci = array();
11 for ($i = 1; $i <= 12; $i++) array_push($mjeseci, $i);
12 $tpl->assign("mjeseci", $mjeseci);
13 $days = array(31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
14 $y = $godina ? $godina : $foo["year"];
15 $days[1] = (($y % 4) == 0 && ($y % 100) != 0) ? 29 : 28;
16 $dani = array();
17 for ($i = 1; $i <= $days[($mjesec ? $mjesec : $foo["mon"]) - 1]; $i++)
18 array_push($dani, $i);
19 $tpl->assign("dani", $dani);
20 $trajanja = array();
21 for ($i = 24; $i <= 35; $i++) array_push($trajanja, $i);
22 $tpl->assign("trajanja", $trajanja);
23 $tpl->assign("dan", $dan ? $dan : $foo["mday"]);
24 $tpl->assign("mjesec", $mjesec ? $mjesec : $foo["mon"]);
25 $tpl->assign("godina", $godina ? $godina : $foo["year"]);
26 $tpl->assign("trajanje", $trajanje ? $trajanje : 28);
27 $tpl->assign("ime", $ime);
28 if ($kalendar || $print) {
29 $tpl->assign("old_dan", $dan);
30 $tpl->assign("old_mjesec", $mjesec);
31 $tpl->assign("old_godina", $godina);
32 $tpl->assign("old_trajanje", $trajanje);
33 $tpl->assign("old_kalendar", true);
34 $kal = array();
35 $tim = mktime(0, 0, 0, $mjesec, $dan, $godina);
36 $dat = getdate($tim);
37 $dat = getdate(mktime(0, 0, 0, $mjesec, $dan - (($dat["wday"] - 1) % 7), $godina));
38 $ovul = mktime(0, 0, 0, $mjesec, $dan + $trajanje - 14, $godina);
39 $cd = 0;
40 define("DAY", 24 * 60 * 60);
41 for ($i = 0; $i < 7; $i++) {
42 $tmp = array();
43 for ($j = 0; $j < 7; $j++) {
44 if ($dat["mon"] > $mjesec) $cd++;
45 if ($dat["mon"] == $mjesec && $dat["mday"] >= $dan) $cd++;
46 $tim2 = mktime(0, 0, 0, $dat["mon"], $dat["mday"], $godina);
47 $msg = 0;
48 if ($tim2 == $tim) $msg = -1;
49 if ($tim2 == mktime(0, 0, 0, $mjesec, $dan + $trajanje, $godina)) $msg = 1;
50 if ($tim2 == mktime(0, 0, 0, $mjesec, $dan + $trajanje + 2, $godina)) $msg = -2;
51 if ($ovul - $tim2 == DAY || $ovul - $tim2 == (DAY * 2)) $msg = 9;
52 if ($tim2 == $ovul) $msg = 10;
53 if ($tim2 - $ovul == (DAY * 10)) $msg = 3;
54 if ($tim2 - $ovul == (DAY * 12)) $msg = 2;
55 if ($tim2 - $ovul == DAY || $tim2 - $ovul == DAY * 2) $msg = 4;
56 if ($ovul - $tim2 == DAY * 3 || $ovul - $tim2 == DAY * 4 || $ovul - $tim2 == DAY * 5) $msg = 5;
57 array_push($tmp, array(
58 "cd" => $cd,
59 "dat_dan" => $dat["mday"],
60 "dat_mjesec" => $dat["mon"],
61 "msg" => $msg
62 ));
63 $dat = getdate(mktime(0, 0, 0, $dat["mon"], $dat["mday"] + 1, $godina));
64 }
65 array_push($kal, $tmp);
66 }
67 $tp = new Smarty();
68 $tp->assign("ime", $ime);
69 $tp->assign("kal", $kal);
70 $table = $tp->fetch("ovulacija.tpl");
71 $tpl->assign("CONTENT", $table);
72 if (!$print) {
73 include_once("print.php");
74 $tpl->assign("PRINT", GetPrint(array("dan", "mjesec", "godina", "trajanje")));
75 } else $main_template = "wrapper.tpl";
76 }
77 if (!$ns4 && $dalje) {
78 $date = ($dan && $mjesec && $godina) ? "new Date($godina, $mjesec, $dan)" : "null";
79 if (!$godina) $godina = $foo["year"];
80 $before = $godina - $foo["year"] + 1;
81 $after = $foo["year"] - $godina + 1;
82 $onload .= "DS = new DateSelector(document.forms[0], $date, $before, $after);";
83 }
84 ?>

  ViewVC Help
Powered by ViewVC 1.1.26