Location: PHPKode > projects > O - OpenSource GroupWare > osgw/tasklist/home.php
<?php
/**************************************************************************
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
/*$Id: home.php,v 1.16 2003/12/10 20:42:29 rthomp Exp $*/
require('tasklist/class.tasklist.php');
$tasks = new tasklist;
?>
<table width="100%" cellspacing="0">
<tr>
<td>
<h2 class="home_header">
	<?php echo $O->create_link("/tasklist", $lang->get_msg('service_name','tl'), 'home_header')?>
</h2>
</td>
</tr>
<?php
$prefs = $user->get_all_prefs('tl', $user->user_id);
$upcoming = time() + (DAY_SEC * 5);
if($prefs['display_overdue'] != 'TRUE')
{
	$time = time();
	$overdue = " AND task_due > '$time'";
}
if($prefs['display_complete'] != 'TRUE')
{
	$complete = ' AND status < 3';	
}
if(isset($prefs['display_days']))
{
	$limit = " LIMIT {$prefs['display_days']}";
}
$sql = "SELECT * FROM o_tasklist 
	WHERE user_id='{$user->user_id}' AND task_due < '$upcoming'$overdue$complete ORDER BY task_due$limit";
$db->query($sql);

while($db->fetch_results())
{
	echo "<tr>";
	$class = $html->list_class($class);
	
	if($db->record['task_due'] < time())
	{
		$tmp = $class;
		$class = 'overdue';
	}
	if($db->record['status'] >= 3)
	{
		$class = 'complete';	
		$style = "background: #348273;";
	}
	
	echo "<td class=\"$class\">";
	echo $O->create_link("/tasklist/view_task.php?tid=". $db->record['task_id'],
		$db->record['subject'], 
		$class, "title=\"Due: ". date($date->long_date, $db->record['task_due']) ."\"", $style);
	
	echo "</td></tr>";	
}

?>
<tr><td style="text-align:right">
<?php echo $O->create_link("/tasklist/create_task.php", $lang->get_msg('add_task', 'tl'), 'menu_link');?>
</td></tr>
</table>
Return current item: O - OpenSource GroupWare