aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Profitt <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 21:56:21 +0000
committerBrett Profitt <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-02 21:56:21 +0000
commit7da879661cccdeb708b13cfccf943bd50a7cbd65 (patch)
tree6ea576749e07916a0d86bc765acf07850f8b0ef4
parentdb58ab7e51e539ec3172762d5c781338d58ad4b8 (diff)
downloadelgg-7da879661cccdeb708b13cfccf943bd50a7cbd65.tar.gz
elgg-7da879661cccdeb708b13cfccf943bd50a7cbd65.tar.bz2
Videolist: Added support for embed and added icon overrides.
git-svn-id: http://code.elgg.org@6333 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--start.php70
-rw-r--r--views/default/icon/object/videolist/large.php11
-rw-r--r--views/default/icon/object/videolist/master.php11
-rw-r--r--views/default/icon/object/videolist/medium.php11
-rw-r--r--views/default/icon/object/videolist/small.php11
-rw-r--r--views/default/icon/object/videolist/tiny.php11
-rw-r--r--views/default/icon/object/videolist/topbar.php11
7 files changed, 133 insertions, 3 deletions
diff --git a/start.php b/start.php
index effe3c73d..bd772b067 100644
--- a/start.php
+++ b/start.php
@@ -40,8 +40,15 @@ function videolist_init() {
// Register entity type
register_entity_type('object','videolist');
-
+
register_plugin_hook('profile_menu', 'profile', 'videolist_profile_menu');
+
+ // register for embed
+ register_plugin_hook('embed_get_sections', 'all', 'videolist_embed_get_sections');
+ register_plugin_hook('embed_get_items', 'videolist', 'videolist_embed_get_items');
+
+ // override icons for ElggEntity::getIcon()
+ register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
}
/**
@@ -178,15 +185,72 @@ function videolist_object_notifications_intercept($hook, $entity_type, $returnva
function videolist_profile_menu($hook, $entity_type, $return_value, $params) {
global $CONFIG;
-
+
$return_value[] = array(
'text' => elgg_echo('videolist'),
'href' => "{$CONFIG->url}pg/videolist/owned/{$params['owner']->username}",
);
-
+
return $return_value;
}
+
+/**
+ * Register videolist as an embed type.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $type
+ * @param unknown_type $value
+ * @param unknown_type $params
+ */
+function videolist_embed_get_sections($hook, $type, $value, $params) {
+ $value['videolist'] = array(
+ 'name' => elgg_echo('videolist'),
+ 'layout' => 'list',
+ );
+
+ return $value;
+}
+
+/**
+ * Return a list of videos for embedding
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $type
+ * @param unknown_type $value
+ * @param unknown_type $params
+ */
+function videolist_embed_get_items($hook, $type, $value, $params) {
+ $options = array(
+ 'owner_guid' => get_loggedin_userid(),
+ 'type_subtype_pair' => array('object' => 'videolist'),
+ 'count' => TRUE
+ );
+
+ $count = elgg_get_entities($options);
+ $value['count'] += $count;
+
+ unset($options['count']);
+ $options['offset'] = $params['offset'];
+ $options['limit'] = $params['limit'];
+
+ $items = elgg_get_entities($options);
+
+ $value['items'] = array_merge($items, $value['items']);
+
+ return $value;
+}
+
+/**
+ * Returns the URL of the icon for $entity at $size.
+ *
+ * @param ElggEntity $entity
+ * @param string $size Not used yet. Not sure if possible.
+ */
+function videolist_get_entity_icon_url(ElggEntity $entity, $size = 'medium') {
+ return $entity->thumbnail;
+}
+
// Register a handler for adding videos
register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
diff --git a/views/default/icon/object/videolist/large.php b/views/default/icon/object/videolist/large.php
new file mode 100644
index 000000000..62815f7c4
--- /dev/null
+++ b/views/default/icon/object/videolist/large.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'large';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file
diff --git a/views/default/icon/object/videolist/master.php b/views/default/icon/object/videolist/master.php
new file mode 100644
index 000000000..65d0ea6e0
--- /dev/null
+++ b/views/default/icon/object/videolist/master.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'master';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file
diff --git a/views/default/icon/object/videolist/medium.php b/views/default/icon/object/videolist/medium.php
new file mode 100644
index 000000000..c2d85cf6e
--- /dev/null
+++ b/views/default/icon/object/videolist/medium.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'medium';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file
diff --git a/views/default/icon/object/videolist/small.php b/views/default/icon/object/videolist/small.php
new file mode 100644
index 000000000..34d08cd1e
--- /dev/null
+++ b/views/default/icon/object/videolist/small.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'small';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file
diff --git a/views/default/icon/object/videolist/tiny.php b/views/default/icon/object/videolist/tiny.php
new file mode 100644
index 000000000..2dce0f06d
--- /dev/null
+++ b/views/default/icon/object/videolist/tiny.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'tiny';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file
diff --git a/views/default/icon/object/videolist/topbar.php b/views/default/icon/object/videolist/topbar.php
new file mode 100644
index 000000000..82b38c0a0
--- /dev/null
+++ b/views/default/icon/object/videolist/topbar.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Display a video's icon.
+ */
+
+$entity = elgg_get_array_value('entity', $vars, NULL);
+$size = 'topbar';
+
+if ($entity) {
+ echo videolist_get_entity_icon_url($entity, $size);
+} \ No newline at end of file