diff options
Diffstat (limited to 'mod/graphstats/views')
9 files changed, 216 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> diff --git a/mod/graphstats/views/default/graphstats/timestats_filter_menu.php b/mod/graphstats/views/default/graphstats/timestats_filter_menu.php new file mode 100644 index 000000000..9f4ab55d1 --- /dev/null +++ b/mod/graphstats/views/default/graphstats/timestats_filter_menu.php @@ -0,0 +1,31 @@ +<?php +/** + * All groups listing page navigation + * + */ + +$tabs = array( + 'absolute' => array( + 'text' => elgg_echo('absolute'), + 'href' => 'graphs/timestats?filter=absolute', + 'priority' => 200, + ), + 'relative' => array( + 'text' => elgg_echo('relative'), + 'href' => 'graphs/timestats?filter=relative', + 'priority' => 300, + ), +); + +// sets default selected item +if (strpos(full_url(), 'filter') === false) { + $tabs['absolute']['selected'] = true; +} + +foreach ($tabs as $name => $tab) { + $tab['name'] = $name; + + elgg_register_menu_item('filter', $tab); +} + +echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); diff --git a/mod/graphstats/views/default/groups/profile/activity_module.php b/mod/graphstats/views/default/groups/profile/activity_module.php new file mode 100644 index 000000000..7829f8c70 --- /dev/null +++ b/mod/graphstats/views/default/groups/profile/activity_module.php @@ -0,0 +1,49 @@ +<?php +/** + * Groups latest activity + * + * @todo add people joining group to activity + * + * @package Groups + */ + +if ($vars['entity']->activity_enable == 'no') { + return true; +} + +$group = $vars['entity']; +if (!$group) { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "groups/activity/$group->guid", + 'text' => elgg_echo('link:view:all'), +)); + +$add_link = ' '.elgg_view('output/url', array( + 'href' => "graphs/group/$group->guid", + 'text' => elgg_echo('timeline'), +)); + + +elgg_push_context('widgets'); +$db_prefix = elgg_get_config('dbprefix'); +$content = elgg_list_river(array( + 'limit' => 4, + 'pagination' => false, + 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), + 'wheres' => array("(e1.container_guid = $group->guid)"), +)); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('groups:activity:none') . '</p>'; +} + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('groups:activity'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $add_link, +)); diff --git a/mod/graphstats/views/default/js/raphael/analytics.php b/mod/graphstats/views/default/js/raphael/analytics.php new file mode 100644 index 000000000..e8703b100 --- /dev/null +++ b/mod/graphstats/views/default/js/raphael/analytics.php @@ -0,0 +1,5 @@ +<?php + +include(elgg_get_plugins_path() . 'graphstats/vendors/raphaeljs/popup.js'); +include(elgg_get_plugins_path() . 'graphstats/vendors/raphaeljs/analytics.js'); + diff --git a/mod/graphstats/views/default/js/raphael/raphael.php b/mod/graphstats/views/default/js/raphael/raphael.php new file mode 100644 index 000000000..4ce441133 --- /dev/null +++ b/mod/graphstats/views/default/js/raphael/raphael.php @@ -0,0 +1,3 @@ +<?php + +include(elgg_get_plugins_path() . 'graphstats/vendors/raphaeljs/raphael.js'); diff --git a/mod/graphstats/views/default/js/timeline.php b/mod/graphstats/views/default/js/timeline.php new file mode 100644 index 000000000..eae9c24ba --- /dev/null +++ b/mod/graphstats/views/default/js/timeline.php @@ -0,0 +1,8 @@ +<?php +$timeline_base = elgg_get_site_url() . 'mod/graphstats/vendors/simile-timeline'; + +echo "Timeline_ajax_url='$timeline_base/timeline_ajax/simile-ajax-api.js';"; +echo "Timeline_urlPrefix='$timeline_base/timeline_js/';"; +echo "Timeline_parameters='bundle=true';"; + +include(elgg_get_plugins_path() . 'graphstats/vendors/simile-timeline/timeline_js/timeline-api.js'); diff --git a/mod/graphstats/views/json/timeline/group.php b/mod/graphstats/views/json/timeline/group.php new file mode 100644 index 000000000..77655938b --- /dev/null +++ b/mod/graphstats/views/json/timeline/group.php @@ -0,0 +1,35 @@ +<?php + +$group_guid = sanitize_int(get_input('group_guid')); + +$entities = elgg_get_entities(array('container_guid'=>$group_guid, 'limit'=>0, 'type'=>'object')); +$events = array(); + +$db_prefix = elgg_get_config('dbprefix'); +$river = elgg_get_river(array( + 'limit' => 0, + 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), + 'wheres' => array("(e1.container_guid = $group_guid)"), +)); + +foreach($river as $item){ + $subject = $item->getSubjectEntity(); + $object = $item->getObjectEntity(); + + array_push($events, array( + 'start' => date('c', $item->posted), + 'icon'=> $icon, + 'title' => $object->title, + 'classname' => 'hot_event', + 'description' => elgg_get_excerpt($object->description), + 'durationEvent' => false, + )); + +} + +$data = array( + 'dateTimeFormat'=>'iso8601', + 'events'=>$events, +); + +echo json_encode($data); |