Add task creator object

This commit is contained in:
Dennis Eichhorn 2017-07-21 20:24:37 +02:00
parent 5f279c7d7d
commit d2438372f5
6 changed files with 36 additions and 16 deletions

View File

@ -176,21 +176,21 @@ class Task implements \JsonSerializable
}
/**
* @return int
* @return mixed
*
* @since 1.0.0
*/
public function getCreatedBy() : int
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @param int $id
* @param mixed $id
*
* @since 1.0.0
*/
public function setCreatedBy(int $id)
public function setCreatedBy($id)
{
$this->createdBy = $id;
$this->schedule->setCreatedBy($id);

View File

@ -130,23 +130,23 @@ class TaskElement implements \JsonSerializable
}
/**
* @return int
* @return mixed
*
* @since 1.0.0
*/
public function getCreatedBy() : int
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @param int $creator
* @param mixed $creator
*
* @return void
*
* @since 1.0.0
*/
public function setCreatedBy(int $creator)
public function setCreatedBy($creator)
{
$this->createdBy = $creator;
@ -200,23 +200,23 @@ class TaskElement implements \JsonSerializable
}
/**
* @return int
* @return mixed
*
* @since 1.0.0
*/
public function getForwarded() : int
public function getForwarded()
{
return $this->forwarded;
}
/**
* @param int $forwarded
* @param mixed $forwarded
*
* @return void
*
* @since 1.0.0
*/
public function setForwarded(int $forwarded)
public function setForwarded($forwarded)
{
$this->forwarded = $forwarded;
}

View File

@ -15,6 +15,7 @@
declare(strict_types=1);
namespace Modules\Tasks\Models;
use Modules\Admin\Models\AccountMapper;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\RelationType;
@ -64,6 +65,17 @@ class TaskElementMapper extends DataMapperAbstract
],
];
protected static $belongsTo = [
'createdBy' => [
'mapper' => AccountMapper::class,
'src' => 'task_element_created_by',
],
'forwarded' => [
'mapper' => AccountMapper::class,
'src' => 'task_element_forwarded',
],
];
/**
* Primary table.
*

View File

@ -15,6 +15,7 @@
declare(strict_types=1);
namespace Modules\Tasks\Models;
use Modules\Admin\Models\AccountMapper;
use Modules\Calendar\Models\ScheduleMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Tasks\Models\TaskElementMapper;
@ -77,6 +78,13 @@ class TaskMapper extends DataMapperAbstract
],
];
protected static $belongsTo = [
'createdBy' => [
'mapper' => AccountMapper::class,
'src' => 'task_created_by',
],
];
/**
* Has one relation.
*

View File

@ -44,7 +44,7 @@ echo $this->getData('nav')->render(); ?>
<td><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getText('S' . $task->getStatus()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $task->getDue()->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $task->getTitle(); ?></a>
<td><a href="<?= $url; ?>"><?= $task->getCreatedBy(); ?></a>
<td><a href="<?= $url; ?>"><?= $task->getCreatedBy()->getName1(); ?></a>
<td><a href="<?= $url; ?>"><?= $task->getCreatedAt()->format('Y-m-d H:i'); ?></a>
<?php endforeach; if($c == 0) : ?>
<tr><td colspan="6" class="empty"><?= $this->getText('Empty', 0, 0); ?>

View File

@ -42,7 +42,7 @@ echo $this->getData('nav')->render(); ?>
</div>
<div class="inner">
<div class="pAlignTable">
<div class="vCenterTable wf-100">Created <?= $task->getCreatedBy(); ?></div>
<div class="vCenterTable wf-100">Created <?= $task->getCreatedBy()->getName1(); ?></div>
<span class="vCenterTable nobreak tag <?= $color; ?>"><?= $this->getText('S' . $task->getStatus()); ?></span>
</div>
</div>
@ -57,7 +57,7 @@ echo $this->getData('nav')->render(); ?>
elseif($element->getStatus() === \Modules\Tasks\Models\TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
<section class="box wf-100">
<div class="inner pAlignTable">
<div class="vCenterTable wf-100"><?= $element->getCreatedBy(); ?> - <?= $element->getCreatedAt()->format('Y-m-d H:i'); ?></div>
<div class="vCenterTable wf-100"><?= $element->getCreatedBy()->getName1(); ?> - <?= $element->getCreatedAt()->format('Y-m-d H:i'); ?></div>
<span class="vCenterTable tag <?= $color; ?>"><?= $this->getText('S' . $element->getStatus()); ?></span>
</div>
@ -71,7 +71,7 @@ echo $this->getData('nav')->render(); ?>
<div class="inner pAlignTable">
<?php if ($element->getForwarded() !== 0) : ?>
<div class="vCenterTable wf-100">Forwarded <?= $element->getForwarded(); ?></div>
<div class="vCenterTable wf-100">Forwarded <?= $element->getForwarded()->getName1(); ?></div>
<?php endif; ?>
<?php if ($element->getStatus() !== \Modules\Tasks\Models\TaskStatus::CANCELED ||
$element->getStatus() !== \Modules\Tasks\Models\TaskStatus::DONE ||