From 60fd7ad6ce1c2fbd140edf1a6185649e47735bbc Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 1 Jun 2010 22:33:58 +0000 Subject: First pass at a loosely couple embed plugin using ECML. git-svn-id: http://code.elgg.org/elgg/trunk@6315 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/embed/embed.php | 62 ++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'mod/embed/embed.php') diff --git a/mod/embed/embed.php b/mod/embed/embed.php index 358547491..09b3ac29b 100644 --- a/mod/embed/embed.php +++ b/mod/embed/embed.php @@ -1,37 +1,35 @@ array('file')); +$internalname = get_input('internalname'); - 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, - )); +if (!isloggedin()) exit; + +global $SESSION; + +$offset = (int) get_input('offset',0); +$simpletype = get_input('simpletype'); +$entity_types = array('object' => array('file')); -?> \ No newline at end of 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, + )); -- cgit v1.2.3