aboutsummaryrefslogtreecommitdiff
path: root/views/default/graphs/timeline.php
blob: 08d47581fe8dfe9f33b6a0f7fde946c922fa55e2 (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
<?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>