<?php if (!$orderby) { $orderby = "priority"; } ?>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
 <tr>
  <td>
   <font face="<?php echo $cellfont?>">
   <b><?php echo TwigLink("Group","groups_changeto","postcommand=todo")?></b>:
   <?php echo groupName($thisGroup)?>
   </font>
  </td>
  <td align=center>
   <font face="<?php echo $cellfont?>">
   <?php echo twigLink("add item","todo_edit","action=New")?>
   </font>
  </td>
  <td align=right>
   <font face="<?php echo $cellfont?>">
   <?php echo $monthNames[$todaysMonth]?> <?php echo $todaysDay?>, <?php echo $todaysYear?>
   </font>
  </td>
 </tr>
</table>
<hr>
<table>
<tr>
 <tr>
  <td></td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <b><?php echo twigLink("item","todo","orderby=item")?></b>
   </font>
  </td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <b><?php echo twigLink("group","todo","orderby=groupid")?></b>
   </font>
  </td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <b><?php echo twigLink("priority","todo","orderby=priority")?></b>
   </font>
  </td>
 </tr>
</tr>
<?php 
 $query="SELECT * FROM $dbconfig[todo_table] WHERE ($groupquery) ORDER BY completed, $orderby";
 $result=dbQuery($query);
 for($i=0; $i<dbNumRows($result); $i++) {
  $data=dbResultArray($result,$i);
  if (!$data[item]) { $data[item] = "[none]"; }
?>
 <tr>
  <td valign=top>
   <?php if ($data[completed]):?>
   <img src=<?php echo $basedir?>/images/read.gif border=0 alt="Done">
   <?php else:?>
   <img src=<?php echo $basedir?>/images/unread.gif border=0 alt="Not Done">
   <?php endif;?>
  </td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <?php echo twigLink($data[item],"todo_edit","action=Edit&thisID=" . $data[id])?>
   </font>
  </td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <?php echo twigLink(groupName($data[groupid]),"todo","thisGroup=$data[groupid]")?>
   </font>
  </td>
  <td bgcolor="<?php echo $cellcolor?>" valign=top>
   <font face="<?php echo $cellfont?>">
   <?php echo $data[priority]?>
   </font>
  </td>
 </tr>
<?php 
 }
?>

</table>
