diff options
author | cash <cash.costello@gmail.com> | 2011-10-01 12:42:00 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2011-10-01 12:42:00 -0400 |
commit | c7b0817dabd1ea596086b03569d4480355e5f721 (patch) | |
tree | 41da241f906243771130b3df92ff4180f30ffeb8 /mod/embed/views/default/embed/list.php | |
parent | 7c52743cc264e258d55c42dccde021b1032f2358 (diff) | |
download | elgg-c7b0817dabd1ea596086b03569d4480355e5f721.tar.gz elgg-c7b0817dabd1ea596086b03569d4480355e5f721.tar.bz2 |
using the menu system for the embed tabs and adding a reusable select list view
Diffstat (limited to 'mod/embed/views/default/embed/list.php')
-rw-r--r-- | mod/embed/views/default/embed/list.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mod/embed/views/default/embed/list.php b/mod/embed/views/default/embed/list.php new file mode 100644 index 000000000..e36280e88 --- /dev/null +++ b/mod/embed/views/default/embed/list.php @@ -0,0 +1,61 @@ +<?php +/** + * View a list of embeddable items + * + * @package Elgg + * + * @uses $vars['items'] Array of ElggEntity objects + * @uses $vars['offset'] Index of the first list item in complete list + * @uses $vars['limit'] Number of items per page + * @uses $vars['count'] Number of items in the complete list + * + * @uses $vars['pagination'] Show pagination? (default: true) + * @uses $vars['position'] Position of the pagination: before, after, or both + * @uses $vars['full_view'] Show the full view of the items (default: false) + * @uses $vars['list_class'] Additional CSS class for the <ul> element + * @uses $vars['item_class'] Additional CSS class for the <li> elements + */ + +$items = $vars['items']; +$offset = $vars['offset']; +$limit = $vars['limit']; +$count = $vars['count']; + +$offset_key = elgg_extract('offset_key', $vars, 'offset'); + +$list_class = 'elgg-list'; +if (isset($vars['list_class'])) { + $list_class = "$list_class {$vars['list_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + +$html = ""; +$nav = ""; + +if ($count) { + $nav .= elgg_view('navigation/pagination', array( + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + 'offset_key' => $offset_key, + )); +} + +if (is_array($items) && count($items) > 0) { + $html .= "<ul class=\"$list_class\">"; + foreach ($items as $item) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + $html .= "<li id=\"$id\" class=\"$item_class\">"; + $html .= elgg_view('embed/item', array('entity' => $item)); + $html .= '</li>'; + } + $html .= '</ul>'; +} + +$html .= $nav; + +echo $html; |