index.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:49k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: index.php,v $
- // | $Date: 2004/02/10 01:34:25 $
- // | $Revision: 1.157 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Calendar viewer.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- // start file
- require("./../global.php");
- tech_nav('calendar');
- if ($_REQUEST['do'] == 'added') {
- alert('Task added');
- unset($_REQUEST['do']);
- }
- // defaults
- $_REQUEST['do'] = trim($_REQUEST['do']);
- if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
- $_REQUEST['do'] = "monthly";
- }
- $_REQUEST['type'] = trim($_REQUEST['type']);
- if (!isset($_REQUEST['type']) or $_REQUEST['type'] == "") {
- $_REQUEST['type'] = "calendar";
- }
- // globalise variables
- $global = array (
- array('year'),
- array('day'),
- array('month'),
- array('week')
- );
- rg($global);
- require_once(INCLUDE_PATH . 'functions/calendar_functions.php');
- #####################################################################################
- ############################### SEARCH SETUP ###############################
- #####################################################################################
- if (isset($_REQUEST['search'])) {
- if ($_REQUEST['search'] == 'upcoming') {
- // Set up a search for all unfinished tasks within a reasonable timeframe
- $startdate = '1970-01-01';
- $enddate = date('Y-m-d', strtotime(date('Y-m-d') . " + 1 month")); // Go a month out in the future
- $complete = 0;
- $search = 'upcoming';
- } else {
- // Perform a normal search
- if ($_REQUEST['ystartdate'] OR $_REQUEST['mstartdate'] OR $_REQUEST['dstartdate']) {
- $startdate = formatymd($_REQUEST['ystartdate'].'-'.$_REQUEST['mstartdate'].'-'.$_REQUEST['dstartdate']);
- }
- if ($_REQUEST['yenddate'] OR $_REQUEST['menddate'] OR $_REQUEST['denddate']) {
- $enddate = formatymd($_REQUEST['yenddate'].'-'.$_REQUEST['menddate'].'-'.$_REQUEST['denddate']);
- }
- $search = 1;
- }
- // Force the monthly list view for the search since that's where the search logic is
- $_REQUEST['do'] = 'monthly';
- $_REQUEST['type'] = 'list';
- }
- #####################################################################################
- ############################### QUICK ADD ENTRY ###############################
- #####################################################################################
- if ($_REQUEST['addentry'] == '1') {
- $date = $_REQUEST['ydate'] . '-' . $_REQUEST['mdate'] . '-' . $_REQUEST['ddate'];
- if (trim($_REQUEST['title']) == '') {
- $error .= 'The title was left empty\n';
- }
- if (trim($_REQUEST['description']) == '') {
- $error .= 'The description was left empty\n';
- }
- if ($_REQUEST['title'] == 'Title ...') {
- $error .= 'Please specify a title.\n';
- }
- if ($_REQUEST['description'] == 'Message ...') {
- $error .= 'Please specify a description/message.\n';
- }
- $date = formatymd($date); // needs month day year
- $tmp = split('-', $date);
- if (!@checkdate($tmp[1], $tmp[2], $tmp[0])) {
- $error .= 'The date entered was not valid\n';
- }
-
- // Add record if no errors. We do *not* e-mail reminders here, because
- // the quick form only adds scheduled entries for the technician
- // submitting the form.
- if (!$error) {
- $checks = xss_check(array($_REQUEST['title'], $_REQUEST['description']), 'tech');
- $db->query("INSERT INTO calendar_task SET
- title = '" . mysql_escape_string($checks[0]) . "',
- description = '" . mysql_escape_string($checks[1]) . "',
- repeattype = '0',
- techmaker = '$user[id]',
- startdate = '$date',
- enddate = '$date',
- timezone = '$settings[timezone]',
- weekstart = '$user[weekstart]'
- ");
- $id = $db->last_id();
-
- $db->query("INSERT INTO calendar_task_tech SET
- eventid = '$id',
- techid = '$user[id]'
- ");
- alert('Task Added');
- } else {
- alert($error);
- }
- }
- #####################################################################################
- ############################### TOGGLE AND DELETE ##############################
- #####################################################################################
- // There's lots of different types of events, and we have to handle them all
- // here, so each 'ids' entry is itself an array of two required elements, and
- // an optional one, separated by "|" characters, as in:
- //
- // 1234|2003-04-19|2
- //
- // This entry refers to a reminder to look at ticket 1234 on April 19, 2003.
- //
- // 4321|2003-05-13
- //
- // This entry refers to a normal scheduled event (or a repeat iteration). If
- // event 4321 is repeating and the date specified here isn't the item's start
- // date, this entry refers to the repeat iteration, not the parent event.
- // If it *does* match, this refers to the parent event, or to an event with
- // no repeat options.
- if (isset($_REQUEST['Process'])) {
- // Sort out event IDs and dates
- if (is_array($_REQUEST['ids'])) {
- foreach ($_REQUEST['ids'] as $key => $var) {
- $key = explode('|', $key);
- if ($key[2]) { // It's a ticket watch event, not a normal one
- $watches[$key[0]][] = $key[1];
- } else {
- $events[$key[0]][] = $key[1];
- }
- }
- }
-
- if (is_array($events)) {
- $ids = array2sql(array_keys($events));
- }
- if (!$ids) {
- $ids = "('')";
- }
- if (is_array($watches)) {
- $watches = array2sql(array_keys($watches));
- }
- if ($_REQUEST['action']) { // Delete or stop repeating today
- // We only want to let the user delete items he's created himself.
- $db->query("SELECT id FROM calendar_task WHERE id IN $ids AND techmaker = '$user[id]'");
- $ids = array();
- while($row = $db->row_array()) {
- $ids[] = $row[0];
- }
- $ids = array2sql($ids);
- if ($_REQUEST['action'] == 2) { // Stop repeating, set due today
- // We only want to update repeating items here; don't mess with normal items
- $db->query("UPDATE calendar_task SET enddate = now() WHERE id IN $ids AND repeattype");
- alert("Repetition stopped.");
- } else {
- $db->query("DELETE FROM calendar_task WHERE id IN $ids");
- $db->query("DELETE FROM calendar_task_tech WHERE eventid IN $ids");
- $db->query("DELETE FROM calendar_task_iteration WHERE taskid IN $ids");
- if ($watches) {
- $db->query("DELETE FROM tech_ticket_watch WHERE ticketid IN $watches AND techid = '$user[id]'");
- }
- alert("Item(s) deleted.");
- }
-
- } else { // Toggle
- if (is_array($events)) {
- foreach($events as $key => $val) {
- foreach($val as $key2 => $val2) {
-
- $db->query("SELECT techmaker, title, description, notifycompletion, multistaff, repeattype FROM calendar_task WHERE id = '$key'");
- $res = $db->row_array();
- $maker = $res['techmaker'];
- $title = $res['title'];
- $descr = $res['description'];
- $notify = $res['notifycompletion'];
- $staff = $res['multistaff'];
- $repeat = $res['repeattype'];
-
- $db->query('SELECT id, username, email FROM tech WHERE id = '' . mysql_escape_string($maker) . "' or id = '$user[id]'");
- while ($result = $db->row_array()) {
- $emails[$result['id']]['username'] = $result['username'];
- $emails[$result['id']]['email'] = $result['email'];
- }
-
- if ($staff OR $repeat) { // If multistaff, we have to update the iterations table
- $row = $db->query_return("SELECT taskid, completed
- FROM calendar_task_iteration
- WHERE taskid = '$key'
- AND task_techid = '$user[id]'
- AND date = '$val2'"
- );
- if ($db->num_rows()) { // Toggling an existing record
- $db->query("UPDATE calendar_task_iteration
- SET completed = !completed
- WHERE taskid = '$key'
- AND task_techid = '$user[id]'
- AND date = '$val2'"
- );
- $db->query("SELECT completed
- FROM calendar_task_iteration
- WHERE taskid = '$key'
- AND task_techid = '$user[id]' AND
- date = '$val2'"
- );
- $res = $db->row_array();
- $done = $res['completed'];
- } else { // Marking completed, no existing iteration record
-
- $db->query("INSERT INTO calendar_task_iteration
- (task_techid, taskid, completed, date)
- VALUES ('$user[id]', '$key', '1', '$val2')"
- );
-
- $done = 1;
- }
- } else { // Otherwise, update the tech table
-
- $db->query("SELECT eventid, completed
- FROM calendar_task_tech
- WHERE eventid = '$key'
- AND techid = '$user[id]'"
- );
- if ($db->num_rows()) {
- $row = $db->row_array();
- $db->query("UPDATE calendar_task_tech
- SET completed = !completed
- WHERE eventid = '$key'
- AND techid = '$user[id]'"
- );
- $done = $row['completed'];
- }
- }
- if (($maker != $user[id]) && $notify) { // If the owner wants notifications and the owner isn't making this update, start sending mail
- if ($done) {
- $done = "complete";
- } else {
- $done = "incomplete";
- }
- $taskusername = $emails[$user['id']]['username'];
- $taskurl = $settings['helpdesk_url'] . "/tech/calendar/viewtask.php?id=$id";
- $tasktitle = htmlspecialchars($title);
- $taskdescription = htmlspecialchars($descr);
- $taskdone = $done;
- eval(makeemaileval('message', 'TECHBODY_task_toggled', $subject));
- dp_mail($emails[$maker][email], $subject, $message);
- }
- }
- }
- }
- if ($watches) {
- $db->query("UPDATE tech_ticket_watch SET completed = !completed WHERE id IN $watches AND techid = '$user[id]'");
- }
- alert("Item(s) toggled.");
- }
- }
- #####################################################################################
- ############################### USEFUL VARIABLES ###############################
- #####################################################################################
- // we are getting some useful variables that will be used for display
- // incoming dateform
- if ($_REQUEST['ddate']) {
- $day = ($_REQUEST['ddate']);
- }
- if ($_REQUEST['mdate']) {
- $month = ($_REQUEST['mdate']);
- }
- if ($_REQUEST['ydate']) {
- $year = ($_REQUEST['ydate']);
- }
- // arrays of dates
- $month_array = array(
- '1' => 'Jan',
- '2' => 'Feb',
- '3' => 'Mar',
- '4' => 'Apr',
- '5' => 'May',
- '6' => 'Jun',
- '7' => 'Jul',
- '8' => 'Aug',
- '9' => 'Sep',
- '10' => 'Oct',
- '11' => 'Nov',
- '12' => 'Dec'
- );
- $day_array = make_numberarray(1, 31);
- $year_array = make_numberarray(2000, 2050);
- $days_array = array(
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday'
- );
- $daysshort_array = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
- // current dates
- $today_d = date('d');
- $today_m = date('m');
- $today_y = date('Y');
- $today = "$today_y-$today_m-$today_d";
- // default weekstart or use monday
- if (!$user['weekstart']) {
- $user['weekstart'] = 7;
- }
- // is it today?
- if ($year == $today_y AND $month == $today_m AND $day == $today_d) {
- $its_today = 1;
- }
- // any dates? use current
- if (!$year) {
- $year = $today_y;
- }
- if (!$month) {
- $month = $today_m;
- }
- if (!$day) {
- $day = $today_d;
- }
- if(!$date) {
- $date = $year . '-' . $month . '-' . $day;
- }
- $named_day = $day;
- $named_month = date('M', mktime(0,0,0,$month,$day,$year));
- $named_year = $year;
- $taskstoday = 0;
- $taskstoday_overdue = 0;
- $tasks_today = cachetasks($today, $today, 1);
- if (is_array($tasks_today)) {
- foreach($tasks_today AS $date_tmp => $tasks) {
- foreach ($tasks AS $task) {
- if ($date_tmp != $today) {
- $taskstoday_overdue++;
- } else {
- $taskstoday++;
- }
- }
- }
- }
- if ($taskstoday_overdue) {
- $taskstoday = "$taskstoday/$taskstoday_overdue*";
- }
- #####################################################################################
- ############################### PAGE NAVIGATION ###############################
- #####################################################################################
- $hidden = form_hidden('do', $_REQUEST['do']) . form_hidden('type', $_REQUEST['type']);
- $hidden .= form_hidden('overdue', $_REQUEST['overdue']);
- if ($_REQUEST['do'] == 'yearly') {
- $year_before = $year - 1;
- $year_after = $year + 1;
- $jump_one = form_submit($year_before) . form_hidden('year', $year_before) . $hidden;
- $jump_two = form_submit($year_after) . form_hidden('year', $year_after) . $hidden;
- $jump_date = form_date('date', '', '', '', '', $date, array('y'));
- } elseif ($_REQUEST['do'] == 'daily' OR ($_REQUEST['do'] == 'weekly' AND $_REQUEST['type'] == 'calendar')) {
- $date_before = date("Y-m-d", strtotime("$date -1 day"));
- $date_b = explode('-', $date_before);
- $date_after = date("Y-m-d", strtotime("$date +1 day"));
- $date_a = explode('-', $date_after);
- if ($_REQUEST['do'] == 'weekly') {
- if (!$week) {
- $week = week_number("$year-$month-$day");
- }
- if ($week == 1) {
- $last_year_weeks = (int)strftime('%W',strtotime("Dec 31 " . ($year-1)));
- $jump_one = form_submit("Week $last_year_weeks, " . ($year - 1)) .
- $hidden . form_hidden('year', $year - 1) . form_hidden('week',
- $last_year_weeks);
- } else {
- $jump_one = form_submit("Week " . ($week - 1) . ", $year") .
- $hidden . form_hidden('year', $year) . form_hidden('week', $week - 1);
- }
- $nextweekdate = start_of_week($week + 1, $year);
- $nextweeknum = (int)week_number(date('Y-m-d', $nextweekdate));
- $weeks = (int)strftime('%W',strtotime("Dec 31 $year"));
- if ($nextweeknum >= $weeks) {
- $jump_two = form_submit("Week 1, " . ($year + 1)) . $hidden .
- form_hidden('year', $year+1) . form_hidden('week', 1);
- } else {
- $jump_two = form_submit("Week " . ($week + 1) . ", $year") .
- $hidden . form_hidden('year', $year) . form_hidden('week', $week + 1);
- }
- $jump_date .= " Week " .
- form_select('week', range(1, $weeks), '', $week, 1) .
- form_date_year('year', $year);
- } else {
- $jump_one = form_submit(format_date($date_before)) . $hidden .
- form_hidden('month', $date_b[1]) .
- form_hidden('year', $date_b[0]) .
- form_hidden('day', $date_b[2]);
-
- $jump_two = form_submit(format_date($date_after)) . $hidden .
- form_hidden('month', $date_a[1]) .
- form_hidden('year', $date_a[0]) .
- form_hidden('day', $date_a[2]);
- $jump_date = form_date('date', '', '', '', '', $date);
- }
- } elseif ($_REQUEST['do'] == 'weekly' && $_REQUEST['type'] == 'list') {
- if (!$week) {
- $week = week_number("$year-$month-$day");
- }
- if ($week == 1) {
- $last_year_weeks = (int)strftime('%W',strtotime("Dec 31 " . ($year-1)));
- $jump_one = form_submit("Week $last_year_weeks, " . ($year - 1)) .
- $hidden . form_hidden('year', $year - 1) . form_hidden('week',
- $last_year_weeks);
- } else {
- $jump_one = form_submit("Week " . ($week - 1) . ", $year") . $hidden .
- form_hidden('year', $year) . form_hidden('week', $week - 1);
- }
- $nextweekdate = start_of_week($week + 1, $year);
- $nextweeknum = (int)week_number(date('Y-m-d', $nextweekdate));
- $weeks = (int)strftime('%W',strtotime("Dec 31 $year"));
- if ($nextweeknum >= $weeks) {
- $jump_two = form_submit("Week 1, " . ($year + 1)) . $hidden .
- form_hidden('year', $year+1) . form_hidden('week', 1);
- } else {
- $jump_two = form_submit("Week " . ($week + 1) . ", $year") . $hidden .
- form_hidden('year', $year) . form_hidden('week', $week + 1);
- }
- $jump_date = "Week " . form_select('week', range(1, $weeks), '', $week, 1) .
- ' ' . form_date_year('year', $year);
- } elseif ($_REQUEST['do'] == 'monthly') {
- if ($month == 1) {
- $month_before = 12;
- $month_after = 2;
- $year_before = $year - 1;
- $year_after = $year;
- } elseif ($month == 12) {
- $month_before = 11;
- $month_after = 1;
- $year_before = $year;
- $year_after = $year + 1;
- } else {
- $month_before = $month - 1;
- $month_after = $month + 1;
- $year_before = $year;
- $year_after = $year;
- }
- $jump_one = form_submit(month_name($month_before)) . $hidden .
- form_hidden('month', $month_before) . form_hidden('year', $year_before);
- $jump_two = form_submit(month_name($month_after)) . $hidden .
- form_hidden('month', $month_after) . form_hidden('year', $year_after);
- $jump_date = form_date('date', '', '', '', '', $date, array('m', 'y'));
- }
- $nav = "<table width="100%"><form><tr>
- <form method="post" action="index.php"><td>$jump_one</td></form>
- <form method="post" action="index.php">$hidden<td align="center">$jump_date" . form_submit('Go') . "</td></form>
- <form method="post" action="index.php"><td align="right">$jump_two</td></form>
- </tr></table>
- ";
- // Echo the page navigation header
- $tw_both_nav_off="<a href="index.php?do=$_REQUEST[do]&type=$_REQUEST[type]&watch=0&year=$_REQUEST[year]&month=$_REQUEST[month]&day=$_REQUEST[day]&overdue=$_REQUEST[overdue]">Both</a>";
- $tw_watc_nav_off="<a href="index.php?do=$_REQUEST[do]&type=$_REQUEST[type]&watch=1&year=$_REQUEST[year]&month=$_REQUEST[month]&day=$_REQUEST[day]&overdue=$_REQUEST[overdue]">Ticket Watches</a>";
- $tw_norm_nav_off="<a href="index.php?do=$_REQUEST[do]&type=$_REQUEST[type]&watch=2&year=$_REQUEST[year]&month=$_REQUEST[month]&day=$_REQUEST[day]&overdue=$_REQUEST[overdue]">Normal Events</a>";
- $tw_both_nav_on="[Both]";
- $tw_watc_nav_on="[Ticket Watches]";
- $tw_norm_nav_on="[Normal Events]";
- switch ($_REQUEST['watch']) {
- default:
- case '0':
- $ticketwatch_nav = "$tw_both_nav_on $tw_watc_nav_off $tw_norm_nav_off";
- $watch = 0;
- break;
- case '1':
- $ticketwatch_nav = "$tw_both_nav_off $tw_watc_nav_on $tw_norm_nav_off";
- $watch = 1;
- break;
- case '2':
- $ticketwatch_nav = "$tw_both_nav_off $tw_watc_nav_off $tw_norm_nav_on";
- $watch = 2;
- break;
- }
- if (!$_REQUEST['overdue']) {
- $overdue = get_tasks(1);
- if ($overdue == 1) {
- $overdues = "<a href="index.php?do=daily&type=list&overdue=1" . iff($_REQUEST['search'], $search_url . "&search=$_REQUEST[search]&taskid=$_REQUEST[taskid]") . ""><FONT COLOR="red">1 overdue item</font></a>";
- } elseif ($overdue > 1) {
- $overdues = "<a href="index.php?do=daily&type=list&overdue=1" . iff($_REQUEST['search'], $search_url . "&search=$_REQUEST[search]&taskid=$_REQUEST[taskid]") . ""><FONT COLOR="red">$overdue overdue items</font></a>";
- }
- }
- echo "
- <table><tr><td valign="top" width="100%">
- <table width="440" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="5" bgcolor="#BF4343"> </td>
-
- <td width="435">
- <table width="435" border="0" cellspacing="1" cellpadding="0">
- <tr>
- <td width="90" height="20" class="calendar1">" . html_image('tech/bul089.gif', 'Calendar', 0, 0, 'hspace="5"') . "<strong>Calendar</strong></td>
- <td width="42" align="center" class="calendar1">" .
- iff($_REQUEST['do'] == 'daily' AND $_REQUEST['type'] == 'calendar', '<strong>Day</strong>', "<a href="index.php?do=daily&type=calendar&watch=$watch&$year=year&month=$month&day=$day" class="calendar1">Day</a>") . "</td>
- <td width="43" align="center" class="calendar1">" .
- iff($_REQUEST['do'] == 'weekly' AND $_REQUEST['type'] == 'calendar', '<strong>Week</strong>', "<a href="index.php?do=weekly&type=calendar&watch=$watch&year=$year&month=$month&day=$day" class="calendar1">Week") . "</td></td>
- <td width="51" align="center" class="calendar1">" .
- iff($_REQUEST['do'] == 'monthly' AND $_REQUEST['type'] == 'calendar', '<strong>Month</strong>', "<a href="index.php?do=monthly&type=calendar&watch=$watch&year=$year&month=$month&day=$day" class="calendar1">Month</a>") . "</td>
- <td width="43" align="center" class="calendar1">" .
- iff($_REQUEST['do'] == 'yearly' AND $_REQUEST['type'] == 'calendar', '<strong>Year</strong>', "<a href="index.php?do=yearly&type=calendar&watch=$watch&year=$year&month=$month&day=$day" class="calendar1">Year</a>") . "</td>
- <td width="75" align="center" class="calendar1"> </td>
- <td width="82" align="center" class="calendar1">" . iff(($its_today AND $_REQUEST['type'] == 'calendar'), "Today ($taskstoday)", "<a href="index.php?do=daily&type=calendar&watch=$watch&year=$today_y&month=$today_m&day=$today_d" class="calendar1">Today ($taskstoday)</a>") . "</td>
- </tr>
- <tr>
- <td colspan="7"><img src="../../images/spacer.gif" width="5" height="5"></td>
- </tr>
- <tr>
- <td height="20" bgcolor="#DADADA">" . html_image('tech/bul090.gif', 'Tasks', 0, 0, 'hspace="5"') . "Tasks</td>
- <td align="center" bgcolor="#DADADA">" .
- iff($_REQUEST['do'] == 'daily' AND $_REQUEST['type'] == 'list', '<strong>Day</strong>', "<a href="index.php?do=daily&type=list&watch=$watch&year=$year&month=$month&day=$day">Day</a>") . "</td>
- <td align="center" bgcolor="#DADADA">" .
- iff($_REQUEST['do'] == 'weekly' AND $_REQUEST['type'] == 'list', '<strong>Week</strong>', "<a href="index.php?do=weekly&type=list&watch=$watch&year=$year&month=$month&day=$day">Week</a>") . "</td>
- <td align="center" bgcolor="#DADADA">" .
- iff($_REQUEST['do'] == 'monthly' AND $_REQUEST['type'] == 'list', '<strong>Month</strong>', "<a href="index.php?do=monthly&type=list&watch=$watch&year=$year&month=$month&day=$day">Month</a>") . "</td>
- <td align="center" bgcolor="#DADADA">" .
- iff($_REQUEST['do'] == 'yearly' AND $_REQUEST['type'] == 'list', '<strong>Year</strong>', "<a href="index.php?do=yearly&type=list&watch=$watch&year=$year&month=$month&day=$day">Year</a>") . "</td>
- <td align="center" bgcolor="#DADADA"> </td>
- <td align="center" bgcolor="#DADADA">" . iff(($its_today AND $_REQUEST['type'] == 'list'), "Today ($taskstoday)", "<a href="index.php?do=daily&type=list&watch=$watch&year=$today_y&month=$today_m&day=$today_d" >Today ($taskstoday)</a>") . "</td>
- </tr>
- <tr>
- <td colspan="7"><img src="../../images/spacer.gif" width="5" height="5"></td>
- </tr>
- <tr>
- <td colspan="7" align="center">
- $nav
- </td>
- </tr>
- </table>
- <b>Event type(s) to display:</b> $ticketwatch_nav
- <center>$overdues</center>
- </td></tr></table>";
- // Show the search form.
- if ($_REQUEST['yenddate'] && $_REQUEST['menddate'] && $_REQUEST['denddate']) {
- $ed = $_REQUEST['yenddate'].'-'.$_REQUEST['menddate'].'-'.$_REQUEST['denddate'];
- } else {
- $ed = $date;
- }
- if ($_REQUEST['ystartdate'] && $_REQUEST['mstartdate'] && $_REQUEST['dstartdate']) {
- $sd = $_REQUEST['ystartdate'].'-'.$_REQUEST['mstartdate'].'-'.$_REQUEST['dstartdate'];
- } else {
- $sd = '';
- }
- switch ($_REQUEST['completed']) {
- case 'all':
- $all = 'checked'; break;
- case 'complete':
- $complete = 'checked'; break;
- case 'incomplete':
- $incomplete = 'checked'; break;
- }
- if ($search) {
- if (is_array($_REQUEST['techs'])) {
- $techs = join("|", $_REQUEST['techs']);
- } else {
- $techs = '';
- }
- $search_url = 'title=' . htmlspecialchars_uni($_REQUEST['title']) .
- '&description=' . htmlspecialchars_uni($_REQUEST['description']) .
- "&ystartdate=$_REQUEST[ystartdate]".
- "&mstartdate=$_REQUEST[mstartdate]".
- "&dstartdate=$_REQUEST[dstartdate]".
- "¥ddate=$_REQUEST[yenddate]".
- "&menddate=$_REQUEST[menddate]".
- "&denddate=$_REQUEST[denddate]".
- "&completed=$_REQUEST[completed]".
- "&techs=$techs";
-
- $midbox = "<B>Viewing Search Results</B> <BR><A HREF="search.php?$search_url">Edit Search</A> <A HREF="search.php">Start a New Search</A> <BR><BR>$midbox";
-
- echo "<br /><center>$midbox</center>";
- }
- echo "</td><td align="right" valign="top">";
- $task_table = "<table><form method="post" action="index.php">
- <tr><td>" .
- form_input('title', 'Title ...', 20, '', '', "onfocus="this.value='';"") .
- " <a href="new.php">Advanced Options</a></td></tr><tr><td>" .
- form_textarea('description', 40, 4, 'Message ...', '', '', "onfocus="this.value='';"") .
- "</td></tr><tr><td>" .
- $hidden .
- form_hidden('addentry', 1) .
- form_hidden('month', $month) .
- form_hidden('year', $year) .
- form_hidden('day', $day) .
- form_date('date', '', '', '', '', $date) .
- form_submit('Add') .
- " " . thelp('Calendar', 'Quick Add Task') .
- "</td></tr></form></table>";
- fancy_table('100%', "Add a Quick Task", $task_table);
- echo "</td></tr></table>";
- #####################################################################################
- ########################### GET CACHED DATA FOR DATE RANGE ##############################
- #####################################################################################
- ########################### MONTHLY VIEW ##############################
- if ($_REQUEST['do'] == "monthly" AND $_REQUEST['type'] == "list") {
- if ($search) {
- if (!validate_ymd($startdate)) {
- $startdate = '1970-01-01';
- }
- if (!validate_ymd($enddate)) {
- $enddate = date('2038-01-19');
- }
- if ($search == 'upcoming') {
- $data = cachetasks($startdate, $enddate, 1, NULL, NULL, NULL, NULL, $watch);
- } else {
- $data = cachetasks($startdate, $enddate, $_REQUEST['completed'],
- $_REQUEST['title'], $_REQUEST['description'], $_REQUEST['taskid'],
- $_REQUEST['techs'], $watch);
- }
- } else {
- $enddate = date('Y-m-d', strtotime(date('Y-m-d', strtotime("$year-$month-01 +1 month")) . " -1 days"));
- $enddate_tmp = explode('-', $enddate);
- $data = cachetasks($year . '-' . $month . '-1', $year . '-' . $month .
- $enddate_tmp[2], NULL, NULL, NULL, NULL, NULL, $watch);
- }
- ############################## WEEKLY ############################
- } elseif ($_REQUEST['do'] == "weekly") {
- if ($week) {
- $weeknum = $week;
- } else {
- $weeknum = week_number("$year-$month-$day");
- }
- $startdate = start_of_week($weeknum, $year);
- $dayofweek = day_of_week(date("Y-m-d", $startdate));
- if ($user['weekstart'] < 7) {
- $startdate = strtotime(date('Y-m-d', $startdate) . " +$user[weekstart] days");
- }
- if ($user['weekstart'] == 7) {
- $startday = 0 ;
- } else {
- $startday = $user['weekstart'] - 1;
- }
- if ($dayofweek < $startday) {
- $offset = $startday - $dayofweek;
- $startdate = strtotime(date('Y-m-d', $startdate) . " -$offset days");
- } elseif ($dayofweek > $startday) {
- $offset = $dayofweek - $startday;
- $startdate = strtotime(date('Y-m-d', $startdate) . " +$offset days");
- }
- $enddate = strtotime(date('Y-m-d', $startdate) . " +6 days");
- $data = cachetasks(date('Y-m-d', $startdate), date('Y-m-d', $enddate), NULL, NULL, NULL, NULL, NULL, $watch);
- ############################ YEARLY VIEW ############################
- } elseif ($_REQUEST['do'] == "yearly") {
- $startdate = "$year-01-01"; $enddate = "$year-12-31";
- $data = cachetasks($startdate, $enddate, NULL, NULL, NULL, NULL, NULL, $watch);
- ############################ DAILY VIEW ############################
- } elseif ($_REQUEST['do'] == "daily") {
- $startdate = $date; $enddate = $date;
- $data = cachetasks($startdate, $enddate, NULL, NULL, NULL, NULL, NULL, $watch);
- echo "<br /><table width="100%"><tr><td valign="top">";
- }
- ##################################################################################
- for ($i = 0; $i < 24; $i++) {
- $end_table[$i] = array();
- }
- // We'll use the user's "ticket_number" setting for number of items to show per page.
- if ($settings['ticket_number']) {
- $perpage = $settings['ticket_number'];
- } else {
- $perpage = 20;
- }
- // We start on page 1 unless the user navigation has specified otherwise
- if (isset($_REQUEST['page'])) {
- $page = $_REQUEST['page'];
- } else {
- $page = 1;
- }
- $thispage = 0; $curpage = 1;
- ##################################################################################
- ################################ SHOW LIST VIEW ###################################
- ##################################################################################
- $startdate_ts = iff(is_int($startdate), $startdate, strtotime($startdate));
- $enddate_ts = iff(is_int($enddate), $enddate, strtotime($enddate));
- // Assemble the daily list view data.
- if ($_REQUEST['type'] == "list") {
- if (is_array($data)) {
- foreach ($data AS $key => $var) {
- if (!$_REQUEST['overdue'] AND (!$_REQUEST['search']) AND (!((strtotime($key) >= $startdate_ts) AND (strtotime($key) <= $enddate_ts)))) {
- continue;
- }
- if (is_array($var)) {
- foreach ($var AS $key2 => $var2) {
- $skip = 0;
- if (!$var2[0]) {
- break;
- }
-
- $var2[1] = trimstring($var2[1], 30, 1);
- $var2[2] = trimstring($var2[2], 15, 1);
- $time = explode(':', $var2[4]);
- if ($var2[4] != "00:00:00") {
- if ($_REQUEST['overdue']) {
- $printtime = format_date($var2[3], 'day') . '<br />' . time_ampm($var2[4], 1);
- } else {
- $printtime = time_ampm($var2[4], 1);
- }
- $showtime = 1;
- } else {
- if ($_REQUEST['overdue']) {
- $printtime = format_date($var2[3], 'day') . '<br /><I>No time specified</I>';
- } else {
- $printtime = '<I>No time specified</I>';
- }
- $time[0] = NULL;
- $time[1] = NULL;
- $time[2] = NULL;
- }
- $tmp_today = strtotime($today);
- if ($tmp_last != $var2[3] OR (!$var2[3]) OR (!$have_drawn_mid)) {
- $tmp_last = $var2[3];
- if ($_REQUEST['do'] != 'daily') {
- $draw_mid = 1;
- }
- } else {
- $draw_mid = 0;
- }
- $tmp_item = strtotime($var2[3]);
- if (($tmp_today > $tmp_item) AND !$var2[5]) {
- // The item is overdue and not completed
- if ($_REQUEST['overdue'] != NULL) {
- // If we're showing overdue items, show it, otherwise, skip it
- $item_color = "red";
- } else {
- if (!(strtotime("$year-$month-$day" == $tmp_item))) {
- $skip = 1;
- $overdue++;
- } else {
- $item_color = "red";
- }
- }
- } else {
- // The item isn't overdue or it's in the past but finished
- if ($_REQUEST['overdue']) {
- $normal++;
- $skip = 1;
- } else {
- $item_color = "black";
- }
- }
-
- if ($tmp_today == $tmp_item) {
- $printdate = 'Today';
- } else {
- $printdate = explode('-', $var2[3]);
- $printdate = format_date($var2[3]) . " $printdate[0]";
- $printdate = str_replace(' ', ' ', $printdate);
- if ($var2[6]) {
- $printtime = $printtime . '*';
- }
- }
- if ($var2[5]) {
- $this_completed = 1;
- $var2[1] = "[$var2[1]]";
- $var2[2] = "[$var2[2]]";
- $var2[5] = "Yes";
- } else {
- $var2[5] = "No";
- $this_completed = 0;
- }
-
- if ($var2[8]) {
- // If this is someone else's ticket, italicize it
- $var2[1] = "<I>$var2[1]</I>";
- $var2[2] = "<I>$var2[2]</I>";
- }
- if($var2[7]) {
- // If this is a ticket reminder, link to the ticket
- if (!$skip) {
- if ($_REQUEST['do'] == 'daily') {
- $ticket_rows[] = array(
- form_checkbox_single("$var2[0]|$var2[3]|1", 1, '', 'ids'),
- "$printdate",
- "<B>$var2[1]</B>",
- "$var2[5]",
- "<a href="../tickets/ticketview.php?id=$var2[0]">Ticket #$var2[0]</a>"
- );
- $table_row = NULL;
- } else {
- $table_row = array(
- form_checkbox_single("$var2[0]|$var2[3]|1", 1, '', 'ids'),
- "$printdate",
- "<B>$var2[1]</B>",
- "$var2[5]",
- "<a href="../tickets/ticketview.php?id=$var2[0]">Ticket #$var2[0]</a>"
- );
- }
- }
- } else {
- // Otherwise, show view and edit links
- if ($var2[10] == $user['id']) {
- $editlink = "<A HREF="edit.php?id=$var2[0]">Edit</A>";
- } else {
- $editlink = NULL;
- }
- $table_row = array(
- form_checkbox_single("$var2[0]|$var2[3]", 1, '', 'ids'),
- "$printtime",
- "<B>$var2[1]</B>: $var2[2]",
- "$var2[5]",
- "<a href="viewtask.php?id=$var2[0]&date=$var2[3]">View</a> $editlink"
- );
- }
- if (!$skip) {
- $thispage++;
- $completed_items += $this_completed;
- if ($_REQUEST['type'] == 'list') {
- // If we're generating a list, also handle pagination
- if ($thispage > $perpage) {
- $thispage = 1;
- $curpage++;
- }
- // Are we on the desired page?
- if ($curpage != $page) {
- // Nope, wrong page, skip
- $skip = 1;
- } else {
- $skip = 0;
- }
- $count++;
- } else {
- $count++;
- }
- }
- if ((!$skip) AND is_array($table_row)) {
- if ($_REQUEST['do'] == 'daily') {
- if ($time[0] != NULL) {
- if ($draw_mid) {
- $end_table[(int)$time[0]][] = table_midheader($printdate);
- $have_drawn_mid = 1;
- }
- $end_table[(int)$time[0]][] = $table_row;
- } else {
- if ($draw_mid) {
- $notime_table[] = table_midheader($printdate);
- $have_drawn_mid = 1;
- }
- $notime_table[] = $table_row;
- }
- } else {
- if ($draw_mid) {
- $lead_table[] = table_midheader($printdate);
- $have_drawn_mid = 1;
- }
- $lead_table[] = $table_row;
- }
- }
- }
- }
- }
- }
-
- $tmp_table = array();
- for ($i = 0; $i < 8; $i++) {
- foreach ($end_table[$i] as $key => $var) {
- $tmp_table[] = $var;
- }
- }
- if (count($tmp_table)) {
- if ($_REQUEST['type'] == 'calendar' AND $showtime) {
- $lead_table[] = array('<B><U>12pm - 7am</U></B>');
- }
- foreach($tmp_table AS $val) {
- $lead_table[] = $val;
- }
- $tmp_table = array();
- }
- for ($i = 8; $i < 19; $i++) {
- foreach ($end_table[$i] as $key => $var) {
- $tmp_table[] = $var;
- }
- if (count($tmp_table)) {
- if ($_REQUEST['type'] == 'calendar') {
- $lead_table[] = array('<B><U>'. time_ampm("$i:00:00", 2) . "</U></B>");
- }
- foreach($tmp_table AS $val) {
- $lead_table[] = $val;
- }
- $tmp_table = array();
- }
- }
- for ($i = 19; $i < 24; $i++) {
- foreach ($end_table[$i] as $key => $var) {
- $tmp_table[] = $var;
- }
- }
- if (count($tmp_table)) {
- if ($_REQUEST['type'] == 'calendar') {
- $lead_table[] = array('<B><U>7pm - 12pm</U></B>');
- }
- foreach($tmp_table AS $val) {
- $lead_table[] = $val;
- }
- }
- // Now add the non-timed events
- if (is_array($notime_table)) {
- if ($_REQUEST['type'] == 'calendar') {
- $lead_table[] = array('<B><U>Untimed Events</U></B>');
- }
- foreach ($notime_table AS $val) {
- $lead_table[] = $val;
- }
- }
- $table = $lead_table;
- $form = form_select('action', array(0 => 'Toggle Complete', 1 => 'Delete', 2 => 'Stop Repeating'));
- $form .= form_hidden('do', $_REQUEST['do']) . form_hidden('type', $_REQUEST['type']);
- $form .= form_hidden('year', $year) . form_hidden('month', $month) . form_hidden('day', $day);
- $form .= form_hidden('watch', $watch) . form_hidden('week', $week) . form_hidden('overdue', $_REQUEST['overdue']);
- $form .= "<input type="submit" name="Process" value="Process">n";
- if ($_REQUEST['search']) {
- $form .= form_hidden('search', htmlspecialchars($_REQUEST['search']));
- $form .= form_hidden('title', htmlspecialchars($_REQUEST['title']));
- $form .= form_hidden('description', htmlspecialchars($_REQUEST['description']));
- $form .= form_hidden('completed', htmlspecialchars($_REQUEST['completed']));
- $form .= form_hidden('ystartdate', htmlspecialchars($_REQUEST['ystartdate']));
- $form .= form_hidden('mstartdate', htmlspecialchars($_REQUEST['mstartdate']));
- $form .= form_hidden('dstartdate', htmlspecialchars($_REQUEST['dstartdate']));
- $form .= form_hidden('yenddate', htmlspecialchars($_REQUEST['yenddate']));
- $form .= form_hidden('menddate', htmlspecialchars($_REQUEST['menddate']));
- $form .= form_hidden('denddate', htmlspecialchars($_REQUEST['denddate']));
- if (is_array($_REQUEST['techs'])) {
- $form .= form_hidden('techs', join('|', $_REQUEST['techs']));
- } else {
- $form .= form_hidden('techs', '');
- }
- $form .= form_hidden('taskid', $_REQUEST['taskid']);
- }
- $width = array("5%",'10%',"10%","20%","5%");
- $cols = array('<input type="checkbox" name="allbox" onclick="checkall(this.form);" />', 'When', 'Item', 'Complete', 'Options');
- echo "<form method="post" action="index.php" name="tasks" id="tasks">";
- table_header('Your Tasks');
- table_content($cols, $table, '', '', '', '', $width);
- table_footer('', 'Left', $form);
-
- $form2 = form_select('action', array(0 => 'Toggle Complete', 1 => 'Delete', 2 => 'Stop Repeating'));
- $form2 .= "<input type="submit" name="Process" value="Process">n";
- $cols = array('<input type="checkbox" name="allbox2" onclick="checkall(this.form);" />', 'When', 'Item', 'Complete', 'Options');
- if (is_array($ticket_rows)) {
- table_header('Your Ticket Reminders');
- table_content($cols, $ticket_rows, '', '', '', '', $width);
- table_footer('', 'Left', $form2);
- }
- // key
- ?>
-
- <table cellpadding="2">
- <tr><td colspan="2" align="center"><b><u>Key</u></b></td></tr>
- <tr><td>* Repeating task</b></td><td>* on left of entry</td></tr>
- <tr><td><b>Normal tasks</b></td><td>Entries in bold</td></tr>
- <tr><td><i>Tasks assigned to other technician(s)</i></td><td>Entries in italics</td></tr>
- <tr><td>[Completed Tasks]</td><td>Entries enclosed in []</td></tr>
- </table>
- <br />
- Note: Deleting a repeat item will delete <I>all</I> occurrences of that item! To change the repeating date(s) of an item, select "Edit" instead.
- <br />
- <?php
-
- if (count($table) AND ($count > $perpage)) {
- echo form_hidden('overdue', $_REQUEST['overdue']);
- echo pagenav($count, $perpage, $page, '', 'tasks', 'select', 'page');
- echo "</FORM>";
- }
- echo "<span id="hiddenbit"></span>";
- }
- ##################################################################################
- ################################ CALENDAR VIEW ###################################
- ##################################################################################
- ######################### DAILY CALENDAR ##############################
- if ($_REQUEST['do'] == "daily" AND $_REQUEST['type'] == "calendar") {
- echo "<table width="100%"><tr><td valign="top" width="80%">";
- $hours = array(
- '0' => 'Untimed',
- '1' => '12pm - 7am',
- '2' => '7am - 8am',
- '3' => '8am - 9am',
- '4' => '9am - 10am',
- '5' => '10am - 11am',
- '6' => '11am - 12am',
- '7' => '12am - 1pm',
- '8' => '1pm - 2pm',
- '9' => '2pm - 3pm',
- '10' => '3pm - 4pm',
- '11' => '4pm - 5pm',
- '12' => '5pm - 6pm',
- '13' => '6pm - 7pm',
- '14' => '7pm - 12pm'
- );
- if (!(is_array($data))) {
- $data = array();
- };
- $todays_date = strtotime(date('Y-m-d'));
- foreach ($data AS $key => $var) {
- // Only show today's entries.
- if ($key == date('Y-m-d', strtotime("$year-$month-$day"))) {
- foreach ($var AS $key2 => $var2) {
- if ((strtotime($var2[3]) < $todays_date) AND !$var2[5]) {
- $overdue = 1;
- } else {
- $overdue = 0;
- }
- if ($var2[7]) {
- $link = "<a href="../tickets/ticketview.php?id=$var2[0]">Ticket #$var2[0]</a>";
- } else {
- if ($var2[10] == $user['id']) {
- $editlink = "(<A HREF="edit.php?id=$var2[0]">Edit</A>)";
- } else {
- $editlink = NULL;
- }
-
- $link = "<a href="viewtask.php?id=$var2[0]&date=$var2[3]"><B>$var2[1]</B>: $var2[2]</a> $editlink";
- }
- if ($overdue) {
- $link .= " <font color="red"><B>Overdue</B></font>";
- }
- $time = explode(':', $var2[4]);
- if ($time[0] == '00' AND $time[1] == '00' AND $time[2] == '00') {
- $hours_data[0] .= $link . "<br />";
- $hours_count[0]++;
- } else {
- switch($time[0]) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- $hours_data[1] .= $link . "<br />";
- $hours_count[1]++;
- break;
- case 7:
- $hours_data[2] .= $link . "<br />";
- $hours_count[2]++;
- break;
- case 8:
- $hours_data[3] .= $link . "<br />";
- $hours_count[3]++;
- break;
- case 9:
- $hours_data[4] .= $link . "<br />";
- $hours_count[4]++;
- break;
- case 10:
- $hours_data[5] .= $link . "<br />";
- $hours_count[5]++;
- break;
- case 10:
- $hours_data[5] .= $link . "<br />";
- $hours_count[5]++;
- break;
- case 11:
- $hours_data[6] .= $link . "<br />";
- $hours_count[6]++;
- break;
- case 12:
- $hours_data[7] .= $link . "<br />";
- $hours_count[7]++;
- break;
- case 13:
- $hours_data[8] .= $link . "<br />";
- $hours_count[8]++;
- break;
- case 14:
- $hours_data[9] .= $link . "<br />";
- $hours_count[9]++;
- break;
- case 15:
- $hours_data[10] .= $link . "<br />";
- $hours_count[10]++;
- break;
- case 16:
- $hours_data[11] .= $link . "<br />";
- $hours_count[11]++;
- break;
- case 17:
- $hours_data[12] .= $link . "<br />";
- $hours_count[12]++;
- break;
- case 18:
- $hours_data[13] .= $link . "<br />";
- $hours_count[13]++;
- break;
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- $hours_data[14] .= $link . "<br />";
- $hours_count[14]++;
- break;
- }
- }
- }
- }
- }
- foreach ($hours AS $key => $var) {
- $html = "<table cellpadding="8" cellspacing="0">
- <tr><td valign="top"><b><u>$var</u></b>";
- if ($hours_count[$key]) {
- if ($hours_count[$key] == 1) {
- $items = "item";
- } else {
- $items = "items";
- }
- $html .= "<font color="green"><b> - {$hours_count[$key]} $items:</b></font>";
- }
- $html .= "</td></tr>
- <tr><td>{$hours_data[$key]}</td></tr></table>";
- $content[] = $html;
- unset($html);
- unset($task_counts);
- unset($items);
- }
- echo table_list("Tasks for Today", $content, '100%', 1);
-
- echo "<td width="30"> </td><td valign="top" width="160" align="right">";
- $m_start = explode('-', date('Y-m-d', strtotime("$year-$month-01 -1 month")));
- $m_end = explode('-', date('Y-m-d', strtotime("$year-$month-01 +1 month")));
- $data = cachetasks(
- "$m_start[0]-$m_start[1]-$m_start[2]",
- "$m_end[0]-$m_end[1]-$m_end[2]",
- NULL, NULL, NULL, NULL, NULL, $watch);
- if (!$data) {
- $data = array();
- };
- echo make_month($m_start[1], $m_start[0], NULL);
- echo "<BR><BR>";
- echo make_month($month, $year, NULL);
- echo "<BR><BR>";
- echo make_month($m_end[1], $m_end[0], NULL);
- echo "</td></tr></table>";
- }
- ############################ MONTHLY CALENDAR #########################
- if ($_REQUEST['do'] == "monthly" AND $_REQUEST['type'] == "calendar") {
-
- echo make_month($month, $year, '', '', 1);
- }
- ########################## WEEKLY CALENDAR #############################
- if ($_REQUEST['do'] == "weekly" AND $_REQUEST['type'] == "calendar") {
- $daynum = day_of_week(date('Y-m-d', $startdate));
- for ($curdate = $startdate; $curdate <= $enddate; $curdate = strtotime(date('Y-m-d', $curdate) . " +1 day")) {
- $caldate = explode('-', date('Y-m-d', $curdate));
- $cal_date = format_date(date('Y-m-d', $curdate));
- if (($caldate[0] == $today_y) &&
- ($caldate[1] == $today_m) &&
- ($caldate[2] == $today_d)) {
- $cal_date = "$cal_date";
- }
- $target = "$caldate[0]-" . sprintf("%02d-", $caldate[1]) . sprintf("%02d", $caldate[2]);
- if (isset($data[$target])) {
- foreach ($data[$target] as $task) {
- $task_counts++;
- if (strlen($task[1]) > 30) {
- $task[1] = substr($task[1], 0, 30) . "...";
- }
- if ($task[4] != "00:00:00") {
- $task[4] = '[' . time_ampm($task[4]) . ']';
- } else {
- $task[4] = "";
- }
- $items .= "$task[4] $task[1]<BR>n";
- }
- }
- if ($task_counts) {
- if ($task_counts > 1) {
- $task_counts = "$task_counts tasks:";
- } else {
- $task_counts = "$task_counts task:";
- }
- } else {
- $task_counts = "";
- }
- $daynum = day_of_week("$caldate[0]-$caldate[1]-$caldate[2]");
- if (!$daynum) {
- $class = "normalCellalt1";
- } else {
- $class = "normalCellalt2";
- }
- $dayname = weekday_name($daynum);
-
- $html = "<table cellpadding="8" cellspacing="0">
- <tr><td><a href="index.php?do=daily&type=calendar&year=$caldate[0]&month=$caldate[1]&day=$caldate[2]&watch=$watch"><b>$dayname, $cal_date</a></b>";
- if ($task_counts) {
- $html .= "<font color="green"><b> - $task_counts</b></font>";
- }
- $html .= "</td></tr>
- <tr><td>$items</td></tr></table>";
- $content[] = $html;
- unset($html);
- unset($task_counts);
- unset($items);
- }
- echo table_list("Tasks for this Week", $content, '100%', 1);
- }
- ############################### YEARLY CALENDAR ###############################
- if ($_REQUEST['do'] == "yearly" AND $_REQUEST['type'] == "calendar") {
- echo "<table width="100%" align="center"><tr><td valign="top" align="center">";
- echo make_month(1, $year, $data, $watch);
- echo "</td><td align="center" valign="top">";
- echo make_month(2, $year, $data, $watch);
- echo "</td><td align="center" valign="top">";
- echo make_month(3, $year, $data, $watch);
- echo "</td><td valign="top" align="center">";
- echo "</td></tr><tr><td align="center" valign="top"><BR><BR>";
- echo make_month(4, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(5, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(6, $year, $data, $watch);
- echo "</td></tr><tr><td align="center" valign="top"><BR><BR>";
- echo make_month(7, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(8, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(9, $year, $data, $watch);
- echo "</td></tr><tr><td align="center" valign="top"><BR><BR>";
- echo make_month(10, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(11, $year, $data, $watch);
- echo "</td><td align="center" valign="top"><BR><BR>";
- echo make_month(12, $year, $data, $watch);
- echo "</td></tr></table>";
- }
- tech_footer();
- /*
- // _______________________________________________________________
- // Options:
- //
- // do Specify action or the view duration
- // added Flash a "task added" message then display
- // a monthly calendar
- // daily Show events for the given day.
- // weekly Show events for the given week.
- // monthly Show events for the given month.
- // yearly Show events for the given year.
- // type Specify the view type
- // list Just list events
- // calendar Display specified period as a calendar.
- // watch Specifies whether to include ticket watch items
- // 0 Show all events
- // 1 Show only ticket watches
- // 2 Show only normal events
- // year, month, day
- // Specifies the date to start viewing items from (all views).
- // addentry If non-zero, add a new entry.
- // ydate, mdate, ddate, title, description
- // Specifies data for entry to add.
- // search If non-zero, perform a search.
- // upcoming Search for all unfinished tasks.
- // [non-zero] Search for specified tasks.
- // completed Specify whether to search for complete or incomplete items
- // all Search for all items (default)
- // complete Search for completed items
- // incomplete Search for unfinished items
- // ystartdate, mstartdate, dstartdate
- // yenddate, menddate, denddate
- // Specifies starting and ending dates for event search
- // (inclusive)
- // Process If non-zero, process one or more events (toggle or delete)
- // action If specified, either delete the item(s) entirely or stop
- // repeating. If not specified, toggle the item(s) complete
- // status.
- // ids An array of selected items, specifying entry ID, due date of
- // the selected event (sometimes a repeating event instance),
- // and the optional type. Example: 134|2003-11-23|2
- // If the trailing |2 is included, the event is a ticket watch,
- // not a normal calendar event.
- // 2 Stop the item(s) repeating, set due date to today.
- // [non-zero] Delete the task entirely.
- // overdue Specify whether to display overdue items
- // 0 Do not show overdue items
- // 1 Show only overdue items
- // taskid Show only repeating events whose parent is the specified ID
- // techs Search for tasks created by specific techs
- // page Specify current page number for long lists
- */
- ?>