aboutsummaryrefslogtreecommitdiff
path: root/mod/graphstats/views/default/graphs
diff options
context:
space:
mode:
Diffstat (limited to 'mod/graphstats/views/default/graphs')
-rw-r--r--mod/graphstats/views/default/graphs/data/timestats.php33
-rw-r--r--mod/graphstats/views/default/graphs/timeline.php44
-rw-r--r--mod/graphstats/views/default/graphs/timestats.php8
3 files changed, 85 insertions, 0 deletions
diff --git a/mod/graphstats/views/default/graphs/data/timestats.php b/mod/graphstats/views/default/graphs/data/timestats.php
new file mode 100644
index 000000000..6179301a9
--- /dev/null
+++ b/mod/graphstats/views/default/graphs/data/timestats.php
@@ -0,0 +1,33 @@
+<?php
+
+$type = $vars['type'];
+$subtype = $vars['subtype'];
+$relative = $vars['relative'];
+
+elgg_load_library('elgg:graphs:timestats');
+
+$timestats = timestats($type, $subtype, $relative);
+
+?>
+
+<table style="position: absolute; left: -9999em; top: -9999em;" id="data">
+ <tfoot>
+ <tr>
+ <?php
+ foreach ($timestats as $time => $stat) {
+ $date = date(elgg_echo('friendlytime:date_format'), $time);
+ echo "<th>$date</th>\n";
+ }
+ ?>
+ </tr>
+ </tfoot>
+ <tbody>
+ <tr>
+ <?php
+ foreach ($timestats as $time => $stat) {
+ echo "<td>$stat</td>\n";
+ }
+ ?>
+ </tr>
+ </tbody>
+</table>
diff --git a/mod/graphstats/views/default/graphs/timeline.php b/mod/graphstats/views/default/graphs/timeline.php
new file mode 100644
index 000000000..08d47581f
--- /dev/null
+++ b/mod/graphstats/views/default/graphs/timeline.php
@@ -0,0 +1,44 @@
+<?php
+
+$json_url = $vars['json_url'];
+if(empty($json_url)) return true;
+
+elgg_load_js('simile.timeline');
+
+?>
+<div id="group-timeline" style="height: 300px; border: 1px solid #aaa"></div>
+<script type="text/javascript">
+$(function(){
+ var eventSource = new Timeline.DefaultEventSource();
+ var bandInfos = [
+ Timeline.createBandInfo({
+ width: "80%",
+ intervalUnit: Timeline.DateTime.DAY,
+ intervalPixels: 200,
+ eventSource: eventSource,
+ }),
+ Timeline.createBandInfo({
+ width: "20%",
+ intervalUnit: Timeline.DateTime.MONTH,
+ intervalPixels: 200,
+ eventSource: eventSource,
+ overview: true,
+ })
+ ];
+ bandInfos[1].syncWith = 0;
+ bandInfos[1].highlight = true;
+ tl = Timeline.create(document.getElementById("group-timeline"), bandInfos);
+ tl.loadJSON("<?php echo $json_url; ?>", function(json, url) {
+ eventSource.loadJSON(json, url);
+ });
+
+ $().resize(function(){
+ if (resizeTimerID == null) {
+ resizeTimerID = window.setTimeout(function() {
+ resizeTimerID = null;
+ tl.layout();
+ }, 500);
+ }
+ });
+});
+</script>
diff --git a/mod/graphstats/views/default/graphs/timestats.php b/mod/graphstats/views/default/graphs/timestats.php
new file mode 100644
index 000000000..d200c9b94
--- /dev/null
+++ b/mod/graphstats/views/default/graphs/timestats.php
@@ -0,0 +1,8 @@
+<?php
+
+elgg_load_js('raphael');
+elgg_load_js('raphael.analytics');
+
+echo $vars['table'];
+?>
+<div id="holder"></div>