Location: PHPKode > projects > Wombat Open Source > wombat/calendar/other_monthview.php
<?
include("../inc/local.inc.php");
include("../inc/wombat.inc.php");
include("../inc/calendar.inc.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?
echo "</head><body>";
if(eregi("MSIE",$_SERVER['HTTP_USER_AGENT']))
{
	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"genericie.css\" />"; 
	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style-ie.css\" />";
}
else 
{
	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"generic.css\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\"style0.css\" />";
}

$currentday = date('j');
$currentmonth = date('n');
$currentyear = date('Y');

if(!isset($_GET['user_cal_id']))
	$user_cal_id = $gs_tdrn_id;
else
	$user_cal_id = $_GET['user_cal_id'];

if(!isset($_GET['user_cal_login']))
	$user_cal_login = $gs_user;
else
	$user_cal_login = $_GET['user_cal_login'];
	

if (!isset($HTTP_GET_VARS['month'])) 
  $month = $currentmonth;
else 
  $month = $HTTP_GET_VARS['month'];


if(!isset($HTTP_GET_VARS['year'])) 
    $year = $currentyear;
else 
    $year = date('Y', mktime(0,0,0,$month,1,$HTTP_GET_VARS['year']));


if(!isset($HTTP_GET_VARS['day']))
{
    if($month == $currentmonth && $year == $currentyear) 
		$day = $currentday;
    else
		$day = 1;
} 
else 
{
    $day = ($HTTP_GET_VARS['day'] - 1) % date("t", mktime(0,0,0,$month,1,$year)) + 1;
}

while($month < 1) $month += 12;
	$month = ($month - 1) % 12 + 1;

  
$firstday = getdate(mktime(0,0,0,1,1,$year));
$firstparamday = 32 - $firstday['wday'];
if($firstparamday < 32)
{
	$firstparamyear = $year - 1;
	$firstparammonth = 12;
}
  
$firstparam = mktime(0,0,0,$firstparammonth,$firstparamday,$firstparamyear);
$curday = mktime(0,0,0,$month,$day,$year);
 
$nextmonth = $month + 1;
$lastmonth = $month - 1;

$firstday = (date("w", mktime(0,0,0,$month,1,$year)) + 6) % 7;
$lastday = date("t", mktime(0,0,0,$month,1,$year));
  	
echo "<html><head>  <title> $user_cal_login".$words['ow_header']."</title>";

echo "<table id=\"calendar\">  <caption> <h1><a href=\"other_monthview.php?month=$lastmonth&&year=$year&&user_cal_id=$user_cal_id&&user_cal_login=$user_cal_login\" class=noline> « </a>" . month_name($month) . " $year  <a href=\"other_monthview.php?month=$nextmonth&&year=$year&&user_cal_id=$user_cal_id&&user_cal_login=$user_cal_login\" class=noline> » </a></h1></caption>  <thead> <tr>\n";

 
  
 echo '    <th>' .  $words['Mon'] . '</th>
    <th>' . $words['Tue'] . '</th>
    <th>' .  $words['Wed'] . '</th>
    <th>' . $words['Thu'] . '</th>
    <th>' .  $words['Fri'] . '</th>
    <th>' .  $words['Sat'] . '</th>
	<th>' .  $words['Sun'] . '</th>';


  echo '  </tr>  </thead>  <tbody>';
?>

<script>
function DropDownMenu(url)
{
settings=
"toolbar=yes,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width=900,height=1200,left=25,top=25";

MyNewWindow=
window.open(url, "Private Calendar" , settings);
}
</script>


<?

for ($week_index = 0;; $week_index++) 
{
	echo '  <tr>' . "\n";

for ($day_of_week = 0; $day_of_week < 7; $day_of_week++) 
{
	$i = $week_index * 7 + $day_of_week;
    $day_of_month = $i - $firstday + 1;

    if($i < $firstday || $day_of_month > $lastday) 
	{
		echo '    <td class="none"></td>';
		continue;
    }


    if($currentyear > $year || $currentyear == $year && ($currentmonth > $month || $currentmonth == $month && $currentday > $day_of_month)) 
	{
		$current_era = 'past';
    } 
	else 
	{
		$current_era = 'future';
    }
	if($day_of_month == date("j")&&  $month == date("n") && $year == date("Y"))
	{
	    echo "<td valign=\"top\" class=\"today\"> <a>$day_of_month</a>";
	}
	else 
	{
		echo " <td valign=\"top\" class=\"$current_era\"> <a>$day_of_month</a>";
	}


    $result = eventsdate($day_of_month, $month, $year, $user_cal_id);

   
    $tabling = 0;
    while($row = mysql_fetch_array($result)) 
	{
		if($tabling == 0) 
		{
		    if(eregi("MSIE",$_SERVER['HTTP_USER_AGENT'])) 
			{ 
				echo "\n<table cellspacing=\"1\">\n";
			} 
			else 
			{
				echo "\n<table>\n";
			}
			$tabling = 1;
		}
            
		$subject = stripslashes($row['subject']);
      	  
		if($row['eventtype']==2)
	  		$typeofevent = $words['ind_app'];
		if($row['eventtype']==3)
	  		$typeofevent = $words['ind_meet'];
		if($row['eventtype']==4)
  			$typeofevent = $words['ind_other'];	
		
		if(empty($hours_24)) 
			$timeformat = 'g:i A';
        else 
			$timeformat = 'G:i';
 
        $event_time = date($timeformat, $row['start']);
		$event_time_end = date($timeformat, $row['end']);
		$auth = $row['author'];
		
		if ($row['public']==1)
		{
	   		if($user_cal_id == $gs_tdrn_id)
			{
				echo "<tr><td> <a href=\"cal_events_edit.php?event_id=$row[id]\"> ".$words['ow_pub']." $auth<br> $typeofevent : <br>$event_time - $event_time_end $subject</a>";
			}
			else
			{
				echo "<tr><td> <a> ".$words['ow_pub']." $auth<br> $typeofevent : <br>$event_time - $event_time_end $subject</a>";
			}
	   

		}
		elseif($row['public']==2) 
		{
			if($user_cal_id ==$gs_tdrn_id)
			{
				 echo "<tr>	<td><a href=\"cal_events_edit.php?event_id=$row[id]\">".$words['ow_priv']." $auth <br>$typeofevent : <br>$event_time - $event_time_end $subject</a>";
			}
			else 
			{
				echo "<tr><td><a>".$words['ow_priv']." $auth <br>$event_time - $event_time_end <br> $subject</a>";
			}
		}
		else 
		{
			if($user_cal_id ==$gs_tdrn_id)
			{
				 echo "<tr><td><a href=\"cal_events_edit.php?event_id=$row[id]\">".$words['ow_conf']." $auth <br>$typeofevent : <br>$event_time - $event_time_end $subject</a>";
			}
			else 
			{
				echo "<tr><td>	<a>	".$words['ow_conf']." $event_time - $event_time_end 	</a>";
			}
		
		
		}
    }
        
    if($tabling == 1) 
		 echo '</table>';
    
	echo '    </td>';
  }
  echo "\n  </tr>\n";


  if($day_of_month >= $lastday) 
    break;
 
}

echo ' </tbody> </table>';

echo "</div>";
?>
Return current item: Wombat Open Source