aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/embed.php
blob: 3585474919f3168a8bce829525030f6d29d9c1bf (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
<?php
// This page can only be run from within the Elgg framework
	if (!is_callable('elgg_view')) exit;
	
// Get the name of the form field we need to inject into
	$internalname = get_input('internalname');
	
	if (!isloggedin()) exit;
	
	global $SESSION;
	
	$offset = (int) get_input('offset',0);
	$simpletype = get_input('simpletype');
	$entity_types = array('object' => array('file'));

	if (empty($simpletype)) {
		$count = elgg_get_entities(array('type' => 'object', 'subtype' => 'file', 'owner_guid' => $SESSION['user']->guid, 'count' => TRUE));
		$entities = elgg_get_entities(array('type' => 'object', 'subtype' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset));
	} else {
		$count = elgg_get_entities_from_metadata(array('metadata_name' => 'simpletype', 'metadata_value' => $simpletype, 'types' => 'object', 'subtypes' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset, 'count' => TRUE));
		$entities = elgg_get_entities_from_metadata(array('metadata_name' => 'simpletype', 'metadata_value' => $simpletype, 'types' => 'object', 'subtypes' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset));
	}
	
	$types = get_tags(0,10,'simpletype','object','file',$SESSION['user']->guid);
	
// Echo the embed view
	echo elgg_view('embed/media', array(
						'entities' => $entities,
						'internalname' => $internalname,
						'offset' => $offset,
						'count' => $count,
						'simpletype' => $simpletype,
						'limit' => 6,
						'simpletypes' => $types,
				   ));

?>