aboutsummaryrefslogtreecommitdiff
path: root/mod/cool_theme/views/default/page/components
diff options
context:
space:
mode:
Diffstat (limited to 'mod/cool_theme/views/default/page/components')
-rw-r--r--mod/cool_theme/views/default/page/components/gallery.php77
-rw-r--r--mod/cool_theme/views/default/page/components/image_block.php52
-rw-r--r--mod/cool_theme/views/default/page/components/list.php75
-rw-r--r--mod/cool_theme/views/default/page/components/module.php48
-rw-r--r--mod/cool_theme/views/default/page/components/summary.php4
5 files changed, 256 insertions, 0 deletions
diff --git a/mod/cool_theme/views/default/page/components/gallery.php b/mod/cool_theme/views/default/page/components/gallery.php
new file mode 100644
index 000000000..e8b3f477e
--- /dev/null
+++ b/mod/cool_theme/views/default/page/components/gallery.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Gallery view
+ *
+ * Implemented as an unorder list
+ *
+ * @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) {
+ return true;
+}
+
+elgg_push_context('gallery');
+
+$offset = $vars['offset'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+$pagination = elgg_extract('pagination', $vars, true);
+$offset_key = elgg_extract('offset_key', $vars, 'offset');
+$position = elgg_extract('position', $vars, 'after');
+
+$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,
+ 'count' => $count,
+ 'limit' => $limit,
+ 'offset_key' => $offset_key,
+ ));
+}
+
+if ($position == 'before' || $position == 'both') {
+ echo $nav;
+}
+
+?>
+<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') {
+ echo $nav;
+}
+
+elgg_pop_context();
diff --git a/mod/cool_theme/views/default/page/components/image_block.php b/mod/cool_theme/views/default/page/components/image_block.php
new file mode 100644
index 000000000..a7f480aef
--- /dev/null
+++ b/mod/cool_theme/views/default/page/components/image_block.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Elgg image block pattern
+ *
+ * Common pattern where there is an image, icon, media object to the left
+ * and a descriptive block of text to the right.
+ *
+ * ---------------------------------------------------------------
+ * | | | alt |
+ * | image | body | image |
+ * | block | block | block |
+ * | | | (optional)|
+ * ---------------------------------------------------------------
+ *
+ * @uses $vars['body'] HTML content of the body block
+ * @uses $vars['image'] HTML content of the image block
+ * @uses $vars['image_alt'] HTML content of the alternate image block
+ * @uses $vars['class'] Optional additional class for media element
+ * @uses $vars['id'] Optional id for the media element
+ */
+
+$body = elgg_extract('body', $vars, '');
+$image = elgg_extract('image', $vars, '');
+$alt_image = elgg_extract('image_alt', $vars, '');
+
+$class = 'elgg-image-block';
+$additional_class = elgg_extract('class', $vars, '');
+if ($additional_class) {
+ $class = "$class $additional_class";
+}
+
+$id = '';
+if (isset($vars['id'])) {
+ $id = "id=\"{$vars['id']}\"";
+}
+
+
+$body = "<div class=\"elgg-body\">$body</div>";
+
+if ($image) {
+ $image = "<div class=\"elgg-image\">$image</div>";
+}
+
+if ($alt_image) {
+ $alt_image = "<div class=\"elgg-image-alt\">$alt_image</div>";
+}
+
+echo <<<HTML
+<div class="$class clearfix" $id>
+ $image$alt_image$body
+</div>
+HTML;
diff --git a/mod/cool_theme/views/default/page/components/list.php b/mod/cool_theme/views/default/page/components/list.php
new file mode 100644
index 000000000..5ddf82b63
--- /dev/null
+++ b/mod/cool_theme/views/default/page/components/list.php
@@ -0,0 +1,75 @@
+<?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. 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)
+ * @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['list_class'] Additional CSS class for the <ul> element
+ * @uses $vars['item_class'] Additional CSS class for the <li> elements
+ */
+
+$items = $vars['items'];
+$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);
+$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 = "$list_class {$vars['list_class']}";
+}
+
+$item_class = 'elgg-item';
+if (isset($vars['item_class'])) {
+ $item_class = "$item_class {$vars['item_class']}";
+}
+
+$html = "";
+$nav = "";
+
+if ($pagination && $count) {
+ $nav .= elgg_view('navigation/pagination', array(
+ 'base_url' => $base_url,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+ 'offset_key' => $offset_key,
+ ));
+}
+
+if (is_array($items) && count($items) > 0) {
+ $html .= "<ul class=\"$list_class\">";
+ foreach ($items as $item) {
+ if($item->action_type != 'comment') {
+ if (elgg_instanceof($item)) {
+ $id = "elgg-{$item->getType()}-{$item->getGUID()}";
+ } else {
+ $id = "item-{$item->getType()}-{$item->id}";
+ }
+ $html .= "<li id=\"$id\" class=\"$item_class\">";
+ $html .= elgg_view_list_item($item, $vars);
+ $html .= '</li>';
+ }
+ }
+ $html .= '</ul>';
+}
+if ($position == 'before' || $position == 'both') {
+ $html = $nav . $html;
+}
+
+if ($position == 'after' || $position == 'both') {
+ $html .= $nav;
+}
+
+echo $html;
diff --git a/mod/cool_theme/views/default/page/components/module.php b/mod/cool_theme/views/default/page/components/module.php
new file mode 100644
index 000000000..7e1eaff20
--- /dev/null
+++ b/mod/cool_theme/views/default/page/components/module.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Elgg module element
+ *
+ * @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'] 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)
+ */
+
+$title = elgg_extract('title', $vars, '');
+$header = elgg_extract('header', $vars, '');
+$body = elgg_extract('body', $vars, '');
+$footer = elgg_extract('footer', $vars, '');
+$show_inner = elgg_extract('show_inner', $vars, false);
+
+$class = 'elgg-module';
+$additional_class = elgg_extract('class', $vars, '');
+if ($additional_class) {
+ $class = "$class $additional_class";
+}
+
+$id = '';
+if (isset($vars['id'])) {
+ $id = "id=\"{$vars['id']}\"";
+}
+
+if (isset($vars['header'])) {
+ $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 ($footer) {
+ $footer = "<div class=\"elgg-foot\">$footer</div>";
+}
+
+$contents = $header . $body . $footer;
+if ($show_inner) {
+ $contents = "<div class=\"elgg-inner\">$contents</div>";
+}
+
+echo "<div class=\"$class\" $id>$contents</div>";
diff --git a/mod/cool_theme/views/default/page/components/summary.php b/mod/cool_theme/views/default/page/components/summary.php
new file mode 100644
index 000000000..ea61a6e4b
--- /dev/null
+++ b/mod/cool_theme/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);