aboutsummaryrefslogtreecommitdiff
path: root/views/json/timeline/group.php
blob: 77655938b6491f15c6fb1cd180d87eea3edfe5ec (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
<?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);