<?php require_once('../Connections/freecrm.php');?>
<?php //include ("../includes/setprefs.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/fullpagetemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="EditRegionhead" -->
<title>Welcome to Free CRM</title>
<meta name="Description" content="Free CRM (Customer Relations Management) provides an unlimited fully functional online multi user CRM system." />
<meta name="Keywords" content="CRM, Customer Relations Management, PRM, Contact Management, Contact Database, Online, Opportunity, Tasks, Calendar, To Do, Reports" />
<style type="text/css">
/*all of the table*/
.caltable
{
font-family: Arial;
empty-cells: hide;
border: none;
}
/*month and year header*/
.calheading
{
font-size: 14px;
font-weight: bold;
border: 1px solid #006666;
background-color:#99CCCC;
padding: 2px;
empty-cells:show;
}
/*days of the week cells*/
.calday
{
font-size: 11px;
font-style: italic;
border: 1px solid #006666;
background-color:#ccc;
padding: 2px;
empty-cells:show;
}
/*date cells that are not today*/
.caldate
{
font-size: 11px;
border: 1px solid #006666;
background-color:#E3E9F1;
padding: 2px;
empty-cells:show;
vertical-align: text-top;
}
/*date cells that are today*/
.caldatetoday {
font-size: 11px;
font-weight: bold;
color:#FF3300;
border: 3px solid #006666;
background-color:#FCEBC2;
padding: 2px;
empty-cells:show;
}
</style>
<?php mysql_select_db($database_freecrm, $freecrm);?>
<?php
class Calendar
{
function generate_calendar($year, $month, $day_func = NULL, $day_heading_length = 3)
{
$first_of_month = mktime (0,0,0, $month, 1, $year);//first of the month
static $day_headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$maxdays = date('t', $first_of_month); //number of days in the month
$date_info = getdate($first_of_month); //get info about the first day of the month
$month = $date_info['mon']; //get name of month
$year = $date_info['year']; // get year
$calendar = "<br /><table width='100%' class='caltable'>"; //create table
$calendar .= "<tr><td colspan='7' class='calheading'>$date_info[month] $year</td></tr>"; //create header with Month & Year
//create days of week header
$calendar .= "
<tr>
<td class='calday'>Sun</td>
<td class='calday'>Mon</td>
<td class='calday'>Tue</td>
<td class='calday'>Wed</td>
<td class='calday'>Thu</td>
<td class='calday'>Fri</td>
<td class='calday'>Sat</td>
</tr>
";
//start of main repeating date cells
$calendar .= "<tr>";
$class = "";
$weekday = $date_info['wday']; //weekday (zero based) of the first day of the month
$day = 1; //starting day of the month
//take care of the first "empty" days of the month
if($weekday > 0)
{
$calendar .= "<td colspan='$weekday'> </td>";
} //print the days of the month
while ($day <= $maxdays)
{
if($weekday == 7)
{ //start a new week
$calendar .= "</tr><tr>";
$weekday = 0;
}
$linkDate = mktime (0,0,0, $month, $day, $year);
if((($day<10 AND "0$day"==date('d')) OR ($day>=10 AND "$day"==date('d'))) AND (($month<10 AND "0$month"==date('m')) OR ($month>=10 AND "$month"==date('m'))) AND $year==date('Y'))
{
$class="caldatetoday";
}
else
{
$d = date('m/d/Y', $linkDate);
$class = "caldate";
}
//output date
$link = "dates.php?date=$linkDate";
$query_RS_Events = "SELECT EVID, EVGROUPCODE, EVCOMPLETED, EVSTART, EVDURATION, EVMANAGER, EVTITLE FROM EVENTS WHERE EVSTART LIKE '$linkDate' ";
$RS_Events = mysql_query($query_RS_Events) or die(mysql_error());
$totalRows_RS_Events = mysql_num_rows($RS_Events);
$calendar .= "<td class='$class'>
".$day."<br>";
do
{
$calendar .= $linkDate."
<a href='../crmevents/updateevent.php?evid=".$row_RS_Events['EVID']."' target='_blank'>".$row_RS_Events['EVTITLE']."</a><br/>
";
}
while ($row_RS_Events = mysql_fetch_assoc($RS_Events));
mysql_free_result($RS_Events);
$calendar .= "
</td>
";
//finish output
//increase day and weekday by 1
$day++;
$weekday++;
}
if($weekday != 7)
{
$calendar .= "<td colspan='" . (7 - $weekday) . "'> </td>";
}
return $calendar . "</tr></table>";
}
}
?>
<?php
//define month and year to view
//if post value is empty, fill with now
if (!isset($_POST['selectyear']))
{
$yeartoview = date('Y');
}
else //or filled with value from form
{
$yeartoview = $_POST['selectyear'];
}
if (!isset($_POST['selectmonth']))
{
$monthtoview = date('m');
}
else
{
$monthtoview = $_POST['selectmonth'];
}
?>
<!-- InstanceEndEditable -->
<link href="../css/page.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<?php include ("../includes/googleanalytics.php");?>
<body class="oneColFixCtr">
<div id="container">
<td>
<?php include ("../includes/header.php");?>
</td>
<div id="mainContent">
<!-- InstanceBeginEditable name="EditRegionmaincontent" -->
<h1>Calendar</h1>
<form name="form1" method="post" action="">
Month:
<select name="selectmonth" id="selectmonth">
<option value="<?php echo $monthtoview;?>" selected><?php echo $monthtoview;?></option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
Year:
<select name="selectyear" id="selectyear">
<option value="<?php echo $yeartoview;?>" selected><?php echo $yeartoview;?></option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
</select>
User:
<label>
<select name="selectuser2" id="selectuser2">
</select>
</label>
<input type="submit" name="Submit" value="Submit">
</form>
<p>
<?php
$cal_m = new Calendar;
echo $cal_m -> generate_calendar($yeartoview, $monthtoview, $day_func = NULL, $day_heading_length = 3);
?>
</p>
<!-- InstanceEndEditable -->
<!-- end #mainContent -->
</div>
<td>
<?php include("../includes/footer.php");?>
</td>
<!-- end #container -->
</div>
</body>
<!-- InstanceEnd --></html>