mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-28 23:08:40 +00:00
php cs and stan fixes
This commit is contained in:
parent
a2cc609e7c
commit
16d3ac4d23
|
|
@ -328,7 +328,13 @@ final class TaskMapper extends DataMapperAbstract
|
|||
$sth = self::$db->con->prepare($query->toSql());
|
||||
$sth->execute();
|
||||
|
||||
$count = $sth->fetchAll()[0][0] ?? 0;
|
||||
$fetched = $sth->fetchAll();
|
||||
|
||||
if ($fetched === false) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$count = $fetched[0][0] ?? 0;
|
||||
} catch (\Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,13 @@ use phpOMS\Views\View;
|
|||
*/
|
||||
class ListView extends View
|
||||
{
|
||||
protected $tasks = [];
|
||||
/**
|
||||
* Tasks
|
||||
*
|
||||
* @var \Modules\Tasks\Models\Task[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected array $tasks = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
<?php
|
||||
use Modules\Tasks\Models\TaskStatus;
|
||||
use Modules\Tasks\Models\TaskPriority;
|
||||
?>
|
||||
<table class="default">
|
||||
<caption><?= $this->getHtml('Tasks', 'Tasks') ?><i class="fa fa-download floatRight download btn"></i></caption>
|
||||
<thead>
|
||||
|
|
@ -9,15 +13,15 @@
|
|||
<?php $c = 0; foreach ($this->tasks as $key => $task) : ++$c;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/prefix}task/single?{?}&id=' . $task->getId());
|
||||
$color = 'darkred';
|
||||
if ($task->getStatus() === \Modules\Tasks\Models\TaskStatus::DONE) { $color = 'green'; }
|
||||
elseif ($task->getStatus() === \Modules\Tasks\Models\TaskStatus::OPEN) { $color = 'darkblue'; }
|
||||
elseif ($task->getStatus() === \Modules\Tasks\Models\TaskStatus::WORKING) { $color = 'purple'; }
|
||||
elseif ($task->getStatus() === \Modules\Tasks\Models\TaskStatus::CANCELED) { $color = 'red'; }
|
||||
elseif ($task->getStatus() === \Modules\Tasks\Models\TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
|
||||
if ($task->getStatus() === TaskStatus::DONE) { $color = 'green'; }
|
||||
elseif ($task->getStatus() === TaskStatus::OPEN) { $color = 'darkblue'; }
|
||||
elseif ($task->getStatus() === TaskStatus::WORKING) { $color = 'purple'; }
|
||||
elseif ($task->getStatus() === TaskStatus::CANCELED) { $color = 'red'; }
|
||||
elseif ($task->getStatus() === TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('S' . $task->getStatus(), 'Tasks') ?></span></a>
|
||||
<td><a href="<?= $url; ?>">
|
||||
<?php if ($task->getPriority() === \Modules\Tasks\Models\TaskPriority::NONE) : ?>
|
||||
<?php if ($task->getPriority() === TaskPriority::NONE) : ?>
|
||||
<?= $this->printHtml($task->getDue()->format('Y-m-d H:i')); ?>
|
||||
<?php else : ?>
|
||||
<?= $this->getHtml('P' . $task->getPriority()); ?>
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ use phpOMS\Views\View;
|
|||
*/
|
||||
class TaskView extends View
|
||||
{
|
||||
protected $media = [];
|
||||
|
||||
/**
|
||||
* Get task status color.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user