Location: PHPKode > scripts > ScreamingToDos > std-0.9/todos.php
<?PHP
require "login.php";

$categoryR = qDB("SELECT id,category FROM $categorytable WHERE owner=\"$currentuser\" ORDER BY sort_number");
if (mysql_num_rows($categoryR) == 0) {
 Header ("Location:category.php");
}

$currentPage = "STD";
$confirmStr = "Are you sure you want to delete this item and all its comments?";
require "header.php";

if (!($print)) { showAddTask(); }

$q = "SELECT id,category,open_sortby,closed_sortby,owner,closed_show,open_show,open_show_comments,closed_show_comments";
$q = $q." FROM $categorytable WHERE owner=\"$currentuser\" ORDER BY sort_number";
$categoryR = qDB($q);
while ($categoryD = mysql_fetch_array($categoryR)) {

 $q = "SELECT id,priority,owner,task,DATE_FORMAT(due_date, '%m.%d.%y') AS due_date, closed,DATE_FORMAT(created_date, '%m.%d.%y') AS created_date,categoryid";
 $q .= " FROM $todotable WHERE closed=\"0\" AND categoryid=".$categoryD["id"]." ORDER BY ".$categoryD["open_sortby"];
 $r = qDB($q);
 $totaltasks = mysql_num_rows($r);
 $totalopentasks = $totaltasks;
 if (($totaltasks > 0) || ($show_empty_categories)) {
  showTableHeader($categoryD,"open",$categoryD["open_show_comments"]);
  while ($d = mysql_fetch_array($r)) {
   if (($d["priority"] >= 1) && ($d["priority"] <= 3)){ $foreCol = $highForeCol; $backCol = $highBackCol; }
   elseif (($d["priority"] > 3) && ($d["priority"] < 8)) { $foreCol = $medForeCol; $backCol = $medBackCol; } 
   elseif (($d["priority"] >= 8) && ($d["priority"] <= 10)) { $foreCol = $lowForeCol; $backCol = $lowBackCol; } 
   showitem($d, "open",$categoryD["open_show"],$categoryD["open_show_comments"]);
  }
 } ?>
 </table></form>
   <?PHP
 
 $q = "SELECT id,priority,owner,task,DATE_FORMAT(closed_date, '%m.%d.%y') AS closed_date, closed,DATE_FORMAT(created_date, '%m.%d.%y') AS created_date, categoryid";
 $q .= " FROM $todotable WHERE closed=\"1\" AND categoryid=".$categoryD["id"]." ORDER BY ".$categoryD["closed_sortby"];
 $r = qDB($q);
 $totaltasks = mysql_num_rows($r);
 $totalclosedtasks = $totaltasks;
 if (($totaltasks > 0) || ($show_empty_categories)) {
  showTableHeader($categoryD,"closed",$categoryD["closed_show_comments"]);
  $foreCol = $doneForeCol;
  $backCol = $doneBackCol;
  while ($d = mysql_fetch_array($r)) {
   showitem($d, "closed",$categoryD["closed_show"],$categoryD["closed_show_comments"]);
  }
 } ?>
<br><p></p>
</table></form>
<?PHP
}

if ((!($totalopentasks)) && (!($totalclosedtasks))) { ?>
<center>
<br><p></p>
<br><p></p>
 <table border="0" width="75%" cellpadding="10" style="border-right:thin groove;border-bottom:thin groove;border-left:thin groove;border-top:thin groove;">
  <tr>
   <td align="center">
 <font face="<?PHP echo $pageFont ?>" size="+<?PHP echo ($pageFontsize+2) ?>" color="<?PHP echo $errorForeCol ?>">
<strong>You are currently experiencing a lack of things to do. You should consder entering some todos using the form above if you want to get organized.</strong>
</font>
<br><p></p>
 <font face="<?PHP echo $pageFont ?>" size="<?PHP echo $pageFontsize ?>" color="<?PHP echo $pageForeCol ?>">
  If you cannot think of anything to do, <a href="mailto:<?PHP echo $adminEmail ?>">email</a> me and I'll see what I can do.
 </font>
   </td>
  </tr>
 </table>
</center>
<br><p></p>
<br><p></p>
<br><p></p>

<?PHP } ?>
<?PHP require 'footer.php' ?>
Return current item: ScreamingToDos