aboutsummaryrefslogtreecommitdiff
path: root/views/default/tasks/tasklist_graph.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
commit228d3697bcd0218605be2e28131574cc85293a2e (patch)
tree6a59c627f6226bd2b3056b959acc9cc871eb1f8f /views/default/tasks/tasklist_graph.php
downloadelgg-228d3697bcd0218605be2e28131574cc85293a2e.tar.gz
elgg-228d3697bcd0218605be2e28131574cc85293a2e.tar.bz2
Squashed 'mod/tasks/' content from commit c9b1097
git-subtree-dir: mod/tasks git-subtree-split: c9b1097ce081d6893f9c939146208559c089dc15
Diffstat (limited to 'views/default/tasks/tasklist_graph.php')
-rw-r--r--views/default/tasks/tasklist_graph.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/views/default/tasks/tasklist_graph.php b/views/default/tasks/tasklist_graph.php
new file mode 100644
index 000000000..f46066a8a
--- /dev/null
+++ b/views/default/tasks/tasklist_graph.php
@@ -0,0 +1,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.'%'; ?>">&nbsp;</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>