blob: 13bdb07a75d14607fc28904da9c63154c64029b0 (
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
62
63
64
|
<?php
namespace Helper;
/**
* Task helpers
*
* @package helper
* @author Frederic Guillot
*/
class Task extends \Core\Base
{
/**
* Get the age of an item in quasi human readable format.
* It's in this format: <1h , NNh, NNd
*
* @access public
* @param integer $timestamp Unix timestamp of the artifact for which age will be calculated
* @param integer $now Compare with this timestamp (Default value is the current unix timestamp)
* @return string
*/
public function age($timestamp, $now = null)
{
if ($now === null) {
$now = time();
}
$diff = $now - $timestamp;
if ($diff < 3600) {
return t('<1h');
}
else if ($diff < 86400) {
return t('%dh', $diff / 3600);
}
return t('%dd', ($now - $timestamp) / 86400);
}
public function getColors()
{
return $this->color->getList();
}
public function recurrenceTriggers()
{
return $this->task->getRecurrenceTriggerList();
}
public function recurrenceTimeframes()
{
return $this->task->getRecurrenceTimeframeList();
}
public function recurrenceBasedates()
{
return $this->task->getRecurrenceBasedateList();
}
public function canRemove(array $task)
{
return $this->taskPermission->canRemoveTask($task);
}
}
|