blob: 75efe65d6eb764cffe22c4f24b7be18d791b95bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?php
namespace Event;
/**
* Project activity listener
*
* @package event
* @author Frederic Guillot
*/
class ProjectActivityListener extends Base
{
/**
* 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)
{
if (isset($data['task_id'])) {
$values = $this->getValues($data);
return $this->projectActivity->createEvent(
$values['task']['project_id'],
$values['task']['id'],
$this->acl->getUserId(),
$this->container['event']->getLastTriggeredEvent(),
$values
);
}
return false;
}
/**
* Get event activity data
*
* @access private
* @param array $data Event data dictionary
* @return array
*/
private function getValues(array $data)
{
$values = array();
$values['task'] = $this->taskFinder->getDetails($data['task_id']);
switch ($this->getEventNamespace()) {
case 'subtask':
$values['subtask'] = $this->subTask->getById($data['id'], true);
break;
case 'comment':
$values['comment'] = $this->comment->getById($data['id']);
break;
}
return $values;
}
}
|