From be2194481810530e6f2963435368e04ec5b98c0e Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 6 May 2017 00:23:31 -0600 Subject: [PATCH] Add pause, resume, and problem buttons --- action.php | 18 ++++++++++++++++-- lang/en_us.php | 2 ++ lib/gettasks.php | 34 ++++++++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/action.php b/action.php index 7204638..8eb6b57 100644 --- a/action.php +++ b/action.php @@ -72,6 +72,20 @@ switch ($VARS['action']) { } $database->update('assigned_tasks', ['#endtime' => 'NOW()', 'statusid' => 2], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]); break; + case "pause": + header('HTTP/1.0 204 No Content'); + if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) { + die('You are not assigned to this task!'); + } + $database->update('assigned_tasks', ['statusid' => 3], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]); + break; + case "problem": + header('HTTP/1.0 204 No Content'); + if (!$database->has('assigned_tasks', ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]])) { + die('You are not assigned to this task!'); + } + $database->update('assigned_tasks', ['statusid' => 4], ["AND" => ['taskid' => $VARS['taskid'], 'userid' => $_SESSION['uid']]]); + break; case "edittask": if (is_empty($VARS['tasktitle'])) { header('HTTP/1.0 204 No Content'); @@ -116,7 +130,7 @@ switch ($VARS['action']) { if (is_empty($VARS['taskid'])) { die('Missing taskid.'); } - + $managed_uids = getManagedUIDs($_SESSION['uid']); // There needs to be at least one entry otherwise the SQL query craps itself if (count($managed_uids) < 1) { @@ -139,7 +153,7 @@ switch ($VARS['action']) { header("Location: app.php?page=taskman&msg=task_delete_not_allowed"); die(lang("task delete not allowed", false)); } - + if ($VARS['assigned']) { $database->delete('assigned_tasks', ['taskid' => $VARS['taskid']]); } else { diff --git a/lang/en_us.php b/lang/en_us.php index bcfb503..ec7c044 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -46,6 +46,8 @@ define("STRINGS", [ "actions" => "Actions", "start" => "Start", "finish" => "Finish", + "pause" => "Pause", + "resume" => "Continue", "no description" => "No description.", "no assigned date" => "No assigned date", "no due date" => "No due date", diff --git a/lib/gettasks.php b/lib/gettasks.php index 674d289..73ff966 100644 --- a/lib/gettasks.php +++ b/lib/gettasks.php @@ -28,7 +28,15 @@ if (count($tasks) > 0) { - + + + + + @@ -39,12 +47,12 @@ if (count($tasks) > 0) {