<?
include("../inc/local.inc.php");
include("../inc/wombat.inc.php");
include("../inc/header.inc.php");
include("../inc/msg.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 "<table id=\"calendar\">
<caption> <h1><a href=\"index.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=\"index.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 language = 'JavaScript'>
function DropDownMenu(url)
{
MyNewWindow=
window.open(url, 'Calendar' , 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=400,left=25,top=25');
}
</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\" bgcolor=\"#D0D4E8\"> <a href=\"dailyindex.php?day=$day_of_month&month=$month&year=$year\" class=\"date\">$day_of_month</a>";
}
else
{
echo "
<td valign=\"top\" class=\"$current_era\">
<a href=\"dailyindex.php?day=$day_of_month&month=$month&year=$year\"
class=\"date\">$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'];
$event_time = date('g:i A', $row['start']);
$auth = $row['author'];
if ($row['public']==1)
{
if($day_of_month == date("j")&& $month == date("n") && $year == date("Y"))
{
echo " <tr><br><a href=\"cal_events_edit.php?event_id=$row[id]\"> ". $words['ind_pub'] . "$auth <br> $typeofevent : <br>$event_time - $subject </a><br>";
}
else
{
echo " <tr><td><a href=\"cal_events_edit.php?event_id=$row[id]\"> ". $words['ind_pub'] . "$auth <br> $typeofevent : <br>$event_time - $subject </a>";
}
}
else
{
if($day_of_month == date("j")&& $month == date("n") && $year == date("Y"))
{
echo "<tr><br><a href=\"cal_events_edit.php?event_id=$row[id]\">".$words['ind_priv']." $auth <br>$typeofevent : <br>$event_time - $subject
</a><br>";
}
else
{
echo "<tr><td><a href=\"cal_events_edit.php?event_id=$row[id]\">".$words['ind_priv']." $auth <br>$typeofevent : <br>$event_time - $subject
</a>";
}
}
}
if($tabling == 1)
echo '</table>';
if($day_of_month != date("j")&& $month == date("n") && $year == date("Y"))
echo ' </td>';
}
echo "\n </tr>\n";
if($day_of_month >= $lastday)
break;
}
echo ' </tbody> </table>';
$ls_cal_users = "select login, emp_id, emp_name from employee where is_active=1";
$cal_user_list = do_sql($ls_cal_users);
echo "<br>".$words['week_viewcal']." :
<select name = cal_users class = choice onChange=\"DropDownMenu(this.value)\">";
#echo "<option SELECTED> --- ".$words['week_select_user']." --- </option>";
while($cal_user_array = mysql_fetch_array($cal_user_list))
{
echo "<option value = other_monthview.php?day=$day&&month=$month&&year=$year&&user_cal_id=".$cal_user_array['emp_id']."&&user_cal_login=".$cal_user_array['emp_name'].">". $cal_user_array['login']." </option>";
}
echo "</select>";
echo "</div><div class=\"content_vervolg\">";
include("week_availability.inc.php");
echo "</div>";
include("../inc/footer.inc.php");
?>
</body>
</html>