From e7d8b73c0e65f188b835bbb0a7e98eb2fa0f3478 Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 19 Nov 2011 22:37:34 +0100 Subject: Added videos widget. --- start.php | 3 +++ views/default/widgets/videolist/content.php | 32 +++++++++++++++++++++++++++++ views/default/widgets/videolist/edit.php | 24 ++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 views/default/widgets/videolist/content.php create mode 100644 views/default/widgets/videolist/edit.php diff --git a/start.php b/start.php index d06268fd8..cdbce6270 100644 --- a/start.php +++ b/start.php @@ -37,6 +37,9 @@ function videolist_init() { // extend group main page elgg_extend_view('groups/tool_latest', 'videolist/group_module'); + + //add a widget + elgg_register_widget_type('videolist', elgg_echo('videolist'), elgg_echo('videolist:widget:description')); if (is_callable('register_notification_object')) { register_notification_object('object', 'videolist_item', elgg_echo('videolist:new')); diff --git a/views/default/widgets/videolist/content.php b/views/default/widgets/videolist/content.php new file mode 100644 index 000000000..2b8de92bf --- /dev/null +++ b/views/default/widgets/videolist/content.php @@ -0,0 +1,32 @@ +videos_num; + +$options = array( + 'type' => 'object', + 'subtype' => 'videolist_item', + 'container_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities($options); + +echo $content; + +if ($content) { + $url = "pages/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('videolist_item:more'), + 'is_trusted' => true, + )); + echo "$more_link"; +} else { + echo elgg_echo('videolist_item:none'); +} diff --git a/views/default/widgets/videolist/edit.php b/views/default/widgets/videolist/edit.php new file mode 100644 index 000000000..a2865848e --- /dev/null +++ b/views/default/widgets/videolist/edit.php @@ -0,0 +1,24 @@ +videos_num)) { + $vars['entity']->videos_num = 4; +} + +$params = array( + 'name' => 'params[videos_num]', + 'value' => $vars['entity']->videos_num, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +
+ : + +
-- cgit v1.2.3