/* +---------------------------------------------------------------+ | e107 website system | /e_PLUGIN."calnder.php | | ©Steve Dunstan 2001-2002 | http://jalist.com | stevedunstan@jalist.com | | Released under the terms and conditions of the | GNU General Public License (http://gnu.org). | | $Source: /cvsroot/e107/e107/e107_plugins/calendar_menu/calendar.php,v $ | $Revision: 1.6 $ | $Date: 2004/09/03 18:32:10 $ | $Author: e107coders $ +---------------------------------------------------------------+ */ // get current date information --------------------------------------------------------------------- define("PAGE_NAME", "Show Calendar"); require_once("../../class2.php"); require_once(HEADERF); $num = $_POST['num']; if(IsSet($_POST['viewallevents'])){ Header("Location: ".e_PLUGIN."calendar_menu/event.php?".$_POST['enter_new_val']); } if(IsSet($_POST['doit'])){ Header("Location: ".e_PLUGIN."calendar_menu/event.php?ne.".$_POST['enter_new_val']); } $ec_dir = e_PLUGIN."calendar_menu/"; $lan_file = $ec_dir."languages/".e_LANGUAGE.".php"; include(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php"); // new part by cam. $qs = explode(".", e_QUERY); $action = $qs[0]; if ($action == "") { $datearray = getdate(); $month = $datearray['mon']; $year = $datearray['year']; $day = $datearray['day']; } else { $datearray = getdate($action); $month = $datearray['mon']; $year = $datearray['year']; } // set up arrays for calender display ------------------------------------------------------------------ $week = Array('S','M','T','W','T','F','S'); $months = Array(EC_LAN_0,EC_LAN_1,EC_LAN_2,EC_LAN_3,EC_LAN_4,EC_LAN_5,EC_LAN_6,EC_LAN_7,EC_LAN_8,EC_LAN_9,EC_LAN_10,EC_LAN_11); $monthabb = Array(EC_LAN_JAN,EC_LAN_FEB,EC_LAN_MAR,EC_LAN_APR,EC_LAN_MAY,EC_LAN_JUN,EC_LAN_JUL,EC_LAN_AUG,EC_LAN_SEP,EC_LAN_OCT,EC_LAN_NOV,EC_LAN_DEC); $calendar_title = "".$months[$datearray[mon]-1]." ".$current_year.""; // ----------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------- // show events------------------------------------------------------------------------------------------- // get first and last days of month in unix format--------------------------------------------------- $monthstart= mktime(0,0,0,$month,1,$year); $firstdayarray = getdate($monthstart); $monthend = mktime(0,0,0,$month+1,1,$year); $lastdayarray = getdate($monthend); // ---------------------------------------------------------------------------------------------------------- // echo current month with links to previous/next months ---------------------------------------- $prevmonth = ($month-1); $prevyear = $year; if ($prevmonth == 0) { $prevmonth = 12; $prevyear = ($year-1); } $previous = mktime(0,0,0,$prevmonth,1, $prevyear); $nextmonth = ($month+1); $nextyear = $year; if ($nextmonth == 13) { $nextmonth = 1; $nextyear = ($year+1); } $next = mktime(0,0,0,$nextmonth,1, $nextyear); $py = $year-1; $prevlink = mktime(0,0,0,$month,1, $py); $ny = $year+1; $nextlink = mktime(0,0,0,$month,1, $ny); $cal_text = "
| << ".$months[($prevmonth-1)]." | ".$months[($month-1)]." ".$year." | ".$months[($nextmonth-1)]." >> |
| << ".$py." | "; for ($ii = 0; $ii < 13; $ii++){ $m = $ii+1; $monthjump= mktime(0,0,0,$m,1,$year); $cal_text .= "".$monthabb[$ii]." "; } $cal_text .= " | ".$ny." >> |
".$day."
| ";
}
$text .= "|||
| "; } $loop = $firstdayarray['wday']; for ($c=1; $c<=31; $c++) { $dayarray = getdate($start+(($c-1)*86400)); $stopp = mktime(24,0,0,$calmonth,$c,$calyear); $startt = mktime(0,0,0,$calmonth,$c,$calyear); $sql2 = new db; $sql2 -> db_Select("event_cat", "*", "event_cat_id!='' "); while($event_cat = $sql2-> db_Fetch()){ extract($event_cat); $category_icon[$event_cat_id]= $event_cat_icon; $category_title[$event_cat_id]= $event_cat_name; } $sql -> db_Select("event", "*", "event_start>='$startt' AND event_start<='$stopp' ORDER BY event_start"); $events = $sql -> db_Rows(); // Highlight the current day. if ($dayarray['mon'] == $calmonth) { if ($nowday == $c && $calmonth == $nowmonth && $calyear == $nowyear && !$event_true[($c)]&& !$event_true_end[($c)]) { $text .=" | ";
$text .="
".$c."
[today]
";
} elseif($event_true[($c)] || $event_true_end[($c)]) {
$text .=" | "; $text .=" ".$c." "; }else { $text .=" | ";
$text .="
".$c."
";
}
if ($event_true_end[($c)]) {
$indicat = $event_true_end[($c)]==1? "->":"|";
$text .=" ".substr($event_title,10,9); if (strlen($event_title) > 15){ $oevent_title .= ".."; } } else { $oevent_title = $event_title; } if ($event_true[($c)]) { $linkut = mktime(0 ,0 ,0 ,$datearray['mon'], $c, $datearray['year']); if(($_POST['do'] == NULL || $_POST['event_cat_ids'] == "all") || ($_POST['event_cat_ids'] == $event_cat_id)){ $text .=" | ';
}
$loop++;
if ($loop == 7) {
$loop = 0;
$text .= '