📄 index.php
字号:
<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
*/
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -