aboutsummaryrefslogtreecommitdiff
path: root/mod/lightbox/views/default/object
diff options
context:
space:
mode:
Diffstat (limited to 'mod/lightbox/views/default/object')
-rw-r--r--mod/lightbox/views/default/object/album.php117
-rw-r--r--mod/lightbox/views/default/object/image.php100
2 files changed, 217 insertions, 0 deletions
diff --git a/mod/lightbox/views/default/object/album.php b/mod/lightbox/views/default/object/album.php
new file mode 100644
index 000000000..676488702
--- /dev/null
+++ b/mod/lightbox/views/default/object/album.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Album renderer.
+ *
+ * @package ElggLightbox
+ */
+
+elgg_load_js('jquery.lightbox');
+elgg_load_css('jquery.lightbox');
+elgg_load_js('lightbox.album');
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "photos/owner/$owner->username",
+ 'text' => $owner->name,
+ 'is_trusted' => true,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+
+$icon = elgg_view_entity_icon($entity, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $entity->getURL() . '#album-comments',
+ 'text' => $text,
+ 'is_trusted' => true,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'album',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $comments_link $categories";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
+
+ $gallery = elgg_list_entities_from_relationship(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'relationship' => 'in_album',
+ 'relationship_guid' => $entity->guid,
+ 'inverse_relationship' => false,
+ 'list_type' => 'gallery',
+ 'item_class' => 'elgg-photo lightbox-photo',
+ 'full_view' => false,
+
+ ));
+
+ $text = elgg_view('output/longtext', array('value' => $entity->description));
+ $body = "$text $gallery";
+
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'icon' => $icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="album-gallery-item">';
+ echo "<h3>" . $entity->title . "</h3>";
+ echo elgg_view_entity_icon($entity, 'medium');
+ echo "<p class='subtitle'>$owner_link $date</p>";
+ echo '</div>';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}
diff --git a/mod/lightbox/views/default/object/image.php b/mod/lightbox/views/default/object/image.php
new file mode 100644
index 000000000..06a50202a
--- /dev/null
+++ b/mod/lightbox/views/default/object/image.php
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Image renderer.
+ *
+ * @package ElggLightbox
+ */
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "photos/owner/$owner->username",
+ 'text' => $owner->name,
+ 'is_trusted' => true,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+
+$icon = elgg_view_entity_icon($entity, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $entity->getURL() . '#album-comments',
+ 'text' => $text,
+ 'is_trusted' => true,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'album',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $comments_link $categories";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
+
+ $body = elgg_view('lightbox/image' , $vars)
+ . elgg_view('output/longtext', array('value' => $entity->description));
+
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'icon' => $icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="album-gallery-item">';
+ echo "<h3>" . $entity->title . "</h3>";
+ echo elgg_view_entity_icon($entity, 'medium');
+ echo '</div>';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}