diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 02:37:26 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 02:37:26 +0000 |
commit | 15eaacc12ad0ffe19d42b6d2508c4469ba005bfd (patch) | |
tree | 0efa084b8a015bbc36eb25d8d5a017e7786b5a3c /views/default/layout | |
parent | d7adaddab7189bc493d22d96fec424aedca09b11 (diff) | |
download | elgg-15eaacc12ad0ffe19d42b6d2508c4469ba005bfd.tar.gz elgg-15eaacc12ad0ffe19d42b6d2508c4469ba005bfd.tar.bz2 |
Fixes #2189 created the object/list view with semantic markup
git-svn-id: http://code.elgg.org/elgg/trunk@7560 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/layout')
-rw-r--r-- | views/default/layout/elements/comments.php | 20 | ||||
-rw-r--r-- | views/default/layout/objects/list.php | 67 |
2 files changed, 87 insertions, 0 deletions
diff --git a/views/default/layout/elements/comments.php b/views/default/layout/elements/comments.php new file mode 100644 index 000000000..6dbe51483 --- /dev/null +++ b/views/default/layout/elements/comments.php @@ -0,0 +1,20 @@ +<?php +/** + * List comments with optional add form + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['show_add_form'] Display add form or not + */ + +$show_add_form = elgg_get_array_value('show_add_form', $vars, true); + +echo '<div class="elgg-comments">'; + +echo list_annotations($vars['entity']->getGUID(), 'generic_comment'); + +if ($show_add_form) { + $form_vars = array('name' => 'elgg_add_comment'); + echo elgg_view_form('comments/add', $form_vars, $vars); +} + +echo '</div>'; diff --git a/views/default/layout/objects/list.php b/views/default/layout/objects/list.php new file mode 100644 index 000000000..b65e79102 --- /dev/null +++ b/views/default/layout/objects/list.php @@ -0,0 +1,67 @@ +<?php +/** + * View a list of items + * + * @package Elgg + * + * @uses $vars['items'] Array of ElggEntity or ElggAnnotation 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['base_url'] Base URL of list (optional) + * @uses $vars['pagination'] Show pagination? (default: true) + * @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']; +$base_url = $vars['base_url']; +$pagination = elgg_get_array_value('pagination', $vars, true); +$full_view = elgg_get_array_value('full_view', $vars, false); + +$list_class = 'elgg-list'; +if (isset($vars['list_class'])) { + $list_class = "{$vars['list_class']} $list_class"; +} + +$item_class = 'elgg-list-item'; +if (isset($vars['item_class'])) { + $item_class = "{$vars['item_class']} $item_class"; +} + +$html = ""; +$nav = ""; + +if ($pagination) { + $nav .= elgg_view('navigation/pagination', array( + 'baseurl' => $base_url, + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + )); +} + +if (is_array($items) && count($items) > 0) { + $html .= "<ul class=\"$list_class\">"; + foreach ($items as $item) { + if (elgg_instanceof($item)) { + $id = "item-{$item->getGUID()}"; + } else { + $id = "item-{$item->id}"; + } + $html .= "<li id=\"$id\" class=\"$item_class\">"; + $html .= elgg_view_list_item($item, $full_view); + $html .= '</li>'; + } + $html .= '</ul>'; +} + +if ($count) { + $html .= $nav; +} + +echo $html; |