Location: PHPKode > projects > Eridu - Web based Groupware > eridu-0.9.1/eridu/html/calendar/calmain.php
<?php
/**************************************************************************
 * Eridu - Web based Groupware                                            *
 **************************************************************************
 * Copyright (c) 2000, The Eridu Project                                  *
 **************************************************************************
 * This source file is subject to version 2.0 of the GNU GENERAL PUBLIC   *
 * LICENSE that is bundled with this package in the file COPYING, and is  *
 * available through the world-wide-web at:                               *
 * http://www.gnu.org/copyleft/gpl.html                                   *
 * If you did not receive a copy of the license and are unable to         *
 * obtain it through the world-wide-web, please send a note to            *
 * eridu-hide@address.com so we can mail you a copy          *
 * immediately.                                                           *
 **************************************************************************
 *
 * $Id: calmain.php,v 1.5 2000/12/07 15:34:04 coldblood Exp $
 *
 * Revision History:
 * $Log: calmain.php,v $
 * Revision 1.5  2000/12/07 15:34:04  coldblood
 * redid javascript in calendar
 *
 *
 */

?>
<?php
include("eridu.conf");
include("$eriduBasePath/html/lib/uiFunctions.php");
$useTypes=array("calendar");
uiPreHeader($useTypes); 
//uiHeader("Calendar", "general.css");
$eriduCal =& $myEriduState->ISArray["calendar"][$myEriduState->defaultIS["calendar"]];
$curdate = getdate(time());
if ($curyear == "")
{
	$curmonth = $curdate[mon];
	$curyear = $curdate[year];
	$curday = $curdate[mday];
}

?>
<BODY TEXT=000000 BGCOLOR=808080 LINK=000000 ALINK=000000 VLINK=000000 TOPMARGIN=3 LEFTMARGIN=2>
<form name=dataform method=post action="calmain.php">
<?php
drawInput("hidden", "curday", $curday);
drawInput("hidden", "curmonth", $curmonth);
drawInput("hidden", "curyear", $curyear);
drawInput("hidden", "displaytype", $displaytype);
?>
</form>
<?php
if ($displaytype) { // weekly view
	$weekarray = $eriduCal->getWeeklyEventArray($curyear,$curmonth,$curday);
	$dayarray = array ("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
	$montharray = array ("","January","February","March","April","May","June","July","August","September","October","November","December");  
	echo "<BR><center>Monday, ".$montharray[$weekarray[0][month]]." ".$weekarray[0][day]." - Sunday ".$montharray[$weekarray[6][month]]." ".$weekarray[6][day]."</center><BR><BR>";
	echo "<table cellspacing=0 cellpadding=0 width=100%>";
	$numrows=2;
	for ($i=0;$i<4;$i++) {
		if ($i==3)
			$numrows=1;		
		echo "<TR>";
		for ($j=0;$j<$numrows;$j++) {
			echo "<TD bgcolor=c0c0c0 align=right width=50%>";
			echo "<font size=2>";
			echo $dayarray[2*$i+$j].", ".$montharray[$weekarray[2*$i+$j][month]]." ".$weekarray[2*$i+$j][day];
			echo "</font></td>";
		}
		echo "</tr>";
		echo "<TR>";
		for ($j=0;$j<$numrows;$j++) {
			echo "<TD bgcolor=white align=left width=50%>";
			echo "<font size=2>"; 
			for ($k=0;$k<count($weekarray[2*$i+$j][events]);$k++) {
				$dataarray = $eriduCal->getEventInfo($weekarray[2*$i+$j][events][$k][id]);
//				echo $dataarray[startHour].":".$dataarray[startMin]." - ";
//				echo $dataarray[endHour].":".$dataarray[endMin]." ";
				echo $dataarray[start]." - ".$dataarray[end]." ";
				$opener = $composeArray["meeting"]["opener"];
				echo "<a href=\"javascript:parent.openNewWindow('meetroot.php?opener=$opener&eventId=".$weekarray[2*$i+$j][events][$k][id]."');\">";
				echo $dataarray[title];
				echo "</a><BR>";

			}
			if (count($weekarray[2*$i+$j][events]) == 0)
				echo "&nbsp";
			echo "</font></td>";
		}
		echo "</tr>";
	}
} else { // daily view

$start = $eriduCal->startday; $end = $eriduCal->endday-1;
//$start=18; $end=34;
$colarray = array ("c0c0c0","ff0000","ffffff");

//get list of events in properly formatted array
$returnarray = $eriduCal->getDailyEventArray ($curyear,$curmonth,$curday,$start,$end);
$allday = $returnarray[allday];
$eventarray = $returnarray[disp];

// display all day events:
if (count($allday)>0) {
	echo "<center><table border=2 width=80%><tr><td colspan=3><center>All day events</center></td></tr>";
	$opener = $composeArray["meeting"]["opener"];
	for ($i=0;$i<count($allday);$i++) {
		echo "<TR><td><a href=\"javascript:parent.openNewWindow('meetroot.php?opener=$opener&eventId=".$allday[$i]."');\">Edit </a></td>";
		$dataArray = $eriduCal->getEventInfo($allday[$i]);
		echo "<TD width=50%>".$dataArray[title]."</TD>";
//		echo "<TD>".$dataArray[startHour].":".$dataArray[startMin]." to ";
//		echo $dataArray[endHour].":".$dataArray[endMin]."</TD></TR>";
		echo "<TD>".$dataArray[start]." to ".$dataArray[end]."</TD></TR>";
	} 
	echo "</table></center>";
}

// display the left row (times)
$ampmstr = "AM";
$time24 = $eriduCal->timeformat;
$half = 0;
if ($time24)
	$hour = 0;
else
	$hour = 12;
echo "<table border=0 cellpadding=0 cellspacing=1 WIDTH=100% HEIGHT=100% >";
for ($i=0;$i<48;$i++) {
	echo "<tr>";
	echo "<td bgcolor=c0c0c0 width=\"60\" valign=middle align=right><font size=-1><nobr>";
	if ($half)
		echo ":30";
	else {
		echo $hour;
		echo ":00";
		if (!$time24)
			echo " ".$ampmstr;
	}
	echo "</nobr></font></td>\n";
	for ($k=0;$k<count($eventarray);$k++) {
		for ($l=0;$l<count($eventarray[$k]);$l++) {
			if ($eventarray[$k][$l][start] == $i) {
				echo "<TD valign=top bgcolor=";
				echo $colarray[($eventarray[$k][$l][used])];
				echo " rowspan=".$eventarray[$k][$l][count].">";
				// check if appointment
				$opener = $composeArray["meeting"]["opener"];
				if ($eventarray[$k][$l][id] !=0) {
					echo "<a href=\"javascript:parent.openNewWindow('meetroot.php?opener=$opener&eventId=".$eventarray[$k][$l][id]."');\">Edit</a><BR>";
					$dataArray = $eriduCal->getEventInfo($eventarray[$k][$l][id]);
					echo $dataArray[title]."<BR>";
//					echo $dataArray[startHour].":".$dataArray[startMin]." to ";
//					echo $dataArray[endHour].":".$dataArray[endMin]."</TD>";
					echo $dataArray[start]." to ".$dataArray[end]."</td>";
				} else 
					echo "&nbsp";
				echo "</td>";
			}
		}
	}
	echo "</tr>\n";
	if ($half)
		$hour++;
	$half = 1 - $half;
	if (!$time24) {
		if (($hour==12) && (!$half))
			$ampmstr = "PM";
		if ($hour==13)
			$hour = 1;
	}
}
// end display times
} // end daily view
?>
</table>
</BODY>
</HTML>
Return current item: Eridu - Web based Groupware