12) { $nextMonth = 1; $nextYear = $theYear + 1; } // $res = mysql_query("SELECT * FROM ".$tblprefix."calendar WHERE userid = ".$agendaid." AND ((themonth = ".$theMonth." AND theyear = ".$theYear.") OR (recurrence = 'year' AND themonth = ".$theMonth.") OR (theyear <= ".$theYear." AND themonth <= ".$theMonth." AND endyear >= ".$theYear." AND endmonth >= ".$theMonth.")) ORDER BY type, thetime"); $res = mysql_query("SELECT * FROM ".$tblprefix."calendar WHERE userid = ".$agendaid." AND ((themonth = ".$theMonth." AND theyear = ".$theYear.") OR (type = 'birthday' AND themonth = ".$theMonth." AND theyear <= ".$theYear.") OR (theyear < ".$theYear." AND endyear > ".$theYear.") OR (theyear = ".$theYear." AND endyear > ".$theYear." AND themonth <= ".$theMonth.") OR (theyear < ".$theYear." AND endyear = ".$theYear." AND endmonth >= ".$theMonth.") OR (theyear = ".$theYear." AND endyear = ".$theYear." AND themonth <= ".$theMonth." AND endmonth >= ".$theMonth.")) ORDER BY type, thetime"); $d = array(); // Loop door alle gegevens die uit de database komen if ($agendashared["ShareConfig"] == "All" || $agendaid == $userid || $agendashared["ShareConfig"] == "Busy") { $theShareList = array(); foreach ($typeImg as $typekey => $typevalue) { $theShareList[] = $typekey; } } elseif ($agendashared["ShareConfig"] == "Defined") { $theShareList = explode(",",$agendashared["SharedObjects"]); } if ($agendaid != 0 && mysql_num_rows($res)) { while ($geg = mysql_fetch_array($res)) { if ($agendashared["ShareConfig"] == "Busy" && $userid != $agendaid) { $geg["type"] = "general"; $geg["title"] = "***************"; } // Is een afspraak op één dag if (($geg["endday"] == $geg["theday"] && $geg["endmonth"] == $geg["themonth"] && $geg["theyear"] == $geg["endyear"]) || !$geg["endday"]) { // Kijk of de array bestaat, al bestaat deze niet, maak deze aan if (!is_array($d[$geg["theday"]]) && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]] = array(); } // Vul de array met de gegevens uit de database if (in_array($geg["type"],$theShareList)) { $d[$geg["theday"]][$geg["id"]] = array(); $d[$geg["theday"]][$geg["id"]]["Type"] = $geg["type"]; $d[$geg["theday"]][$geg["id"]]["Title"] = $geg["title"]; } // Kijk of de arrays bestaan, al bestaat deze niet, maak deze aan if (!is_array($d[$geg["theday"]]["types"]) && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"] = array(); } if (!is_array($d[$geg["theday"]]["types"][$geg["type"]]) && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]] = array(); } // Vul de gegevens uit de database per type in de array if ($geg["type"] == "birthday" && in_array($geg["type"],$theShareList)) { $bdjaar = $theYear - $geg["theyear"]; $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["title"]."(".$bdjaar.")"; } elseif ($geg["type"] == "appointment" && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["thetime"]."".$geg["title"].""; } elseif ($geg["type"] == "job" && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["thetime"]." - ".$geg["endtime"]."".$geg["title"].""; } elseif (in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["title"].""; } } else { // De afspraak spreidt zich dus uit over een periode // Begint de afspraak voordat de maand begint? Dan starten bij Day 1, anders bij dezelfde dag. if ($theMonth > $geg["themonth"] || $theYear > $geg["theyear"]) { $StartDay = 1; } else { $StartDay = $geg["theday"]; } // Eindigt de afspraak deze maand nog, of ergens na deze maand (dan is de laatste dag, de laatste dag van deze maand) if ($theMonth < $geg["endmonth"] || $theYear < $geg["endyear"]) { $EndDay = GetDaysOfMonth($theMonth, $theYear); } else { $EndDay = $geg["endday"]; } // Loop door alle dagen heen die de periode omvatten for ($i=$StartDay;$i<=$EndDay;$i++) { $geg["theday"] = $i; // Kijk of de array bestaat, al bestaat deze niet, maak deze aan if (!is_array($d[$geg["theday"]])) { $d[$geg["theday"]] = array(); } // Vul de array met de gegevens uit de database $d[$geg["theday"]][$geg["id"]] = array(); $d[$geg["theday"]][$geg["id"]]["Type"] = $geg["type"]; $d[$geg["theday"]][$geg["id"]]["Title"] = $geg["title"]; // Kijk of de arrays bestaan, al bestaat deze niet, maak deze aan if (!is_array($d[$geg["theday"]]["types"]) && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"] = array(); } if (!is_array($d[$geg["theday"]]["types"][$geg["type"]]) && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]] = array(); } // Vul de gegevens uit de database per type in de array if ($geg["type"] == "birthday" && in_array($geg["type"],$theShareList)) { $bdjaar = $theYear - $geg["theyear"]; $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["title"]."(".$bdjaar.")"; } elseif ($geg["type"] == "appointment" && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["thetime"]."".$geg["title"].""; } elseif ($geg["type"] == "job" && in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["thetime"]." - ".$geg["endtime"]."".$geg["title"].""; } elseif (in_array($geg["type"],$theShareList)) { $d[$geg["theday"]]["types"][$geg["type"]][] = "".$geg["title"].""; } } } } } ?> Purple Agenda
Ingelogd als:
> >
Ga naar:
0) { echo ""; echo ""; } $n = 0; $active = 0; if (GetFirstDayOfMonth($theMonth,$theYear) == 0) { $n = 0; $active = 1; $a = 1; } for ($i=1;$i<=6;$i++) { echo ""; echo ""; for ($j=1;$j<=7;$j++) { if ($n == 0 || $active == 0) { if ($j == GetFirstDayOfMonth($theMonth,$theYear) && $active == 0) { $n = 1; $a = 1; $active = 1; } else { $n = Date("j",mktime(0,0,0,$theMonth,($j-GetFirstDayOfMonth($theMonth,$theYear)+1),$theYear)); } } elseif ($n >= GetDaysOfMonth($theMonth,$theYear)) { if ($active == 1) { $n = 1; $active = 2; $theMonth = $theMonth + 1; } else { $n++; } } else { $n++; if ($a == 1) $a = 2; else $a = 1; } $tm = $theMonth; $ty = $theYear; if ($active == 0) $tm = $tm - 1; if ($tm < 1) { $tm = 12; $ty = $theYear - 1; } if ($tm > 12) { $tm = 1; $ty = $theYear + 1; } echo ""; } echo ""; } echo "
"; for ($j=0;$j<7;$j++) { echo ""; echo $WeekDay[$j]; echo "
"; if ($active > 0) { echo GetWeekOfYear($n+3,$theMonth,$theYear); } else { echo GetWeekOfYear($n+1,$theMonth,$theYear); } echo ""; } else { if ($extraclass != "") $extraclass .= "theDayNoEntrysColor "; echo "CLASS='$extraclass theDay".$a."' thecolor='$extraclass theDay".$a."'>"; } } else { echo "CLASS='theDayOther' thecolor='theDayOther'>"; } if ($active == 1 && is_array($d[$n])) { echo $ShortDay[$j-1]." ".$n." ".$ShortMonth[$theMonth-1]; } else { echo $n; } echo "
"; if (is_array($d[$n]) && $active == 1) { foreach ($d[$n]["types"] as $key => $value) { echo ""; } } echo "
"; } elseif (!$_GET["config"] && $agendaid == 0) { include "login.inc"; } elseif ($_GET["config"] == "admin") { include "config.inc"; } elseif ($_GET["config"] == "address") { include "contacts.inc"; } elseif ($_GET["config"] == "superadmin") { if ($_SESSION["usertype"] == "admin") { include "users.inc"; } } function GetFirstDayOfMonth($month,$year) { $firstDayOfMonth = date("w",mktime(0,0,0,$month,1,$year)); if ($firstDayOfMonth == 0) $firstDayOfMonth = 7; return $firstDayOfMonth; } function GetDaysOfMonth($month,$year) { $daysOfMonth = date("t",mktime(0,0,0,$month,1,$year)); return $daysOfMonth; } function GetWeekOfYear($day,$month,$year) { $weekN = date("W",mktime(0,0,0,$month,$day,$year)); return $weekN; } if (isset($_GET["month"])) { $theMonth = $_GET["month"]; } else { $theMonth = Date("n"); } if (isset($_GET["year"])) { $theYear = $_GET["year"]; } else { $theYear = Date("Y"); } if (isset($_GET["day"])) { $theDate = $_GET["day"]; } else { $theDate = Date("j"); } ?>
0) { ?>
Overzicht
Overzicht uitgeschakeld