summaryrefslogtreecommitdiff
path: root/forum/utils
diff options
context:
space:
mode:
authordeva <deva>2010-07-09 11:16:04 +0000
committerdeva <deva>2010-07-09 11:16:04 +0000
commitc2855691229eb3f2005cbf68982461bf777dac57 (patch)
tree5726f7eb8ef34229ba1be03f1aa5053784103faf /forum/utils
parentafc66efe4710b64fb8901f7a41cd9f9285065c91 (diff)
Fixed time calc bug. Minor 'GUI' tweaks.
Diffstat (limited to 'forum/utils')
-rw-r--r--forum/utils/tasks.php45
1 files changed, 27 insertions, 18 deletions
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 @@
-<?php
+<?php /* -*- mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
include_once($UTIL_DIR . "/error.php");
include_once($UTIL_DIR . "/notify.php");
@@ -64,7 +64,9 @@ class Task {
else $str .= " <td>Done ☐</td>\n";
}
$str .= " <td><strong>".$this->title."</strong></td>\n";
- $str .= " <td>".substr($this->description, 0, 64)."</td>\n";
+ if(strlen($this->description) > 64)
+ $str .= " <td>".substr($this->description, 0, 64)."...</td>\n";
+ else $str .= " <td>".$this->description."</td>\n";
if($this->reassignable && $this->userid == $current_user->uid) {
$str .= " <td>".userList($this->userid)."</td>\n";
@@ -120,6 +122,10 @@ class Tasks {
}
}
+ $str .= "</table>\n";
+ $str .= "<hr/>\n";
+ $str .= "<table>\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();
?>
-<hr/>
<form method="post" enctype="multipart/form-data" action="?mode=tasks&amp;action=add">
- Title: <input name="title" value=""><br/>
- User: <?php echo userList($current_user->uid); ?><br/>
- Deadline: D<input name="deadline_day" style="width: 2em" value="">
- M<input name="deadline_month" style="width: 2em" value="">
- Y<input name="deadline_year" style="width: 4em" value=""><br/>
+ Title: <input name="title" value=""> - User: <?php echo userList($current_user->uid); ?> - Deadline: D<input placeholder="day" name="deadline_day" style="width: 2em" value="">
+ M<input placeholder="month" name="deadline_month" style="width: 2em" value="">
+ Y<input placeholder="year" name="deadline_year" style="width: 4em" value=""><br/>
Reassignable: <input name="reassignable" type="checkbox" checked><br/>
- <textarea name="description" cols="60" rows="2"></textarea><br/>
- <br/>
- <button type="submit">Add</button>
+ <textarea name="description" cols="80" rows="2"></textarea><br/>
+ <button style="width: 120px" type="submit">Add Task</button>
</form>
+<hr/>
+<?php
+echo $tasks->show();
+?> \ No newline at end of file