Revision [3060]

This is an old revision of GmBowenWikkaAsPIM made by JavaWoman on 2004-12-09 22:53:34.

 

One use of Wikka is as a Personal Information Manager. For some things the free-form writing nature of a wiki is useful (and, dare-I-say, liberating). However, as some of our usage at this site suggests, there are tools that can be developed AS actions in wikka that can make some aspects of information management a bit easier. In the past six months we've modified/developed two tools (with more forthcoming) with this purpose. One is a scheduler (based on the calendar tool elsewhere), and the other is a task manager (based on gbtask).

Task Manager

The task manager has two components. One is called mytasks.php which shows the task list of the logged in user. The other is a modified version called usertasks.php which can be used to look at the task list of other users.
http://gmbowen.educ.unb.ca/wikitest/taskmanager.jpg
save as mytasks.php and place in the actions directory
<?
// This {{action}} script for derivations of wakka wiki is heavily modified from a standalone single-script package
// produced by and provided by the author identified in the text box below....although it is released by her as a "free to use"
// script, no mention is made of any problems with commercial use. If you intend on using this action script modified from the
// geniusbug code, especially for commercial purposes, you should contact the original author for permission to use the original
// components. All modifications of the original script by G. Michael Bowen & Mark Kasper are provided under a GPL license.
// Ongoing attribution of authorial contributions in any future modifications would be appreciated.
////////////////////////////////////////
//  GBTask Task Manager               //
//  Naomi C. Martinson                //
//  2002 © http://www.geniusbug.com   //
//  Don't remove this message         //
//  Contact: naomi@geniusbug.com      //
////////////////////////////////////////

global $linktm;
$linktm = $this->config["base_url"].$this->MiniHref($method, $tag);
$delete_id = $_REQUEST['delete_id'];
$edit_id = $_REQUEST['edit_id'];
$task_id = $_REQUEST['task_id'];
$add_id = $_POST['add_id'];
$task_title = $_POST['task_title'];
$task_content = $_POST['task_content'];
$task_status = $_POST['task_status'];
$order1 = $_REQUEST['order1'];
$dir1 = $_REQUEST['dir1'];

$task_owner = $this->GetUserName();

// kasper
if($_REQUEST['tm_page'] == '' || $_REQUEST['tm_page'] == NULL){$tm_page = '1';}else{$tm_page = $_REQUEST['tm_page'];}

$update_id = $_POST[update_id];
$tm_direction = $_REQUEST[dir];
$keyword = $_POST[keyword];
if ($items == '' || $items =='0') { $items = 10;}
$items_per_page = $items;
session_start();



session_register("records_page");
$records_page = $items_per_page;

if(isset($tm_order)){
    session_register("list_order");
    $list_order = $tm_order;
}

if(isset($tm_direction)){
    session_register("list_dir");
    $list_dir = $tm_direction;
}

if(isset($set_theme)){
    session_register("theme");
    $theme = $set_theme;
}

if (isset($showsource)) {
    show_source($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);
    exit;
}

//delete statement
if (strlen($delete_id) > 0){
    $strSQL = "UPDATE wakka_task SET task_delete = '1' WHERE task_id = ".$delete_id;
    mysql_query($strSQL);
}

if (strlen($update_id) > 0){

// Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
$task_content = BadWordFunc($task_content);
$task_title = BadWordFunc($task_title);

    $strSQL = "UPDATE wakka_task SET user = '".$task_owner."', task_title = '".$task_title."', task_content = '".$task_content."', task_status = '".$task_status."' WHERE task_id=".$update_id;
    mysql_query($strSQL);

//redirect sending a header to the server
header("Location: ".$linktm."&tm_page=".$tm_page);
exit;
}

$delete_id = $_REQUEST['delete_id'];
$edit_id = $_REQUEST['edit_id'];
//$tm_page = $_REQUEST['tm_page'];
$task_id = $_REQUEST['task_id'];
$add_id = $_POST['add_id'];
$task_title = $_POST['task_title'];
$task_content = $_POST['task_content'];
$task_status = $_POST['task_status'];
//$task_owner = $this->GetPageOwner();

//add statement
if (strlen($add_id) > 0){
    $task_timestamp = date("Y-m-d H:i:s",mktime());    

//$task_status = "Incomplete";

// Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
$task_content = BadWordFunc($task_content);
$task_title = BadWordFunc($task_title);

    $strSQL = "INSERT Into wakka_task (user, task_timestamp, task_title, task_content, task_status) VALUES ('$task_owner','$task_timestamp', '$task_title', '$task_content', '$task_status')";
    mysql_query($strSQL);

//redirect sending a header to the server    
header("Location: ".$linktm."&tm_page=".$tm_page);
exit;
}

//resume to 10 items per page
if(!isset($records_page)){
    $records_page = 10;
}

// GMB Changed below line to include "where" statement

$strSQL = "SELECT * From wakka_task WHERE user = '$task_owner' AND task_delete = '0'";
$query = mysql_query($strSQL);

$total_records = mysql_num_rows($query);
mysql_free_result($query);

if (!isset($tm_page)) {
    $tm_page=1;
}
$num_pages = ceil($total_records / $records_page);
for ($i=1;$i<=$num_pages;$i++) {
    $tm_page_nav = $tm_page_nav."[<a href=\"".$linktm."&tm_page=".$i."\">".$i."</a>]&nbsp;\n";
}

//header
echo "<html><head>\n";
//echo "<style type=\"text/css\">\n";
echo "<!-- \n";
echo "body {color:gray; font-size:10px; font-family:verdana,arial;}\n";
echo "td {color:gray; font-size:10px; font-family:verdana,arial;}\n";
echo "--> \n";
echo "</style>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";

echo "<table width=90% cellpadding=0 cellspacing=0 border=0 align=center><tr><td bgcolor=white align=\"center\" valign=top>\n";

//html header, search form items, per page form
echo "<form method=post action=\"".$linktm."\">\n";
echo "<span style='color:gray; font-size:10px; font-family:verdana,arial;'> Task Owner: $task_owner </span>";
echo "<table width=75% cellpadding=0 cellspacing=0 border=0 valign=bottom><tr>\n";
echo "<td bgcolor=\"#949AE7\" valign=bottom><img src=\"images/trs.gif\" width=1 height=1></td>\n";
echo "</tr></table>\n";
echo "<table width=75% cellpadding=0 cellspacing=0 border=0><tr>\n";
echo "<td bgcolor=\"E9EBF3\">
       <table width=100%><tr>
          <td align=left>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'> <!-- Page Owner: $task_owner -->
          Pages: $tm_page_nav <a href=\"$linktm#tip1\"><font color=\"red\"><b><u>*</u></b></font></a> (Pg: $tm_page)</td>
          <td align=center><a href=\"$linktm\"><b>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
          [HOME]</b></a>&nbsp;&nbsp;<a href=\""
.$linktm."&task_id=ALL&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>[SHOW ALL]</b></a></td>
          <td align=right><input type=text size=15 value=\"keyword\" name=\"keyword\"><input type=submit value=\"Search\"></td>
        </tr></table>
      </td>\n"
;
echo "</tr></table>\n";
echo "</form>\n";

//search function
function get_results($keyword, $linktm, $tm_page, $task_owner, $owner) {        
    //search the database
    $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user = '$task_owner' AND task_title LIKE '%".$keyword."%' OR task_content LIKE '%".$keyword."%'";
    $results = mysql_query($strSQL);
   
    if (mysql_num_rows($results) > 0) {
       
        echo "<br>Your keyword is: <b>".$keyword."</b><P>\n";
        echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
        while($mykey = mysql_fetch_array($results)){
           
            //list the results
            echo "<tr>\n";
            echo "<td bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
           
            switch ($mykey["task_status"]) {
            case "Incomplete":
            echo "<font color=red>".$mykey["task_status"]."</font>\n";
            break;
           
            case "In Progress":
            echo "<font color=blue>".$mykey["task_status"]."</font>\n";
            break;
           
            case "Complete":
            echo "<font color=green>".$mykey["task_status"]."</font>\n";
            break;
            }
           
            echo "</nobr></font></td>\n";
            echo "<td bgcolor=\"#F3F0F9\" align=left valign=top width=75%><a href=\"".$linktm."&task_id=".$mykey["task_id"]."&tm_page=$page\">".$mykey["task_title"]."</a> (posted on:".$mykey["task_timestamp"].")</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
    }else{
        echo "<P><font color=red>SORRY, NO MATCH!</font><P>\n";
    }
    mysql_free_result($results);
}

//view item after search function
function item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1) {
    if($task_id == 'ALL'){
   
     $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
     $query = mysql_query($strSQL);
   
    echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
    echo "<tr>";
    echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS&nbsp;<a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=DESC&num=\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "  
          </tr>
          </table>"
;
           
           
      while ($item = mysql_fetch_object($query)){
           
           echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
           echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
           echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>&nbsp;&nbsp;\n";

           switch ($item->task_status) {
              case "Incomplete":
              echo "<font color=red>".$item->task_status."</font>\n";
              break;
   
              case "In Progress":
              echo "<font color=blue>".$item->task_status."</font>\n";
              break;
   
              case "Complete":
              echo "<font color=green>".$item->task_status."</font>\n";
              break;
           }
   
           echo "</nobr></font></td>\n";
           echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>&nbsp; ".strtoupper($item->task_title)."</b></font></td>";    
           echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
           echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2> &nbsp; &nbsp;".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
           echo "</table></tr></td></table>\n";
      }
    }
    else
    {
       $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id;
       $query = mysql_query($strSQL);
       $item = mysql_fetch_array($query);
       echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
       echo "<td width=5% bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";

       switch ($item["task_status"]) {
       case "Incomplete":
       echo "<font color=red>".$item["task_status"]."</font>\n";
       break;

       case "In Progress":
       echo "<font color=blue>".$item["task_status"]."</font>\n";
       break;

       case "Complete":
       echo "<font color=green>".$item["task_status"]."</font>\n";
       break;
       }
       echo "</nobr></font></td>\n";    
       echo "<td bgcolor=\"#BBBDD9\" align=left valign=top width=75%><font color=white><b>".strtoupper($item["task_title"])."</b> (posted on: ".$item["task_timestamp"].")</font></td></tr>\n";
       echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2>".str_replace("\n", "<br>", $item["task_content"])."</td></tr>\n";
         
          echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2><nobr><a href=\"".$linktm."&edit_id=".$item["task_id"]."&tm_page=$tm_page\"><b>EDIT</b></a> | \n";
          echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.self.location='$linktm&delete_id=".$item["task_id"]."&tm_page=$tm_page' }\"><b>DELETE</b></a></nobr></td></tr>\n";    
       
       echo "</table>\n";
    }
}

//list items function
function list_todo($tm_order, $tm_direction, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner) {

    if (!isset($tm_order)) {
        $tm_order = "task_timestamp";
    }
   
    if (!isset($tm_direction)) {
        $tm_direction = "DESC";
    }

    $begin = (($tm_page-1)*$records_page);
    $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user = '$task_owner' ORDER By $tm_order $tm_direction LIMIT $begin,$records_page";
    $query = mysql_query($strSQL);

//ECHO 'START of list of items in the cell header information';

    echo "<table width=75% cellpadding=2 cellspacing=2 border=0>\n";
    echo "<tr>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>TASK <a href=\"".$linktm."&order=task_title&dir=DESC&num=\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_title&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>ENTERED ON</b> <a href=\"".$linktm."&order=task_timestamp&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_timestamp&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>STATUS</b> <a href=\"".$linktm."&order=task_status&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=$task_status&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
     
        echo "<td bgcolor=\"#BBBDD9\" valign=top><b>MODIFY</b> <img src=\"images/trs.gif\" width=11 height=16 border=0></td>\n";
   
    echo "</tr>\n";

//ECHO 'START of list of items after HEADER information (why is this in the wrong place??)';
    //list todo items
    while ($todo = mysql_fetch_array($query)) {
    echo "<tr>\n";
    echo "<td align=left bgcolor=\"#F3F0F9\" valign=top><span title=\"Description: ".$todo["task_content"]."\">".$todo["task_title"]."</span></td>\n";
    echo "<td bgcolor=\"#F3F0F9\" valign=top>".$todo["task_timestamp"]."</td>\n";
       
        //items status case
        switch ($todo["task_status"]) {
            case "Incomplete":        
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=red>".$todo["task_status"]."</font></td>\n";
            break;

            case "In Progress":
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=blue>".$todo["task_status"]."</font></td>\n";
            break;

            case "Complete":
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=green>".$todo["task_status"]."</font></td>\n";
            break;
        }
       
    //modify action
     
        echo "<td bgcolor=\"#F3F0F9\" valign=top><nobr>[<a href=\"".$linktm."&task_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>view</b></a>|<a href=\"".$linktm."&edit_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>edit</b></a></font>|";
        echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.self.location='$linktm&delete_id=".$todo["task_id"]."&tm_page=$tm_page' }\"><b>delete</b></a>]</nobr></td>\n";

    echo "</tr>\n";    
    }
    echo "</table>\n";
    mysql_free_result($query);
   
    //add todo item form


    echo "<form method=post action=\"$linktm\">\n";
    echo "<input type=hidden name=\"add_id\" value=1>\n";
    echo "<input type=hidden name=\"page\" value=\"$page\">\n";
    echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
    echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "NEW TITLE: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=text size=30 name=\"task_title\"></td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "DESCRIPTION: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<textarea rows=10 cols=60 name=\"task_content\"></textarea> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "SELECT STATUS: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";

    echo "<select name=task_status>\n";
    echo "<option selected>Incomplete</option>\n";
    echo "<option>In Progress</option>\n";
    echo "<option>Complete</option>\n";
    echo "</select> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=bottom>
           <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
           Modified from code<br> &copy; <a href=\"http://www.geniusbug.com\" target=\"_new\">geniusbug</a>\n"
;
    echo "</td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'>\n"
;
    echo "<input type=submit value=\"Add\"><div align=\"right\"><a name=\"tip1\"><font color=red><b><u>*</u></b></font></a> Each page holds ".$records_page." items.</div></td>\n";
    echo "</form>\n";
    echo "</td><tr>\n";
    echo "</table>\n";    
    }

//edit item function    
  function edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner) {
    $strSQL = "SELECT * From wakka_task WHERE user = '$task_owner' AND task_id = ".$edit_id;
    $query = mysql_query($strSQL);
    $edittodo = mysql_fetch_array($query);
   
   
    //edit item form
   
    echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
     echo "<div align=left> EDITING: <b>".strtoupper($edittodo["task_title"])." </b></div>\n";
    echo "<form method=post action=\"$linktm\">\n";
    echo "<input type=hidden name=\"update_id\" value=\"".$edittodo["task_id"]."\">\n";
    echo "<input type=hidden name=\"page\" value=\"$tm_page\">\n";
    echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "TITLE: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=text size=30 name=\"task_title\" value=\"".$edittodo["task_title"]."\"> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "DESCRIPTION: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<textarea rows=15 cols=40 name=\"task_content\">".$edittodo["task_content"]."</textarea> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "SELECT STATUS: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<select name=\"task_status\">\n";
   
    if ($edittodo["task_status"] == "Incomplete") {
    echo "<option selected>Incomplete</option>\n";
    }else{
    echo "<option>Incomplete</option>\n";
    }
   
    if ($edittodo["task_status"] == "In Progress") {
    echo "<option selected>In Progress</option>\n";
    }else{
    echo "<option>In Progress</option>\n";
    }
   
    if ($edittodo["task_status"] == "Complete") {
    echo "<option selected>Complete</option>\n";
    }else{
    echo "<option>Complete</option>\n";
    }
   
    echo "</select> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" valign=top>\n";
    echo "&nbsp; </td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=submit value=\"Update\">\n";
    echo "</form>\n";
    echo "</td><tr>\n";
    echo "</table>\n";        

mysql_free_result($query);    
}

//organize events order
if (strlen($edit_id) > 0) {
    edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner);
   
}elseif(strlen($keyword) > 0) {
    get_results($keyword, $linktm, $tm_page, $task_owner, $owner);

}elseif(strlen($task_id) > 0) {
    item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1);
   
}else{
    list_todo($list_order, $list_dir, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner);
}

$fd = fopen ($HTTP_SERVER_VARS["SCRIPT_FILENAME"], "r");

$line=0;
if($fd){
    while (!feof ($fd)) {
        $buffer = fgets($fd, 4096);
        $line++;
    }
    fclose ($fd);

}
echo "</table>";
echo "</body>";
echo "</html>";
?>


The following code is for usertasks.php which should be placed in the actions directory...it allows you to look at others' schedules
<?
// This {{action}} script for derivations of wakka wiki is heavily modified from a standalone single-script package
// produced by and provided by the author identified in the text box below....although it is released by her as a "free to use"
// script, no mention is made of any problems with commercial use. If you intend on using this action script modified from the
// geniusbug code, especially for commercial purposes, you should contact the original author for permission to use the original
// components. All modifications of the original script by G. Michael Bowen are provided under a GPL license. Ongoing attribution
// of authorial contribution in any future modifications would be appreciated.
// use of usertasks.php....{{usertasks owner="username"}}
////////////////////////////////////////
//  GBTask Task Manager             //
//  Naomi C. Martinson                //
//  2002 © http://www.geniusbug.com   //
//  Don't remove this message       //
//  Contact: naomi@geniusbug.com      //
////////////////////////////////////////

global $linktm, $use;
$linktm = $this->config["base_url"].$this->MiniHref($method, $tag);
$delete_id = $_REQUEST['delete_id'];
$edit_id = $_REQUEST['edit_id'];
$task_id = $_REQUEST['task_id'];
$add_id = $_POST['add_id'];
$task_title = $_POST['task_title'];
$task_content = $_POST['task_content'];
$task_status = $_POST['task_status'];
$order1 = $_REQUEST['order1'];
$dir1 = $_REQUEST['dir1'];

if($owner != NULL){$task_owner = $owner; }else { $task_owner = $this->GetPageOwner();}

// kasper this breaks apart the share string for each user
$tok = strtok($share, " \n\t");
  while ($tok) {
   if($tok == $this->GetUserName() || $tok == "ALL") { $use = 'true';}
   $tok = strtok(" \n\t");
  }
if(strtoupper($this->GetUserName()) == strtoupper($this->GetPageOwner())){ $use = 'true';}

// kasper
if($_REQUEST['tm_page'] == '' || $_REQUEST['tm_page'] == NULL){$tm_page = '1';}else{$tm_page = $_REQUEST['tm_page'];}

$update_id = $_POST[update_id];
$tm_direction = $_REQUEST[dir];
$keyword = $_POST[keyword];
if ($items == '' || $items =='0') { $items = 10;}
$items_per_page = $items;
session_start();



session_register("records_page");
$records_page = $items_per_page;

if(isset($tm_order)){
    session_register("list_order");
    $list_order = $tm_order;
}

if(isset($tm_direction)){
    session_register("list_dir");
    $list_dir = $tm_direction;
}

if(isset($set_theme)){
    session_register("theme");
    $theme = $set_theme;
}

if (isset($showsource)) {
    show_source($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);
    exit;
}

//delete statement
if (strlen($delete_id) > 0){
    $strSQL = "UPDATE wakka_task SET task_delete = '1' WHERE task_id = ".$delete_id;
    mysql_query($strSQL);
}

if (strlen($update_id) > 0){

// Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
$task_content = BadWordFunc($task_content);
$task_title = BadWordFunc($task_title);

    $strSQL = "UPDATE wakka_task SET user = '".$task_owner."', task_title = '".$task_title."', task_content = '".$task_content."', task_status = '".$task_status."' WHERE task_id=".$update_id;
    mysql_query($strSQL);

//redirect sending a header to the server
header("Location: ".$linktm."&tm_page=".$tm_page);
exit;
}

$delete_id = $_REQUEST['delete_id'];
$edit_id = $_REQUEST['edit_id'];
//$tm_page = $_REQUEST['tm_page'];
$task_id = $_REQUEST['task_id'];
$add_id = $_POST['add_id'];
$task_title = $_POST['task_title'];
$task_content = $_POST['task_content'];
$task_status = $_POST['task_status'];
//$task_owner = $this->GetPageOwner();

//add statement
if (strlen($add_id) > 0){
    $task_timestamp = date("Y-m-d H:i:s",mktime());    

//$task_status = "Incomplete";

// Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
$task_content = BadWordFunc($task_content);
$task_title = BadWordFunc($task_title);

    $strSQL = "INSERT Into wakka_task (user, task_timestamp, task_title, task_content, task_status) VALUES ('$task_owner','$task_timestamp', '$task_title', '$task_content', '$task_status')";
    mysql_query($strSQL);

//redirect sending a header to the server    
header("Location: ".$linktm."&tm_page=".$tm_page);
exit;
}

//resume to 10 items per page
if(!isset($records_page)){
    $records_page = 10;
}

// GMB Changed below line to include "where" statement

$strSQL = "SELECT * From wakka_task WHERE user = '$task_owner' AND task_delete = '0'";
$query = mysql_query($strSQL);

$total_records = mysql_num_rows($query);
mysql_free_result($query);

if (!isset($tm_page)) {
    $tm_page=1;
}
$num_pages = ceil($total_records / $records_page);
for ($i=1;$i<=$num_pages;$i++) {
    $tm_page_nav = $tm_page_nav."[<a href=\"".$linktm."&tm_page=".$i."\">".$i."</a>]&nbsp;\n";
}

//header
echo "<html><head>\n";
//echo "<style type=\"text/css\">\n";
echo "<!-- \n";
echo "body {color:gray; font-size:10px; font-family:verdana,arial;}\n";
echo "td {color:gray; font-size:10px; font-family:verdana,arial;}\n";
echo "--> \n";
echo "</style>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";

echo "<table width=90% cellpadding=0 cellspacing=0 border=0 align=center><tr><td bgcolor=white align=\"center\" valign=top>\n";

//html header, search form items, per page form
echo "<form method=post action=\"".$linktm."\">\n";
echo "<span style='color:gray; font-size:10px; font-family:verdana,arial;'> Task Owner: $task_owner </span>";
echo "<table width=75% cellpadding=0 cellspacing=0 border=0 valign=bottom><tr>\n";
echo "<td bgcolor=\"#949AE7\" valign=bottom><img src=\"images/trs.gif\" width=1 height=1></td>\n";
echo "</tr></table>\n";
echo "<table width=75% cellpadding=0 cellspacing=0 border=0><tr>\n";
echo "<td bgcolor=\"E9EBF3\">
       <table width=100%><tr>
          <td align=left>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'> <!-- Page Owner: $task_owner -->
          Pages: $tm_page_nav <a href=\"$linktm#tip1\"><font color=\"red\"><b><u>*</u></b></font></a> (Pg: $tm_page)</td>
          <td align=center><a href=\"$linktm\"><b>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
          [HOME]</b></a>&nbsp;&nbsp;<a href=\""
.$linktm."&task_id=ALL&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>[SHOW ALL]</b></a></td>
          <td align=right><input type=text size=15 value=\"keyword\" name=\"keyword\"><input type=submit value=\"Search\"></td>
        </tr></table>
      </td>\n"
;
echo "</tr></table>\n";
echo "</form>\n";

//search function
function get_results($keyword, $linktm, $tm_page, $task_owner, $owner) {        
    //search the database
    $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user = '$task_owner' AND task_title LIKE '%".$keyword."%' OR task_content LIKE '%".$keyword."%'";
    $results = mysql_query($strSQL);
   
    if (mysql_num_rows($results) > 0) {
       
        echo "<br>Your keyword is: <b>".$keyword."</b><P>\n";
        echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
        while($mykey = mysql_fetch_array($results)){
           
            //list the results
            echo "<tr>\n";
            echo "<td bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
           
            switch ($mykey["task_status"]) {
            case "Incomplete":
            echo "<font color=red>".$mykey["task_status"]."</font>\n";
            break;
           
            case "In Progress":
            echo "<font color=blue>".$mykey["task_status"]."</font>\n";
            break;
           
            case "Complete":
            echo "<font color=green>".$mykey["task_status"]."</font>\n";
            break;
            }
           
            echo "</nobr></font></td>\n";
            echo "<td bgcolor=\"#F3F0F9\" align=left valign=top width=75%><a href=\"".$linktm."&task_id=".$mykey["task_id"]."&tm_page=$page\">".$mykey["task_title"]."</a> (posted on:".$mykey["task_timestamp"].")</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
    }else{
        echo "<P><font color=red>SORRY, NO MATCH!</font><P>\n";
    }
    mysql_free_result($results);
}

//view item after search function
function item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1) {
    if($task_id == 'ALL'){
   
     $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
     $query = mysql_query($strSQL);
   
    echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
    echo "<tr>";
    echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS&nbsp;<a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "  
          </tr>
          </table>"
;
           
           
      while ($item = mysql_fetch_object($query)){
           
           echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
           echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
           echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>&nbsp;&nbsp;\n";

           switch ($item->task_status) {
              case "Incomplete":
              echo "<font color=red>".$item->task_status."</font>\n";
              break;
   
              case "In Progress":
              echo "<font color=blue>".$item->task_status."</font>\n";
              break;
   
              case "Complete":
              echo "<font color=green>".$item->task_status."</font>\n";
              break;
           }
   
           echo "</nobr></font></td>\n";
           echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>&nbsp; ".strtoupper($item->task_title)."</b></font></td>";    
           echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
           echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2> &nbsp; &nbsp;".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
           echo "</table></tr></td></table>\n";
      }
    }
    else
    {
       $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id;
       $query = mysql_query($strSQL);
       $item = mysql_fetch_array($query);
       echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
       echo "<td width=5% bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";

       switch ($item["task_status"]) {
       case "Incomplete":
       echo "<font color=red>".$item["task_status"]."</font>\n";
       break;

       case "In Progress":
       echo "<font color=blue>".$item["task_status"]."</font>\n";
       break;

       case "Complete":
       echo "<font color=green>".$item["task_status"]."</font>\n";
       break;
       }
       echo "</nobr></font></td>\n";    
       echo "<td bgcolor=\"#BBBDD9\" align=left valign=top width=75%><font color=white><b>".strtoupper($item["task_title"])."</b> (posted on: ".$item["task_timestamp"].")</font></td></tr>\n";
       echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2>".str_replace("\n", "<br>", $item["task_content"])."</td></tr>\n";
        global $use;
        if( $use == 'true'){  
          echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2><nobr><a href=\"".$linktm."&edit_id=".$item["task_id"]."&tm_page=$tm_page\"><b>EDIT</b></a> | \n";
          echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.self.location='$linktm&delete_id=".$item["task_id"]."&tm_page=$tm_page' }\"><b>DELETE</b></a></nobr></td></tr>\n";    
        }
       echo "</table>\n";
    }
}

//list items function
function list_todo($tm_order, $tm_direction, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner) {

    if (!isset($tm_order)) {
        $tm_order = "task_timestamp";
    }
   
    if (!isset($tm_direction)) {
        $tm_direction = "DESC";
    }

    $begin = (($tm_page-1)*$records_page);
    $strSQL = "SELECT * From wakka_task WHERE task_delete = '0' AND user = '$task_owner' ORDER By $tm_order $tm_direction LIMIT $begin,$records_page";
    $query = mysql_query($strSQL);

//ECHO 'START of list of items in the cell header information';

    echo "<table width=75% cellpadding=2 cellspacing=2 border=0>\n";
    echo "<tr>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>TASK <a href=\"".$linktm."&order=task_title&dir=DESC&num=\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_title&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>ENTERED ON</b> <a href=\"".$linktm."&order=task_timestamp&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_timestamp&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
    echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
    echo "<b>STATUS</b> <a href=\"".$linktm."&order=task_status&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=$task_status&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
      if($owner == ''){
      global $use;
      if($use == 'true'){
        echo "<td bgcolor=\"#BBBDD9\" valign=top><b>MODIFY</b> <img src=\"images/trs.gif\" width=11 height=16 border=0></td>\n";
      }}
    echo "</tr>\n";

//ECHO 'START of list of items after HEADER information (why is this in the wrong place??)';
    //list todo items
    while ($todo = mysql_fetch_array($query)) {
    echo "<tr>\n";
    echo "<td align=left bgcolor=\"#F3F0F9\" valign=top><span title=\"Description: ".$todo["task_content"]."\">".$todo["task_title"]."</span></td>\n";
    echo "<td bgcolor=\"#F3F0F9\" valign=top>".$todo["task_timestamp"]."</td>\n";
       
        //items status case
        switch ($todo["task_status"]) {
            case "Incomplete":        
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=red>".$todo["task_status"]."</font></td>\n";
            break;

            case "In Progress":
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=blue>".$todo["task_status"]."</font></td>\n";
            break;

            case "Complete":
            echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=green>".$todo["task_status"]."</font></td>\n";
            break;
        }
       
    //modify action
      if($owner == ''){
       global $use;
       if($use == 'true'){
        echo "<td bgcolor=\"#F3F0F9\" valign=top><nobr>[<a href=\"".$linktm."&task_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>view</b></a>|<a href=\"".$linktm."&edit_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>edit</b></a></font>|";
        echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.self.location='$linktm&delete_id=".$todo["task_id"]."&tm_page=$tm_page' }\"><b>delete</b></a>]</nobr></td>\n";
       }}
    echo "</tr>\n";    
    }
    echo "</table>\n";
    mysql_free_result($query);
   
    //add todo item form

if($owner == '')
{  
    global $use;
if($use == 'true'){
    echo "<form method=post action=\"$linktm\">\n";
    echo "<input type=hidden name=\"add_id\" value=1>\n";
    echo "<input type=hidden name=\"page\" value=\"$page\">\n";
    echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
    echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "NEW TITLE: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=text size=30 name=\"task_title\"></td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "DESCRIPTION: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<textarea rows=10 cols=60 name=\"task_content\"></textarea> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "SELECT STATUS: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";

    echo "<select name=task_status>\n";
    echo "<option selected>Incomplete</option>\n";
    echo "<option>In Progress</option>\n";
    echo "<option>Complete</option>\n";
    echo "</select> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=bottom>
           <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
           Modified from code<br> &copy; <a href=\"http://www.geniusbug.com\" target=\"_new\">geniusbug</a>\n"
;
    echo "</td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>
          <span style='color:gray; font-size:10px; font-family:verdana,arial;'>\n"
;
    echo "<input type=submit value=\"Add\"><div align=\"right\"><a name=\"tip1\"><font color=red><b><u>*</u></b></font></a> Each page holds ".$records_page." items.</div></td>\n";
    echo "</form>\n";
    echo "</td><tr>\n";
    echo "</table>\n";    
    }
}}
//edit item function    
  function edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner) {
    $strSQL = "SELECT * From wakka_task WHERE user = '$task_owner' AND task_id = ".$edit_id;
    $query = mysql_query($strSQL);
    $edittodo = mysql_fetch_array($query);
   
   
    //edit item form
   
    echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
     echo "<div align=left> EDITING: <b>".strtoupper($edittodo["task_title"])." </b></div>\n";
    echo "<form method=post action=\"$linktm\">\n";
    echo "<input type=hidden name=\"update_id\" value=\"".$edittodo["task_id"]."\">\n";
    echo "<input type=hidden name=\"page\" value=\"$tm_page\">\n";
    echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "TITLE: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=text size=30 name=\"task_title\" value=\"".$edittodo["task_title"]."\"> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "DESCRIPTION: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<textarea rows=15 cols=40 name=\"task_content\">".$edittodo["task_content"]."</textarea> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
    echo "<font color=\"#000000\"><b>\n";
    echo "SELECT STATUS: </b></font></td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<select name=\"task_status\">\n";
   
    if ($edittodo["task_status"] == "Incomplete") {
    echo "<option selected>Incomplete</option>\n";
    }else{
    echo "<option>Incomplete</option>\n";
    }
   
    if ($edittodo["task_status"] == "In Progress") {
    echo "<option selected>In Progress</option>\n";
    }else{
    echo "<option>In Progress</option>\n";
    }
   
    if ($edittodo["task_status"] == "Complete") {
    echo "<option selected>Complete</option>\n";
    }else{
    echo "<option>Complete</option>\n";
    }
   
    echo "</select> </td>\n";
    echo "</tr><tr>\n";
    echo "<td bgcolor=\"#DADBEB\" valign=top>\n";
    echo "&nbsp; </td>\n";
    echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
    echo "<input type=submit value=\"Update\">\n";
    echo "</form>\n";
    echo "</td><tr>\n";
    echo "</table>\n";        

mysql_free_result($query);    
}

//organize events order
if (strlen($edit_id) > 0) {
    edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner);
   
}elseif(strlen($keyword) > 0) {
    get_results($keyword, $linktm, $tm_page, $task_owner, $owner);

}elseif(strlen($task_id) > 0) {
    item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1);
   
}else{
    list_todo($list_order, $list_dir, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner);
}

$fd = fopen ($HTTP_SERVER_VARS["SCRIPT_FILENAME"], "r");

$line=0;
if($fd){
    while (!feof ($fd)) {
        $buffer = fgets($fd, 4096);
        $line++;
    }
    fclose ($fd);

}
echo "</table>";
echo "</body>";
echo "</html>";
?>

Ultimately, it is intended that a text entry box and a submit button will be added to this code so the schedule of any user can be easily obtained without editing the page.

I've not been able to figure out why, but neither of these can be on the same page at the same time, nor can there be more than one copy of these on any one page....consider yourself warned.

And, of course, you need to create a new table in your database....
CREATE TABLE `wakka_task` (
  `task_id` INT(11) NOT NULL AUTO_INCREMENT,
  `user` text NOT NULL,
  `task_timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `task_title` VARCHAR(255) NOT NULL DEFAULT '',
  `task_content` text NOT NULL,
  `task_status` VARCHAR(255) DEFAULT NULL,
  `task_delete` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY  (`task_id`)
) TYPE=MyISAM;


Scheduler

Scheduler is an action which allows a person to keep a day calendar (or diary for that matter). Although the entry formatting is simple, at the same time it provides flexibility. A user can enter a day schedule.....

8:00 am - meeting with joe
9:00 am - coffee with angie
10:00 am - clients from budapest

or use it to keep a to-do list, or even a diary for the day. Right now one has to go to the scheduler to view the output, but I'm going to work on a "dayschedule" action which will allow a user to see the schedule (or other input) for any day for any user.....that will allow users to coordinate schedules or activities a bit more easily.
http://gmbowen.educ.unb.ca/wikitest/scheduler.jpg
Code for table in data base.....
CREATE TABLE `wakka_scheduler` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `user` VARCHAR(80) NOT NULL DEFAULT '',
  `day` tinyint(2) NOT NULL DEFAULT '0',
  `month` tinyint(2) NOT NULL DEFAULT '0',
  `year` mediumint(4) NOT NULL DEFAULT '0',
  `dayschedule` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;


below code added to actions directory as scheduler.php
<div align="center">
<P><TABLE BORDER=0>
   <TR>
      <TD>
         <P>
<?php
// As far as it is possible to tell (because the code exists all over the web), we credit the original calendar code
// to Marcus Kazmierczak now released at www.blazonry.com, although the code in this script builds considerably on that code.
// The original parts of this script were developed by G. Michael Bowen And Mark Kasper for a SSHRC research project using wikka wiki.
// Version 1.1 - arrow bars for navigating days added (altho' max at 31 for all months)
// Code additions copyright GMBowen & Mark Kasper, 2004. Released to public domain under GPL. Modify, improve, change as you wish.
// A complementary action, showschedule.php allows anyone to designate an owner & date to see their schedule (in development) (see line 130)

$month = (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];    
$year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
$today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];

$site_base = $this->GetConfigValue("base_url");
?>

<table>
    <tr>
        <td valign="top">
<?php
    /*== get what weekday the first is on ==*/
    $tmpd = getdate(mktime(0,0,0,$month,1,$year));
    $monthname = $tmpd["month"];
    $firstwday= $tmpd["wday"];
    $lastday = mk_getLastDayofMonth($month,$year);
?>
<table cellpadding="2" cellspacing="0" border="1">
    <tr>
        <td colspan="7">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                    <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month-1)<1) ? 12 : $month-1 ; ?>&amp;year=<?php echo (($month-1)<1) ? $year-1 : $year ; ?>">&lt;&lt;&lt;</a></td>
                    <td align="center"><font size="2"><?php echo "$monthname $year"; ?></font></td>
                    <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month+1)>12) ? 1 : $month+1 ; ?>&amp;year=<?php echo (($month+1)>12) ? $year+1 : $year ; ?>">&gt;&gt;&gt;</a></td>
                </tr>
            </table>
      </td>
    </tr>
    <tr>
        <td width="22">Su</td>
        <td width="22">Mo</td>
        <td width="22">Tu</td>
        <td width="22">We</td>
        <td width="22">Th</td>
        <td width="22">Fr</td>
        <td width="22">Sa</td>
    </tr>
    <?php
    $day = 1;
    $wday = $firstwday;
    $firstweek = true;

    /*== loop through all the days of the month ==*/
    while ( $day <= $lastday)
    {
        /*== set up blank days for first week ==*/
        if ($firstweek) {
            print "    <tr>";
            for ($i=1; $i<=$firstwday; $i++)
            { print "        <td><font size=\"2\">&nbsp;</font></td>"; }
            $firstweek = false;
        }

        /*== Sunday start week with <tr> ==*/
        if ($wday==0) { print "    <tr>\n"; }

         /*== check for event ==*/
         print "        <td>";
        if($day<10) {
            if($month<10) {
                $tag = "$year:0$month:0$day";
            } else {
                $tag = "$year:$month:0$day";
            }
        } else {
            if($month<10) {
                $tag = "$year:0$month:$day";
            } else {
                $tag = "$year:$month:$day";
            }
        }
       
        $todaydate = date("Y:m:d",mktime());
        if($tag==$todaydate)
        {
            $font1 = "<font color=\"#FF0000\"><b>";
            $font2 = "</b></font>";
        }
        else
        {
            $font1 = "";
            $font2 = "";
        }
        print "<a href=".$site_base."Scheduler&day=$day&month=$month&year=$year>$font1$day$font2</a>";
        print "</td>\n";

        /*== Saturday week with </tr> ==*/
        if ($wday==6) { print "    </tr>\n"; }

        $wday++;
        $wday = $wday % 7;
        $day++;
    }
?>
    </tr>
</table>

        </td>
    </tr>
</table>

<?php
/*== get the last day of the month ==*/
function mk_getLastDayofMonth($mon,$year)
{
  for ($tday=28; $tday <= 31; $tday++)
  {
    $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
    if ($tdate["mon"] != $mon) break;
  }
$tday--;
return $tday;
}
?>
<!-- Line below commented out until action to show Todays Schedule is completed
<center><a href=/wiki/wakka.php?wakka=TodaysSchedule>Todays Schedule</a></center>
-->
      </TD>
      <TD WIDTH=500>
    <P>

<?php
// badword array for replacing badwords (not initialized as currently using added function in wakka.php)
//$badwords = Array ('/motherfucker/i', '/cunt/i', '/fuck/i', '/cocksucker/i', '/bitch/i', '/son of a bitch/i', '/asshole/i', '/shit/i', '/fag/i', '/wank/i', '/dick/i', '/pussy/i', '/bastard/i', '/molester/i', '/molezter/i', '/cock/i');
//$changeto = '****';

// gets username
$username = $this->GetUserName();

// kasper
//  NOTE VERY IMPORTANT,  if the table is totally empty the function will not work, you
//                        must add one in maually, for this function to work
//                        I could add it in the code but very messy, will come up with better way.

$dayschedule = $_POST['dayscheduleX'];

$dayschedule = BadWordFunc($dayschedule);
// replace above function call with line below if wakka.php doesn't have a bad word function code in it
//$dayschedule = preg_replace($badwords, $changeto, $dayschedule);

$query = "select * from ".$this->config['table_prefix']."scheduler";
$result = mysql_query($query);

if ($_POST['save']){
    // Kasper added to delete the empty schedule
  $del = "delete from ".$this->config['table_prefix']."scheduler where dayschedule = ''";
  $delresult = mysql_query($del);
  $up = 0;
    while ($row = mysql_fetch_object($result))
    {      
        if($row->user == $username && $row->month == $month && $row->day == $today && $row->year == $year)
        {
         $up = 1;      
         $ro = $row->id;      
        }                    
    }

    if($up == 1)
    {        
        $query = "UPDATE ".$this->config['table_prefix']."scheduler SET dayschedule='$dayschedule' WHERE user='$username' AND id='$ro'";
        $result = mysql_query($query);
    }else{      
        $query = "INSERT into ".$this->config['table_prefix']."scheduler (user,dayschedule,month,day,year) VALUES ('$username','$dayschedule','$month','$today','$year')";
        $result = mysql_query($query);              
    }
}

// end kasper
if ($user = $this->GetUser())
{
  $dayschedule = str_replace("\n", ",", $_POST['dayschedule']);

    // title over textarea box
  $printowner = $username."'s Schedule for ";
  $dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
  $dayschedule = str_replace(",", "\n", $dayschedule[dayschedule]);
  $output = str_replace(",", " ", $dayschedule[dayschedule]);
?>
         <br><a href="<?php echo $this->href("", "", "day="); echo (($today-1)<1) ? 31 : $today-1 ; ?>&amp;year=<?php echo $year; ?>&amp;month=<?php echo $month; ?>">&lt;&lt;</a>
        <b><? echo "$printowner$monthname $today, $year:"; ?></b>
        <a href="<?php echo $this->href("", "", "day="); echo (($today+1)>31) ? 1 : $today+1 ; ?>&amp;year=<?php echo $year; ?>&amp;month=<?php echo $month; ?>">&gt;&gt;</a>
        <form action="" method="post">
            <textarea cols="65" rows="12" name="dayscheduleX"><?php echo $dayschedule; ?></textarea>
            <input type="submit" value="Submit" />
               <input type="hidden" name="save" value="true" />
        </form>
<?
}
else
{
echo "<em>The Scheduler only works for logged-in users.</em>";
} ?>
</P>
      </TD>
   </TR>
</TABLE>
</div>


All of the functions on this page user a "bad word function" that is placed in the wakka.php file. The following code needs to be placed in the wakka.php file (just after the microtime function which ends around row 25)
//  GMB remove bad word filter
function BadWordFunc($RemoveBadWordText) {
     $RemoveBadWordText = eregi_replace("fuc?k|[kc]unt|motherfucker|cocksucker|bitch|son of a bitch|asshole|shit|fag|wank|dick|pu[zs]?[zs][yi]|bastard|s[kc]rew|mole[zs]ter|mole[sz]t|coc?k", "****", $RemoveBadWordText);
     return $RemoveBadWordText;
}
There are 33 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki