} $month = $AppUI->getState('TimecardMonthlyMonth'); if ($show_other_worksheets) { if (isset($_GET['user_id'])) { $AppUI->setState('TimecardMonthlyUserId', $_GET['user_id']); } else { $AppUI->setState('TimecardMonthlyUserId', $AppUI->user_id); } $user_id = $AppUI->getState('TimecardMonthlyUserId') ? $AppUI->getState('TimecardMonthlyUserId') : 0; } else { $user_id = $AppUI->user_id; } $start_report = new CDate(); $start_report->setMonth($month); $start_report->setYear($year); $start_report->setDay(1); $start_report->setTime(0, 0, 0); $end_report = new CDate(); $end_report->copy($start_report); $end_report->addMonths(1); $end_report->addDays(-1); $end_report->setTime(23, 59, 59); //Get hash of users $sql = "SELECT user_id, contact_email, concat(contact_last_name,' ',contact_first_name) as name FROM users LEFT JOIN contacts AS c ON users.user_contact = contact_id ORDER BY contact_last_name, contact_first_name;"; $result = db_loadList($sql); $people = array(); // users list foreach ($result as $row) { $people[$row['user_id']] = $row; $users[$row['user_id']] = $row['name']; }
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); echo $cal->show(); //echo '<pre>';print_r($cal);echo '</pre>';
function clickDay( uts, fdate ) { 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> <?php // establish the focus 'date' if (!$date) { $date = new CDate(); } else { $date = new CDate($date); } $date->setDay(1); $date->setMonth(1); $prev_year = $date->format(FMT_TIMESTAMP_DATE); $prev_year = (int) ($prev_year - 10000); $next_year = $date->format(FMT_TIMESTAMP_DATE); $next_year = (int) ($next_year + 10000); ?> <table class="std" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" cellspacing="0" cellpadding="4"> <tr> <td colspan="20" valign="top"> <table border="0" cellspacing="1" cellpadding="2" width="100%" class="motitle"> <tr> <td>
$minical->showWeek = false; $minical->clickMonth = true; $minical->setLinkFunctions('clickDay'); $first_time = new CDate($cal->prev_month); $first_time->setDay(1); $first_time->setTime(0, 0, 0); $last_time = new CDate($cal->prev_month); $last_time->setDay($cal->prev_month->getDaysInMonth()); $last_time->setTime(23, 59, 59); $links = array(); getTaskLinks($first_time, $last_time, $links, 20, $company_id, true); getEventLinks($first_time, $last_time, $links, 20); $minical->setEvents($links); echo '<table class="std" cellspacing="0" cellpadding="0" border="0" width="100%"><tr>'; echo '<td valign="top" align="center" width="220">' . $minical->show() . '</td>'; echo '<td valign="top" align="center" width="75%"> </td>'; $minical->setDate($cal->next_month); $first_time = new CDate($cal->next_month); $first_time->setDay(1); $first_time->setTime(0, 0, 0); $last_time = new CDate($cal->next_month); $last_time->setDay($cal->next_month->getDaysInMonth()); $last_time->setTime(23, 59, 59); $links = array(); getTaskLinks($first_time, $last_time, $links, 20, $company_id, true); getEventLinks($first_time, $last_time, $links, 20, true); $minical->setEvents($links); echo '<td valign="top" align="center" width="220">' . $minical->show() . '</td>'; echo '</tr></table>'; ?> </td></tr></table>