diff options
-rw-r--r-- | engine/lib/views.php | 10 | ||||
-rw-r--r-- | views/default/entities/list.php | 63 | ||||
-rw-r--r-- | views/default/entities/list_item.php | 19 |
3 files changed, 87 insertions, 5 deletions
diff --git a/engine/lib/views.php b/engine/lib/views.php index 73a12cc8d..ccba3d173 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -840,8 +840,8 @@ function elgg_view_annotation(ElggAnnotation $annotation, $bypass = true, $debug * @return string The list of entities * @access private */ -function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, -$listtypetoggle = true, $pagination = true) { +function elgg_view_entity_list($entities, $count, $offset, $limit, $full_view = true, +$list_type_toggle = true, $pagination = true) { $count = (int) $count; $limit = (int) $limit; @@ -853,15 +853,15 @@ $listtypetoggle = true, $pagination = true) { $context = elgg_get_context(); - $html = elgg_view('entities/entity_list', array( + $html = elgg_view('entities/list', array( 'entities' => $entities, 'count' => $count, 'offset' => $offset, 'limit' => $limit, 'baseurl' => $_SERVER['REQUEST_URI'], - 'fullview' => $fullview, + 'fullview' => $full_view, 'context' => $context, - 'listtypetoggle' => $listtypetoggle, + 'listtypetoggle' => $list_type_toggle, 'listtype' => get_input('listtype', 'list'), 'pagination' => $pagination )); diff --git a/views/default/entities/list.php b/views/default/entities/list.php new file mode 100644 index 000000000..d35c66500 --- /dev/null +++ b/views/default/entities/list.php @@ -0,0 +1,63 @@ +<?php +/** + * View a list of entities + * + * @package Elgg + * + */ + +$context = $vars['context']; +$offset = $vars['offset']; +$entities = $vars['entities']; +$limit = $vars['limit']; +$count = $vars['count']; +$base_url = $vars['baseurl']; +$context = $vars['context']; +$list_type = $vars['listtype']; +$pagination = $vars['pagination']; +$full_view = $vars['fullview']; + +$html = ""; +$nav = ""; + +$list_type_toggle = elgg_get_array_value('listtypetoggle', $vars, true); + +if ($context == "search" && $count > 0 && $list_type_toggle) { + $nav .= elgg_view('navigation/listtype', array( + 'baseurl' => $base_url, + 'offset' => $offset, + 'count' => $count, + 'listtype' => $list_type, + )); +} + +if ($pagination) { + $nav .= elgg_view('navigation/pagination', array( + 'baseurl' => $base_url, + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + )); +} + +if ($list_type == 'list') { + if (is_array($entities) && sizeof($entities) > 0) { + $html .= '<ul class="elgg-entity-list">'; + foreach ($entities as $entity) { + $html .= '<li>'; + $html .= elgg_view_entity($entity, $full_view); + $html .= '</li>'; + } + $html .= '</ul>'; + } +} else { + if (is_array($entities) && sizeof($entities) > 0) { + $html .= elgg_view('entities/gallery', array('entities' => $entities)); + } +} + +if ($count) { + $html .= $nav; +} + +echo $html; diff --git a/views/default/entities/list_item.php b/views/default/entities/list_item.php new file mode 100644 index 000000000..4b6636db7 --- /dev/null +++ b/views/default/entities/list_item.php @@ -0,0 +1,19 @@ +<?php +/** + * Generic display for a single entity in list view. + * + * @package Elgg + * @subpackage Core + * + * @uses string $vars['icon'] Full icon HTML to display. + * @uses string $vars['info'] Info about the entity. + */ +?> +<div class="listing entity-listing"> + <div class="icon"> + <?php echo $vars['icon']; ?> + </div> + <div class="info"> + <?php echo $vars['info']; ?> + </div> +</div> |