Add pause, resume, and problem buttons
This commit is contained in:
parent
2e8def0dda
commit
be21944818
18
action.php
18
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 {
|
||||
|
@ -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",
|
||||
|
@ -28,7 +28,15 @@ if (count($tasks) > 0) {
|
||||
<?php
|
||||
if ($task['statusid'] == 1) {
|
||||
?>
|
||||
<span class='pull-right'><i class='fa fa-play'></i> <?php lang("started") ?></span>
|
||||
<span class='pull-right'><i class='fa fa-fw fa-play'></i> <?php lang("started") ?></span>
|
||||
<?php
|
||||
} else if ($task['statusid'] == 3) {
|
||||
?>
|
||||
<span class='pull-right'><i class='fa fa-fw fa-pause'></i> <?php lang("paused") ?></span>
|
||||
<?php
|
||||
} else if ($task['statusid'] == 4) {
|
||||
?>
|
||||
<span class='pull-right'><i class='fa fa-fw fa-exclamation'></i> <?php lang("problem") ?></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -39,12 +47,12 @@ if (count($tasks) > 0) {
|
||||
</div>
|
||||
<div class='panel-footer'>
|
||||
<div class='row'>
|
||||
<div class='col-xs-12 col-sm-6 col-md-6'>
|
||||
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-5'>
|
||||
<i class='fa fa-clock-o'></i> <?php lang2("assigned on", ["date" => date("F j, Y, g:i a", strtotime($task['taskassignedon']))]) ?>
|
||||
<br />
|
||||
<i class='fa fa-clock-o'></i> <?php lang2("due by", ["date" => ($task['taskdueby'] > 0 ? date("F j, Y, g:i a", strtotime($task['taskdueby'])) : "No due date")]) ?>
|
||||
</div>
|
||||
<div class='col-xs-12 col-sm-6 col-md-6'>
|
||||
<div class='col-xs-12 col-sm-6 col-md-6 col-lg-7'>
|
||||
<?php lang("actions") ?>:<br />
|
||||
<?php
|
||||
if ($task['statusid'] == 0) {
|
||||
@ -52,7 +60,7 @@ if (count($tasks) > 0) {
|
||||
<form action='action.php' method='POST' onsubmit='$("#starttaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block;'>
|
||||
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
||||
<input type='hidden' name='action' value='start' />
|
||||
<button type='submit' id='starttaskbtn<?php echo $task['taskid'] ?>' class='btn btn-primary'><i class='fa fa-play'></i> <?php lang("start") ?></button>
|
||||
<button type='submit' id='starttaskbtn<?php echo $task['taskid'] ?>' class='btn btn-primary'><i class='fa fa-fw fa-play'></i> <?php lang("start") ?></button>
|
||||
</form>
|
||||
<?php
|
||||
} else if ($task['statusid'] == 1) {
|
||||
@ -62,6 +70,24 @@ if (count($tasks) > 0) {
|
||||
<input type='hidden' name='action' value='finish' />
|
||||
<button type='submit' id='finishtaskbtn<?php echo $task['taskid'] ?>' class='btn btn-success'><i class='fa fa-stop'></i> <?php lang("finish") ?></button>
|
||||
</form>
|
||||
<form action='action.php' method='POST' onsubmit='$("#pausetaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block; padding-left: 5px;'>
|
||||
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
||||
<input type='hidden' name='action' value='pause' />
|
||||
<button type='submit' id='pausetaskbtn<?php echo $task['taskid'] ?>' class='btn btn-warning'><i class='fa fa-pause'></i> <?php lang("pause") ?></button>
|
||||
</form>
|
||||
<form action='action.php' method='POST' onsubmit='$("#problemtaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block; padding-left: 5px;'>
|
||||
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
||||
<input type='hidden' name='action' value='problem' />
|
||||
<button type='submit' id='problemtaskbtn<?php echo $task['taskid'] ?>' class='btn btn-danger'><i class='fa fa-exclamation'></i> <?php lang("problem") ?></button>
|
||||
</form>
|
||||
<?php
|
||||
} else if ($task['statusid'] == 3 || $task['statusid'] == 4) {
|
||||
?>
|
||||
<form action='action.php' method='POST' onsubmit='$("#starttaskbtn<?php echo $task['taskid'] ?>").prop("disabled", true); refreshTasksSoon();' class='form-inline' style='display: inline-block;'>
|
||||
<input type='hidden' name='taskid' value='<?php echo $task['taskid'] ?>' />
|
||||
<input type='hidden' name='action' value='start' />
|
||||
<button type='submit' id='starttaskbtn<?php echo $task['taskid'] ?>' class='btn btn-primary'><i class='fa fa-play'></i> <?php lang("resume") ?></button>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user