aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'views/default')
-rw-r--r--views/default/annotation/generic_comment.php2
-rw-r--r--views/default/annotation/list.php46
-rw-r--r--views/default/layout/elements/comments.php (renamed from views/default/comments/list.php)0
-rw-r--r--views/default/layout/objects/list.php67
4 files changed, 68 insertions, 47 deletions
diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php
index 63633d3b5..c6fea8b41 100644
--- a/views/default/annotation/generic_comment.php
+++ b/views/default/annotation/generic_comment.php
@@ -53,7 +53,7 @@ if ($full_view) {
</p>
HTML;
- echo elgg_view_media($commenter_icon, $body, array('id' => "comment-$comment->id"));
+ echo elgg_view_media($commenter_icon, $body);
} else {
// brief view
diff --git a/views/default/annotation/list.php b/views/default/annotation/list.php
deleted file mode 100644
index f432ad640..000000000
--- a/views/default/annotation/list.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Annotation list
- *
- * @uses $vars['annotations']
- * @uses $vars['limit']
- * @uses $vars['offset']
- * @uses $vars['count']
- * @uses $vars['pagination']
- */
-
-$offset = $vars['offset'];
-$limit = $vars['limit'];
-$count = $vars['count'];
-$annotations = $vars['annotations'];
-$pagination = elgg_get_array_value('pagination', $vars, true);
-
-$html = "";
-$nav = "";
-
-if ($pagination) {
- $nav .= elgg_view('navigation/pagination', array(
- 'baseurl' => $_SERVER['REQUEST_URI'],
- 'offset' => $offset,
- 'count' => $count,
- 'limit' => $limit,
- 'word' => 'annoff',
- 'nonefound' => false,
- ));
-}
-
-if (is_array($annotations) && count($annotations) > 0) {
- $html .= '<ul class="elgg-annotation-list elgg-list">';
- foreach ($annotations as $annotation) {
- $html .= '<li>';
- $html .= elgg_view_annotation($annotation, true);
- $html .= '</li>';
- }
- $html .= '</ul>';
-}
-
-if ($count) {
- $html .= $nav;
-}
-
-echo $html;
diff --git a/views/default/comments/list.php b/views/default/layout/elements/comments.php
index 6dbe51483..6dbe51483 100644
--- a/views/default/comments/list.php
+++ b/views/default/layout/elements/comments.php
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;