aboutsummaryrefslogtreecommitdiff
path: root/views/default/page/components
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/page/components')
-rw-r--r--views/default/page/components/gallery.php66
-rw-r--r--views/default/page/components/list.php34
-rw-r--r--views/default/page/components/module.php18
-rw-r--r--views/default/page/components/summary.php4
-rw-r--r--views/default/page/components/widget.php70
5 files changed, 62 insertions, 130 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/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);
diff --git a/views/default/page/components/widget.php b/views/default/page/components/widget.php
deleted file mode 100644
index e7a16b318..000000000
--- a/views/default/page/components/widget.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * Widget object
- *
- * @uses $vars['entity'] ElggWidget
- * @uses $vars['show_access'] Show the access control in edit area? (true)
- */
-
-$widget = $vars['entity'];
-if (!elgg_instanceof($widget, 'object', 'widget')) {
- return true;
-}
-
-$show_access = elgg_extract('show_access', $vars, true);
-
-// @todo catch for disabled plugins
-$widget_types = elgg_get_widget_types('all');
-
-$handler = $widget->handler;
-
-$title = $widget->getTitle();
-
-$edit_area = '';
-$can_edit = $widget->canEdit();
-if ($can_edit) {
- $edit_area = elgg_view('layout/objects/widget/settings', array(
- 'widget' => $widget,
- 'show_access' => $show_access,
- ));
-}
-$controls = elgg_view('layout/objects/widget/controls', array(
- 'widget' => $widget,
- 'show_edit' => $edit_area != '',
-));
-
-// don't show content for default widgets
-if (elgg_in_context('default_widgets')) {
- $content = '';
-} else {
- if (elgg_view_exists("widgets/$handler/content")) {
- $content = elgg_view("widgets/$handler/content", $vars);
- } else {
- elgg_deprecated_notice("widgets use content as the display view", 1.8);
- $content = elgg_view("widgets/$handler/view", $vars);
- }
-}
-
-$widget_id = "elgg-widget-$widget->guid";
-$widget_instance = "elgg-widget-instance-$handler";
-$widget_class = "elgg-module elgg-module-widget";
-if ($can_edit) {
- $widget_class .= " elgg-state-draggable $widget_instance";
-} else {
- $widget_class .= " elgg-state-fixed $widget_instance";
-}
-
-echo <<<HTML
-<div class="$widget_class" id="$widget_id">
- <div class="elgg-head">
- <h3>$title</h3>
- $controls
- </div>
- <div class="elgg-body">
- $edit_area
- <div class="elgg-widget-content">
- $content
- </div>
- </div>
-</div>
-HTML;