diff options
Diffstat (limited to 'views/default/page/components')
| -rw-r--r-- | views/default/page/components/gallery.php | 66 | ||||
| -rw-r--r-- | views/default/page/components/list.php | 34 | ||||
| -rw-r--r-- | views/default/page/components/list/body.php | 53 | ||||
| -rw-r--r-- | views/default/page/components/module.php | 18 | ||||
| -rw-r--r-- | views/default/page/components/summary.php | 4 |
5 files changed, 62 insertions, 113 deletions
diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php index f57cc99ba..e8b3f477e 100644 --- a/views/default/page/components/gallery.php +++ b/views/default/page/components/gallery.php @@ -2,13 +2,21 @@ /** * Gallery view * - * @uses $vars['items'] + * Implemented as an unorder list * - * @todo not complete - number of columns + * @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['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['gallery_class'] Additional CSS class for the <ul> element + * @uses $vars['item_class'] Additional CSS class for the <li> elements */ $items = $vars['items']; -if (!is_array($items) && sizeof($items) == 0) { +if (!is_array($items) || sizeof($items) == 0) { return true; } @@ -18,13 +26,20 @@ $offset = $vars['offset']; $limit = $vars['limit']; $count = $vars['count']; $pagination = elgg_extract('pagination', $vars, true); -$full_view = elgg_extract('full_view', $vars, false); $offset_key = elgg_extract('offset_key', $vars, 'offset'); $position = elgg_extract('position', $vars, 'after'); -$num_columns = 4; +$gallery_class = 'elgg-gallery'; +if (isset($vars['gallery_class'])) { + $gallery_class = "$gallery_class {$vars['gallery_class']}"; +} +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} +$nav = ''; if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( 'offset' => $offset, @@ -39,33 +54,20 @@ if ($position == 'before' || $position == 'both') { } ?> -<table class="elgg-gallery"> -<?php - -$col = 0; -foreach ($items as $item) { - if ($col == 0) { - echo '<tr>'; - } - $col++; - - echo '<td>'; - echo elgg_view_list_item($item, $full_view, $vars); - echo "</td>"; - - if ($col == $num_columns) { - echo '</tr>'; - $col = 0; - } -} - -if ($col > 0) { - echo '</tr>'; -} - -?> - -</table> +<ul class="<?php echo $gallery_class; ?>"> + <?php + foreach ($items as $item) { + if (elgg_instanceof($item)) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + } else { + $id = "item-{$item->getType()}-{$item->id}"; + } + echo "<li id=\"$id\" class=\"$item_class\">"; + echo elgg_view_list_item($item, $vars); + echo "</li>"; + } + ?> +</ul> <?php if ($position == 'after' || $position == 'both') { diff --git a/views/default/page/components/list.php b/views/default/page/components/list.php index 374922ecd..28ed58ddf 100644 --- a/views/default/page/components/list.php +++ b/views/default/page/components/list.php @@ -6,7 +6,7 @@ * * @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['limit'] Number of items per page. Only used as input to pagination. * @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) @@ -17,23 +17,22 @@ */ $items = $vars['items']; -$offset = $vars['offset']; -$limit = $vars['limit']; -$count = $vars['count']; -$base_url = $vars['base_url']; +$offset = elgg_extract('offset', $vars); +$limit = elgg_extract('limit', $vars); +$count = elgg_extract('count', $vars); +$base_url = elgg_extract('base_url', $vars, ''); $pagination = elgg_extract('pagination', $vars, true); -$full_view = elgg_extract('full_view', $vars, false); $offset_key = elgg_extract('offset_key', $vars, 'offset'); $position = elgg_extract('position', $vars, 'after'); $list_class = 'elgg-list'; if (isset($vars['list_class'])) { - $list_class = "{$vars['list_class']} $list_class"; + $list_class = "$list_class {$vars['list_class']}"; } -$item_class = 'elgg-list-item'; +$item_class = 'elgg-item'; if (isset($vars['item_class'])) { - $item_class = "{$vars['item_class']} $item_class"; + $item_class = "$item_class {$vars['item_class']}"; } $html = ""; @@ -41,7 +40,7 @@ $nav = ""; if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( - 'baseurl' => $base_url, + 'base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, @@ -52,14 +51,15 @@ if ($pagination && $count) { if (is_array($items) && count($items) > 0) { $html .= "<ul class=\"$list_class\">"; foreach ($items as $item) { - if (elgg_instanceof($item)) { - $id = "elgg-{$item->getType()}-{$item->getGUID()}"; - } else { - $id = "item-{$item->getType()}-{$item->id}"; + $li = elgg_view_list_item($item, $vars); + if ($li) { + if (elgg_instanceof($item)) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + } else { + $id = "item-{$item->getType()}-{$item->id}"; + } + $html .= "<li id=\"$id\" class=\"$item_class\">$li</li>"; } - $html .= "<li id=\"$id\" class=\"$item_class\">"; - $html .= elgg_view_list_item($item, $full_view, $vars); - $html .= '</li>'; } $html .= '</ul>'; } diff --git a/views/default/page/components/list/body.php b/views/default/page/components/list/body.php deleted file mode 100644 index 578e9b9cf..000000000 --- a/views/default/page/components/list/body.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * List body - * - * Sample output - * <ul class="elgg-menu elgg-menu-metadata"><li>Public</li><li>Like this</li></ul> - * <h3><a href="">Title</a></h3> - * <p class="elgg-subtext">Posted 3 hours ago by George</p> - * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p> - * <div class="elgg-list-content">Excerpt text</div> - * - * @uses $vars['entity'] ElggEntity - * @uses $vars['title'] Title link (optional) false = no title, '' = default - * @uses $vars['metadata'] HTML for entity metadata and actions (optional) - * @uses $vars['subtitle'] HTML for the subtitle (optional) - * @uses $vars['tags'] HTML for the tags (optional) - * @uses $vars['content'] HTML for the entity content (optional) - */ - -$entity = $vars['entity']; - -$title_link = elgg_extract('title', $vars, ''); -if ($title_link === '') { - if (isset($entity->title)) { - $text = $entity->title; - } else { - $text = $entity->name; - } - $params = array( - 'text' => $text, - 'href' => $entity->getURL(), - ); - $title_link = elgg_view('output/url', $params); -} - -$metadata = elgg_extract('metadata', $vars, ''); -$subtitle = elgg_extract('subtitle', $vars, ''); -$content = elgg_extract('content', $vars, ''); - -$tags = elgg_extract('tags', $vars, ''); -if ($tags !== false) { - $tags = elgg_view('output/tags', array('tags' => $entity->tags)); -} - -if ($metadata) { - echo $metadata; -} -echo "<h3>$title_link</h3>"; -echo "<div class=\"elgg-subtext\">$subtitle</div>"; -echo $tags; -if ($content) { - echo "<div class=\"elgg-list-content\">$content</div>"; -} diff --git a/views/default/page/components/module.php b/views/default/page/components/module.php index f7b9da59c..7e1eaff20 100644 --- a/views/default/page/components/module.php +++ b/views/default/page/components/module.php @@ -2,10 +2,10 @@ /** * Elgg module element * - * @uses $vars['title'] Title text - * @uses $vars['header'] HTML content of the header + * @uses $vars['title'] Optional title text (do not pass header with this option) + * @uses $vars['header'] Optional HTML content of the header * @uses $vars['body'] HTML content of the body - * @uses $vars['footer'] HTML content of the footer + * @uses $vars['footer'] Optional HTML content of the footer * @uses $vars['class'] Optional additional class for module * @uses $vars['id'] Optional id for module * @uses $vars['show_inner'] Optional flag to leave out inner div (default: false) @@ -29,19 +29,15 @@ if (isset($vars['id'])) { } if (isset($vars['header'])) { - if ($vars['header']) { - $header = "<div class=\"elgg-head\">$header</div>"; - } -} else { + $header = "<div class=\"elgg-head\">$header</div>"; +} elseif ($title) { $header = "<div class=\"elgg-head\"><h3>$title</h3></div>"; } $body = "<div class=\"elgg-body\">$body</div>"; -if (isset($vars['footer'])) { - if ($vars['footer']) { - $footer = "<div class=\"elgg-foot\">$footer</div>"; - } +if ($footer) { + $footer = "<div class=\"elgg-foot\">$footer</div>"; } $contents = $header . $body . $footer; diff --git a/views/default/page/components/summary.php b/views/default/page/components/summary.php new file mode 100644 index 000000000..ea61a6e4b --- /dev/null +++ b/views/default/page/components/summary.php @@ -0,0 +1,4 @@ +<?php + +// Deprecated in favor of type/elements/summary +echo elgg_view('object/elements/summary', $vars); |
