=====Tools To Use Wiki As a Pim===== {{lastedit show="3"}} 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 I've modified/developed two tools (with more forthcoming) with this purpose. One tool is a collection of actions so that schedules can be kept and organized on line. Its components include a "rapid entry" tool (##scheduler.php##, which should be kept on a page called ""ScheDuler""), a monthly schedule view (##monthschedule.php## which should be kept on a page called ""MonthSchedule"") and a day view (##dayview.php## which should be kept on a page called ""DaySchedule""). These actions depend on a function which must be included as a file in the ##scripts## directory. A year-view calendar is also available at GmBowenCalendar. The other available action is a task manager (based on gbtask). The badwordfunction is at the bottom of the page (and currently is needed by the task manager & must be included in wikka.php). =====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. The schedule for a day can be viewed with the entry tool, in the monthly view, or in the day view. The day viewer is formatted for printing out usable schedules, & you can designate a specific user with it and see somebody else's schedule (I intend on modifying this so that there will be an easy-to-use text entry box for entering user names). http://gmbtst.msvu.ca/wikitest/scheduler.jpg Code for table in data base..... ~&**Make sure you replace the prefix "wakka_" in this code with whatever prefix is set in the configuration for your Wikka installation!** --JavaWoman %%(sql) 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; %% These actions rely on a "bad word function" which must be placed as a file called ##badwordfunction.php## located in a directory called ##scripts## located in the wiki root directory. %%(php;1) %% below code added to actions directory as ##scheduler.php##. The action should be placed on a page called "ScheDule". %%(php;1)

GetConfigValue("base_url"); $thispage=$this->GetPageTag(); // 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']; include_once("./scripts/badwordfunction.php"); $dayschedule = BadWordFunction($dayschedule); $dayschedule = addslashes($dayschedule); // for single quotes to work // 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 ?>
"; for ($i=1; $i<=$firstwday; $i++) { print " "; } $firstweek = false; } /*== Sunday start week with ==*/ if ($wday==0) { print " \n"; } /*== check for event ==*/ print " \n"; /*== Saturday week with ==*/ if ($wday==6) { print " \n"; } $wday++; $wday = $wday % 7; $day++; } ?>
<<< >>>
Su Mo Tu We Th Fr Sa
 
"; 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 = ""; $font2 = ""; } else { $font1 = ""; $font2 = ""; } print "$font1$day$font2"; print "

DaySchedule&>Day Schedule  |  MonthSchedule&>Month Schedule

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."'"); // replaced a comma with XXZXX below....I don't know what the purpose of the code is... $dayschedule = str_replace("XXZXX", "\n", $dayschedule[dayschedule]); $output = str_replace(",", " ", $dayschedule[dayschedule]); ?>
<< >>

The Scheduler only works for logged-in users."; } ?>

%% The following is the action which shows a formatted output for a selected day....the current day (by default) or for any other day (using a link from the ##scheduler.php## & ##monthview.php## actions)....it should be saved into the actions directory as ##dayschedule.php## and for proper functioning with ##scheduler.php## should be placed on a page called ""DaySchedule"". %%(php;1) GetConfigValue("base_url"); $thispage=$this->GetPageTag(); $lastday = getLastDayofMonth($month,$year); /*== get the last day of the month ==*/ function 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; } // gets username $username = $this->GetUserName(); $user = $username; $dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'"); $printout = str_replace("\n", "
", $dayschedule[dayschedule]); $printowner = $username."'s entries for "; ?>
<< >>

GetUser()) { if(!empty($printout)) { echo $printout; } else { echo "There are no entries on this day."; } } else { echo "Showing the day schedule only works for logged-in users."; } ?>

ScheDuler&>Small Scheduler  |  MonthSchedule&>Month Scheduler
%% This is a screenshot of the ##dayschedule.php## output... http://gmbtst.msvu.ca/wikitest/dayschedule.jpg This final action show a month-view with all of the entries. It should be saved into the actions directory as ##monthscheduler.php## and for proper functioning with ##scheduler.php## the action should be placed on a page called ""MonthSchedule"". %%(php;1)

GetConfigValue("base_url"); $thispage=$this->GetPageTag(); $username = $this->GetUserName(); // 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']; include_once("./scripts/badwordfunction.php"); $dayschedule = BadWordFunction($dayschedule); $dayschedule = addslashes($dayschedule); // for single quotes to work // 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 ?>
"; for ($i=1; $i<=$firstwday; $i++) { print " "; } $firstweek = false; } /*== Sunday start week with ==*/ if ($wday==0) { print " \n"; } /*== check for event ==*/ print " \n"; /*== Saturday week with ==*/ if ($wday==6) { print " \n"; } $wday++; $wday = $wday % 7; $day++; } ?>
<<< 's Calendar for >>>
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 
"; 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 = ""; $font2 = ""; $token="yes"; } else { $font1 = ""; $font2 = ""; $token="no"; } // code to determine what data should be entered into each cell $thisdayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$day."' AND month='".$month."' AND year='".$year."'"); $dayoutput = str_replace("\n", "
", $thisdayschedule[dayschedule]); if ($token=="yes") { $printme="[Print Day]"; } else { $printme=""; } print "
 $font1$day$font2 $printme
$dayoutput
"; print "

DaySchedule&>Formatted Day Page  |  Scheduler&>Small Monthly Calendar

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."'"); // replaced a comma with XXZXX below....I don't know what the purpose of the code is... $dayschedule = str_replace("XXZXX", "\n", $dayschedule[dayschedule]); $output = str_replace(",", " ", $dayschedule[dayschedule]); ?>

<< >>
The Scheduler only works for logged-in users."; } ?>

%% The following is a screen shot of the monthscheduler. http://gmbtst.msvu.ca/wikitest/monthview.jpg ====Task Manager==== The task manager has two components. One is called mytasks.php which shows the task list of the logged in user & allows you to edit your task lists. The other is a (highly) modified version called usertasks.php which can be used to look at the task list of other users. It allows multiple instances of the action on the same page (so you can keep the task lists of all 3 people on the project in one page at once). It **REQUIRES** the usertasksfunctions.php file to be placed in a directory called "scripts" in the wiki root directory. The functions in it have been re-named from those in mytasks.php so you can have mytasks.php & usertasks.php on the same page (but only ONE copy of mytasks.php). http://gmbtst.msvu.ca/wikitest/taskmanager.jpg **Note that** there is a function code conflict in the mytasks.php action that causes problems if two copies are put on one page. JavaWoman steered me towards include_once() and require_once() which I implemented in wikkaforum & usertasks.php which works quite well. I'll work at implementing it here for the mytasks.php manager code in the coming week. ~&-replaced every //wakka_task// with //".$this->config["table_prefix"]."task//. Remember that it is possible to freely choose the table_prefix and the standard is //wikka_// The form used now prevents the necessity of renaming the file manually. ~&-set the table prefix for the creation-sql-command to wikka_ (default for wikka) and added a note. ~&--NilsLindenberg Save the below code as ##mytasks.php## and place in the actions directory (REMEMBER, it needs the Bad Word Function included in ##wakka.php## for now...the code is at the bottom of the page). %%(php;1) method == "show") { 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 ".$this->config["table_prefix"]."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 ".$this->config["table_prefix"]."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 ".$this->config["table_prefix"]."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 ".$this->config["table_prefix"]."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."[".$i."] \n"; } //header echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "
\n"; //html header, search form items, per page form echo "
\n"; echo " Task Owner: $task_owner "; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "
Pages: $tm_page_nav * (Pg: $tm_page) [HOME]  [SHOW ALL]
\n"; echo "
\n"; //search function function get_results($keyword, $linktm, $tm_page, $task_owner, $owner) { //search the database $strSQL = "SELECT * From ".$this->config["table_prefix"]."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 "
Your keyword is: ".$keyword."

\n"; echo "\n"; while($mykey = mysql_fetch_array($results)){ //list the results echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "

\n"; switch ($mykey["task_status"]) { case "Incomplete": echo "".$mykey["task_status"]."\n"; break; case "In Progress": echo "".$mykey["task_status"]."\n"; break; case "Complete": echo "".$mykey["task_status"]."\n"; break; } echo "
".$mykey["task_title"]." (posted on:".$mykey["task_timestamp"].")
\n"; }else{ echo "

SORRY, NO MATCH!

\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 ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id; $query = mysql_query($strSQL); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
STATUS  TASK ENTERED ON
"; while ($item = mysql_fetch_object($query)){ echo "
\n"; echo "\n"; echo "\n"; echo ""; echo "

  \n"; switch ($item->task_status) { case "Incomplete": echo "".$item->task_status."\n"; break; case "In Progress": echo "".$item->task_status."\n"; break; case "Complete": echo "".$item->task_status."\n"; break; } echo "
  ".strtoupper($item->task_title)."
".$item->task_timestamp."
\n"; echo "\n"; echo "
   ".str_replace("\n", "
", $item->task_content)."
\n"; } } else { $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id; $query = mysql_query($strSQL); $item = mysql_fetch_array($query); echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "

\n"; switch ($item["task_status"]) { case "Incomplete": echo "".$item["task_status"]."\n"; break; case "In Progress": echo "".$item["task_status"]."\n"; break; case "Complete": echo "".$item["task_status"]."\n"; break; } echo "
".strtoupper($item["task_title"])." (posted on: ".$item["task_timestamp"].")
".str_replace("\n", "
", $item["task_content"])."
EDIT | \n"; echo "DELETE
\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 ".$this->config["table_prefix"]."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 "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\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 "\n"; echo "\n"; echo "\n"; //items status case switch ($todo["task_status"]) { case "Incomplete": echo "\n"; break; case "In Progress": echo "\n"; break; case "Complete": echo "\n"; break; } //modify action echo "\n"; echo "\n"; } echo "
\n"; echo "TASK \n"; echo "ENTERED ON \n"; echo "STATUS MODIFY
".$todo["task_title"]."".$todo["task_timestamp"]."".$todo["task_status"]."".$todo["task_status"]."".$todo["task_status"]."[view|edit|"; echo "delete]
\n"; mysql_free_result($query); //add todo item form echo "

\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "NEW TITLE: \n"; echo "
\n"; echo "\n"; echo "DESCRIPTION: \n"; echo "
\n"; echo "\n"; echo "SELECT STATUS: \n"; echo "
Modified from code
© geniusbug\n"; echo "
\n"; echo "
* Each page holds ".$records_page." items.
\n"; } //edit item function function edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner) { $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE user = '$task_owner' AND task_id = ".$edit_id; $query = mysql_query($strSQL); $edittodo = mysql_fetch_array($query); //edit item form echo "\n"; echo "
EDITING: ".strtoupper($edittodo["task_title"])."
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "TITLE: \n"; echo "
\n"; echo "\n"; echo "DESCRIPTION: \n"; echo "
\n"; echo "\n"; echo "SELECT STATUS: \n"; echo "
\n"; echo "  \n"; echo "\n"; echo "\n"; echo "
\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 "
"; echo ""; echo ""; } ?> %% **NOTE** that ##usertasks.php## also **requires** the file ##usertasksfunctions.php## (code farther below) to be placed in a directory called ##scripts## in the wikka root. The following code is for ##usertasks.php## which should be placed in the actions directory...it allows you to look at others' schedules using the parameter="username" as in ""{{usertasks owner="username"}}""...you can place several copies of it on the same page to see task lists for several people (like all members of a working group) at once. The code requires three gif files: ##up.gif##, ##down.gif## and ##trs.gif##. %%(php;1) config["table_prefix"]; global $linktm, $use; $linktm = $this->config["base_url"].$this->MiniHref($method, $tag); $task_id = $_REQUEST['task_id']; $task_title = $_POST['task_title']; $task_content = $_POST['task_content']; $task_status = $_POST['task_status']; $order1 = $_REQUEST['order1']; $dir1 = $_REQUEST['dir1']; $dir = $_REQUEST['dir']; if($owner != NULL){$task_owner = $owner; }else { $task_owner = $this->GetPageOwner();} if($_REQUEST['tm_page'] == '' || $_REQUEST['tm_page'] == NULL){$tm_page = '1';}else{$tm_page = $_REQUEST['tm_page'];} $tm_direction = $_REQUEST[dir]; $tm_order = $_REQUEST[order]; $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; } $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']; //resume to 10 items per page if(!isset($records_page)){ $records_page = 10; } $strSQL = "SELECT * From ".$this->config["table_prefix"]."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."[".$i."] \n"; } echo "
\n"; //html header, search form items, per page form echo "
\n"; echo " Task Owner: $task_owner "; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "
Pages: $tm_page_nav (Pg: $tm_page) [HOME]  SHOW:[ALL|INCOMPLETE|IN PROGRESS|COMPLETE]
\n"; echo "
\n"; // functions include include_once("./scripts/usertasksfunctions.php"); //organize events order if (strlen($keyword) > 0) { get_results2($keyword, $linktm, $tm_page, $task_owner, $owner, $table); }elseif(strlen($task_id) > 0) { item2($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1, $table); }else{ list_todo2($list_order, $list_dir, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner, $table); } $fd = fopen ($HTTP_SERVER_VARS["SCRIPT_FILENAME"], "r"); $line=0; if($fd){ while (!feof ($fd)) { $buffer = fgets($fd, 4096); $line++; } fclose ($fd); } echo "
"; ?> %% In addition the following file (##usertasksfunctions.php##) must be placed in a directory called ##scripts## in the wikka root. %%(php;1) 0) { echo "
Your keyword is: ".$keyword."

\n"; echo "\n"; while($mykey = mysql_fetch_array($results)){ //list the results echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "

\n"; switch ($mykey["task_status"]) { case "Incomplete": echo "".$mykey["task_status"]."\n"; break; case "In Progress": echo "".$mykey["task_status"]."\n"; break; case "Complete": echo "".$mykey["task_status"]."\n"; break; } echo "
".$mykey["task_title"]." X(posted:".$mykey["task_timestamp"].")
\n"; }else{ echo "

SORRY, NO MATCH!

\n"; } mysql_free_result($results); } //view item after search function function item2($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1, $table) { if($task_id == 'ALL'){ $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id; $query = mysql_query($strSQL); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
STATUS  TASK ENTERED ON
"; while ($item = mysql_fetch_object($query)){ echo "
\n"; echo "\n"; echo "\n"; echo ""; echo "

  \n"; switch ($item->task_status) { case "Incomplete": echo "".$item->task_status."\n"; break; case "In Progress": echo "".$item->task_status."\n"; break; case "Complete": echo "".$item->task_status."\n"; break; } echo "
  ".strtoupper($item->task_title)."
".$item->task_timestamp."
\n"; echo "\n"; echo "
   ".str_replace("\n", "
", $item->task_content)."
\n"; } } elseif ($task_id == 'INCOMPLETE'){ $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='Incomplete' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id; $query = mysql_query($strSQL); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
STATUS  TASK ENTERED ON
"; while ($item = mysql_fetch_object($query)){ echo "
\n"; echo "\n"; echo "\n"; echo ""; echo "

  \n"; switch ($item->task_status) { case "Incomplete": echo "".$item->task_status."\n"; break; case "In Progress": echo "".$item->task_status."\n"; break; case "Complete": echo "".$item->task_status."\n"; break; } echo "
  ".strtoupper($item->task_title)."
".$item->task_timestamp."
\n"; echo "\n"; echo "
   ".str_replace("\n", "
", $item->task_content)."
\n"; } } elseif ($task_id == 'INPROGRESS'){ $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='In Progress' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id; $query = mysql_query($strSQL); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
STATUS  TASK ENTERED ON
"; while ($item = mysql_fetch_object($query)){ echo "
\n"; echo "\n"; echo "\n"; echo ""; echo "

  \n"; switch ($item->task_status) { case "Incomplete": echo "".$item->task_status."\n"; break; case "In Progress": echo "".$item->task_status."\n"; break; case "Complete": echo "".$item->task_status."\n"; break; } echo "
  ".strtoupper($item->task_title)."
".$item->task_timestamp."
\n"; echo "\n"; echo "
   ".str_replace("\n", "
", $item->task_content)."
\n"; } } elseif ($task_id == 'COMPLETE'){ $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='Complete' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id; $query = mysql_query($strSQL); echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
STATUS  TASK ENTERED ON
"; while ($item = mysql_fetch_object($query)){ echo "
\n"; echo "\n"; echo "\n"; echo ""; echo "

  \n"; switch ($item->task_status) { case "Incomplete": echo "".$item->task_status."\n"; break; case "In Progress": echo "".$item->task_status."\n"; break; case "Complete": echo "".$item->task_status."\n"; break; } echo "
  ".strtoupper($item->task_title)."
".$item->task_timestamp."
\n"; echo "\n"; echo "
   ".str_replace("\n", "
", $item->task_content)."
\n"; } } else { $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id; $query = mysql_query($strSQL); $item = mysql_fetch_array($query); echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "

\n"; switch ($item["task_status"]) { case "Incomplete": echo "".$item["task_status"]."\n"; break; case "In Progress": echo "".$item["task_status"]."\n"; break; case "Complete": echo "".$item["task_status"]."\n"; break; } echo "
".strtoupper($item["task_title"])." (posted: ".$item["task_timestamp"].")
".str_replace("\n", "
", $item["task_content"])."
\n"; } } //list items function function list_todo2($tm_order, $tm_direction, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner, $table) { if (!isset($tm_order)) { $tm_order = "task_timestamp"; } if (!isset($tm_direction)) { $tm_direction = "DESC"; } $begin = (($tm_page-1)*$records_page); $strSQL = "SELECT * From ".$table."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 "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\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 "\n"; echo "\n"; echo "\n"; //items status case switch ($todo["task_status"]) { case "Incomplete": echo "\n"; break; case "In Progress": echo "\n"; break; case "Complete": echo "\n"; break; } echo "\n"; } echo "
\n"; echo "TASK \n"; echo "ENTERED ON \n"; echo "STATUS View?
".$todo["task_title"]."".$todo["task_timestamp"]."".$todo["task_status"]."".$todo["task_status"]."".$todo["task_status"]."[view]"; echo "
\n"; mysql_free_result($query); } ?> %% Ultimately, it is intended that a text entry box and a submit button will be added to this code for entering user names so the schedule of any user can be easily obtained without editing the page. **Remember**, multiple copies of mytasks.php cannot be on the same page at once. And, of course, you need to create a new table in your database.... ''Remember that you may need to replace wikka_ (first line) with your wikkas table prefix'' %%(sql) CREATE TABLE `wikka_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; %% ---- The mytasks.php function on this page use a "bad word function" that should be placed in the wakka.php file in the wiki root directory. The following code needs to be placed in the wakka.php file (just after the microtime function which starts "function getmicrotime" and ends with a "}". This code is placed immediately after the "}". %%(php) //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; %% ---- In mytasks.php use something like this: %%(php) if ($this->method == "show") { global $tableprefix; $tableprefix = $this->config["table_prefix"]; %% and inside function use global $tableprefix; and in query "... FROM ${tableprefix}task ...." **do not use $this->config["table_prefix"] inside function PHP 5.1.x do not understand** ---- CategoryUserContributions