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
65
|
<?php
elgg_load_library('elgg:tasks');
$entity = $vars['entity'];
$total = tasks_get_entities(array(
'list_guid' => $vars['entity']->guid,
'count' => true,
));
$closed = tasks_get_entities(array(
'list_guid' => $vars['entity']->guid,
'status' => 'closed',
'count' => true,
));
$total_link = $entity->getURL()."#all";
// Closed tasks aren't contabilized in graph.
$total -= $closed;
$done = tasks_get_entities(array(
'list_guid' => $vars['entity']->guid,
'status' => 'done',
'count' => true,
));
$remaining = $total - $done;
$remaining_link = $entity->getURL()."#remaining";
$assigned = tasks_get_entities(array(
'list_guid' => $vars['entity']->guid,
'status' => array('assigned', 'active'),
'count' => true,
));
$assigned_link = $entity->getURL()."#assigned";
$active = tasks_get_entities(array(
'list_guid' => $vars['entity']->guid,
'status' => 'active',
'count' => true,
));
$active_link = $entity->getURL()."#active";
if ($total == 0) {
$percent = 0;
} else {
$percent = $done / $total * 100;
}
?>
<div>
<div class="tasklist-graph">
<div style="width:<?php echo $percent.'%'; ?>"> </div>
</div>
<?php
echo '<a href="'.$total_link.'">' . elgg_echo('tasks:lists:graph:total', array($total)) . '</a>, ';
echo '<a href="'.$remaining_link.'">' . elgg_echo('tasks:lists:graph:remaining', array($remaining)) . '</a>, ';
echo '<a href="'.$assigned_link.'">' . elgg_echo('tasks:lists:graph:assigned', array($assigned)) . '</a>, ';
echo '<a href="'.$active_link.'">' . elgg_echo('tasks:lists:graph:active', array($active)) . '</a>';
?>
</div>
|