Esempio n. 1
0
	window.location = './index.php?m=calendar&a=day_view&date='+uts;
}
function clickWeek( uts, fdate ) {
	window.location = './index.php?m=calendar&a=week_view&date='+uts;
}
</script>

<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td>
<?php 
// establish the focus 'date'
$date = new CDate($date);
// prepare time period for 'events'
$first_time = new CDate($date);
$first_time->setDay(1);
$first_time->setTime(0, 0, 0);
$first_time->subtractSeconds(1);
$last_time = new CDate($date);
$last_time->setDay($date->getDaysInMonth());
$last_time->setTime(23, 59, 59);
$links = array();
// assemble the links for the tasks
require_once dPgetConfig('root_dir') . "/modules/calendar/links_tasks.php";
getTaskLinks($first_time, $last_time, $links, 20, $company_id);
// assemble the links for the events
require_once dPgetConfig('root_dir') . "/modules/calendar/links_events.php";
getEventLinks($first_time, $last_time, $links, 20);
// create the main calendar
$cal = new CMonthCalendar($date);
$cal->setStyles('motitle', 'mocal');
$cal->setLinkFunctions('clickDay', 'clickWeek');
$cal->setEvents($links);
function getBeginWeek($d)
{
    $dn = intval($d->Format("%w"));
    $dd = new CDate($d);
    $dd->subtractSeconds($dn * 24 * 3600);
    return intval($dd->Format("%U"));
}