Add subtasks and comments history
This commit is contained in:
62
app/Event/CommentHistoryListener.php
Normal file
62
app/Event/CommentHistoryListener.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Event;
|
||||
|
||||
use Core\Listener;
|
||||
use Model\CommentHistory;
|
||||
|
||||
/**
|
||||
* Comment history listener
|
||||
*
|
||||
* @package event
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class CommentHistoryListener implements Listener
|
||||
{
|
||||
/**
|
||||
* Comment History model
|
||||
*
|
||||
* @accesss private
|
||||
* @var \Model\CommentHistory
|
||||
*/
|
||||
private $model;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param \Model\CommentHistory $model Comment History model instance
|
||||
*/
|
||||
public function __construct(CommentHistory $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the action
|
||||
*
|
||||
* @access public
|
||||
* @param array $data Event data dictionary
|
||||
* @return bool True if the action was executed or false when not executed
|
||||
*/
|
||||
public function execute(array $data)
|
||||
{
|
||||
$creator_id = $this->model->acl->getUserId();
|
||||
|
||||
if ($creator_id && isset($data['task_id']) && isset($data['id'])) {
|
||||
|
||||
$task = $this->model->task->getById($data['task_id']);
|
||||
|
||||
$this->model->create(
|
||||
$task['project_id'],
|
||||
$data['task_id'],
|
||||
$data['id'],
|
||||
$creator_id,
|
||||
$this->model->event->getLastTriggeredEvent(),
|
||||
$data['comment']
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
62
app/Event/SubtaskHistoryListener.php
Normal file
62
app/Event/SubtaskHistoryListener.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Event;
|
||||
|
||||
use Core\Listener;
|
||||
use Model\SubtaskHistory;
|
||||
|
||||
/**
|
||||
* Subtask history listener
|
||||
*
|
||||
* @package event
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class SubtaskHistoryListener implements Listener
|
||||
{
|
||||
/**
|
||||
* Comment History model
|
||||
*
|
||||
* @accesss private
|
||||
* @var \Model\SubtaskHistory
|
||||
*/
|
||||
private $model;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param \Model\SubtaskHistory $model Subtask History model instance
|
||||
*/
|
||||
public function __construct(SubtaskHistory $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the action
|
||||
*
|
||||
* @access public
|
||||
* @param array $data Event data dictionary
|
||||
* @return bool True if the action was executed or false when not executed
|
||||
*/
|
||||
public function execute(array $data)
|
||||
{
|
||||
$creator_id = $this->model->acl->getUserId();
|
||||
|
||||
if ($creator_id && isset($data['task_id']) && isset($data['id'])) {
|
||||
|
||||
$task = $this->model->task->getById($data['task_id']);
|
||||
|
||||
$this->model->create(
|
||||
$task['project_id'],
|
||||
$data['task_id'],
|
||||
$data['id'],
|
||||
$creator_id,
|
||||
$this->model->event->getLastTriggeredEvent(),
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ use Model\TaskHistory;
|
||||
class TaskHistoryListener implements Listener
|
||||
{
|
||||
/**
|
||||
* TaskHistory model
|
||||
* Task History model
|
||||
*
|
||||
* @accesss private
|
||||
* @var \Model\TaskHistory
|
||||
@@ -25,7 +25,7 @@ class TaskHistoryListener implements Listener
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param \Model\TaskHistory $model TaskHistory model instance
|
||||
* @param \Model\TaskHistory $model Task History model instance
|
||||
*/
|
||||
public function __construct(TaskHistory $model)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user