From c2855691229eb3f2005cbf68982461bf777dac57 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 9 Jul 2010 11:16:04 +0000 Subject: Fixed time calc bug. Minor 'GUI' tweaks. --- forum/utils/tasks.php | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'forum/utils') diff --git a/forum/utils/tasks.php b/forum/utils/tasks.php index 3c5cbcd..91f5409 100644 --- a/forum/utils/tasks.php +++ b/forum/utils/tasks.php @@ -1,4 +1,4 @@ -Done ☐\n"; } $str .= " ".$this->title."\n"; - $str .= " ".substr($this->description, 0, 64)."\n"; + if(strlen($this->description) > 64) + $str .= " ".substr($this->description, 0, 64)."...\n"; + else $str .= " ".$this->description."\n"; if($this->reassignable && $this->userid == $current_user->uid) { $str .= " ".userList($this->userid)."\n"; @@ -120,6 +122,10 @@ class Tasks { } } + $str .= "\n"; + $str .= "
\n"; + $str .= "\n"; + foreach($this->tasks as $task) { if($task->completed == true) { $str .= $task->show(); @@ -225,20 +231,24 @@ $tasks = tasks_init(); if($action == "tick") { $now = time(); - $mininterval = 60 * 60 * 24; // 24 hours - $maxinterval = 60 * 60 * 24 * 7; // 1 week + $h = (60 * 60); + $d = ($h * 24); + + $mininterval = $d - $h * 4; + $maxinterval = $d * 7 - $h * 4; + $overdueinterval = $h * 7; foreach($tasks->tasks as $task) { if($task->completed) continue; // no need for reminding - if(($now > $task->deadline) && (($now - $task->lastreminder) > $mininterval)) { - // Deadline is overdue, and it has been more than $mininterval since last reminder. + if(($now > $task->deadline) && (($now - $task->lastreminder) > $overdueinterval)) { + // Deadline is overdue, and it has been more than $overdueinterval since last reminder. sendMail($task->id, false, false); - } elseif((($task->deadline - $now) > $maxinterval) && (($now - $task->lastreminder) > $maxinterval)) { + } elseif((($task->deadline - $now) > $maxinterval) && (($now - $task->lastreminder) > $maxinterval)) { // Deadline is a long way off, but it has been $maxinterval since last reminder. sendMail($task->id, false, false); - } elseif((($task->deadline - $now) > $mininterval) && (($now - $task->lastreminder) > $mininterval)) { + } elseif((($task->deadline - $now) > $mininterval) && (($now - $task->lastreminder) > $mininterval)) { // Deadline is near, and it has been $mininterval since last reminder. sendMail($task->id, false, false); } @@ -279,17 +289,16 @@ if($action == "add") { sendMail($task->id, true, false); } -echo $tasks->show(); ?> -
- Title:
- User: uid); ?>
- Deadline: D - M - Y
+ Title: - User: uid); ?> - Deadline: D + M + Y
Reassignable:
-
-
- +
+ +
+show(); +?> \ No newline at end of file -- cgit v1.2.3