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