aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-11-19 12:10:46 -0500
committercash <cash.costello@gmail.com>2011-11-19 12:10:46 -0500
commit4562cfbb1a630b14fd194271f99f1f8c098dc38d (patch)
tree926e9e22cca553f48583ff25d782a092795ceb7c /views/default
parenteb9b13e1bfd861cba9b7a812d929b565d5775175 (diff)
downloadelgg-4562cfbb1a630b14fd194271f99f1f8c098dc38d.tar.gz
elgg-4562cfbb1a630b14fd194271f99f1f8c098dc38d.tar.bz2
basic pages for viewing all/mine/friends and viewing an album
Diffstat (limited to 'views/default')
-rw-r--r--views/default/object/album.php154
-rw-r--r--views/default/object/album/full.php60
-rw-r--r--views/default/object/album/summary.php41
-rw-r--r--views/default/object/image.php17
-rw-r--r--views/default/object/image/full.php2
-rw-r--r--views/default/object/image/summary.php43
-rw-r--r--views/default/tidypics/css.php12
7 files changed, 185 insertions, 144 deletions
diff --git a/views/default/object/album.php b/views/default/object/album.php
index 13b94aed5..51b25b7da 100644
--- a/views/default/object/album.php
+++ b/views/default/object/album.php
@@ -1,150 +1,18 @@
<?php
/**
- * Tidypics Album Gallery View
- */
-
-global $CONFIG;
-
-$album = $vars['entity'];
-$album_guid = $album->getGUID();
-$owner = $album->getOwnerEntity();
-$tags = $album->tags;
-$title = $album->title;
-$desc = $album->description;
-$friendlytime = friendly_time($album->time_created);
-$mime = $album->mimetype;
-
-if (get_context() == "search") {
-
- if (get_input('search_viewtype') == "gallery") {
-
-/******************************************************************************
- *
- * Gallery view of an album object
+ * Album view
*
- * This is called when looking at page of albums
- *
- *
- *****************************************************************************/
-
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- $album_cover = '<img src="' . $vars['url'] . 'pg/photos/thumbnail/' . $album_cover_guid . '/small/" class="tidypics_album_cover" alt="' . $title . '"/>';
- } else {
- $album_cover = '<img src="' . $vars['url'] . 'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="new album">';
- }
-?>
-<div class="tidypics_album_gallery_item">
- <div class="tidypics_gallery_title">
- <a href="<?php echo $album->getURL();?>"><?php echo $title;?></a>
- </div>
- <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a><br>
- <small><a href="<?php echo $vars['url'];?>pg/profile/<?php echo $owner->username;?>"><?php echo $owner->name;?></a>
- <br /><?php echo $friendlytime;?><br />
- <?php
- //get the number of comments
- $numcomments = elgg_count_comments($album);
- if ($numcomments) {
- echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
- }
-?>
- </small>
-</div>
-<?php
- } else {
-/******************************************************************************
- *
- * List view of an album object
+ * @uses $vars['entity'] TidypicsAlbum
*
- * This is called when an album object is returned in a search.
- *
- *
- *****************************************************************************/
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
- $info = '<p><a href="' . $album->getURL() . '">' . $title . '</a></p>';
- $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
- $numcomments = elgg_count_comments($album);
- if ($numcomments) {
- $info .= ", <a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
- }
- $info .= "</p>";
+$album = elgg_extract('entity', $vars);
+$full_view = elgg_extract('full_view', $vars, false);
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album_cover_guid . '&size=thumb" alt="thumbnail" /></a>';
- } else {
- $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/graphics/image_error_thumb.png" alt="new album"></a>';
- }
- echo elgg_view_listing($icon, $info);
- }
+if ($full_view) {
+ echo elgg_view('object/album/full', $vars);
} else {
-
-/******************************************************************************
- *
- * Individual view of an album object
- *
- * This is called when getting a listing of the photos in an album
- *
- *
- *****************************************************************************/
-
- $page = get_input("page");
- list($album_placeholder, $album_id, $album_title) = split("/", $page);
-
- $photo_ratings = get_plugin_setting('photo_ratings', 'tidypics');
- if ($photo_ratings == "enabled") {
- add_submenu_item( elgg_echo("tidypics:highestrated"),
- $CONFIG->wwwroot . "pg/photos/highestrated/group:" . $album_id,
- 'photos');
- }
- echo elgg_view_title($title);
-?>
-<div class="contentWrapper">
- <div id="tidypics_breadcrumbs">
- <?php echo elgg_view('tidypics/breadcrumbs', array() ); ?>
- </div>
-<?php
- echo '<div id="tidypics_desc">' . autop($desc) . '</div>';
-
- $offset = (int)get_input('offset', 0);
- echo $album->viewImages(16, $offset);
- // echo '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>';
- // $num_images = 0;
- //}
-
-?>
- <div class="clearfloat"></div>
- <div class="tidypics_info">
-<?php
-
- if (!is_null($tags)) {
-?>
- <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
-<?php
- }
-?>
- <?php echo elgg_echo('album:by');?> <b><a href="<?php echo $vars['url'] ;?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?><br>
- <?php echo elgg_echo('image:total');?> <b><?php echo $album->getSize(); ?></b><br>
-<?php
- $categories = elgg_view('categories/view',$vars);
- if (!empty($categories)) {
-?>
- <br />
- <b><?php echo elgg_echo('categories'); ?>:</b>
-<?php
-
- echo $categories;
-
- }
-?>
- </div>
-
-<?php
-
- if ($vars['full']) {
- echo elgg_view_comments($album);
- }
-
- echo '</div>';
-} // end of individual album view
-
+ echo elgg_view('object/album/summary', $vars);
+}
diff --git a/views/default/object/album/full.php b/views/default/object/album/full.php
new file mode 100644
index 000000000..7484a48f3
--- /dev/null
+++ b/views/default/object/album/full.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Full view of an album
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$album = elgg_extract('entity', $vars);
+$owner = $album->getOwnerEntity();
+
+$owner_icon = elgg_view_entity_icon($owner, 'tiny');
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $album,
+ 'handler' => 'photos',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$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));
+$date = elgg_view_friendly_time($album->time_created);
+$categories = elgg_view('output/categories', $vars);
+
+$subtitle = "$author_text $date $categories";
+
+$params = array(
+ 'entity' => $album,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => elgg_view('output/tags', array('tags' => $album->tags)),
+);
+$params = $params + $vars;
+$summary = elgg_view('object/elements/summary', $params);
+
+$body = elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'container_guid' => $album->getGUID(),
+ 'limit' => 16,
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'gallery_class' => 'tidypics-gallery',
+));
+
+echo elgg_view('object/elements/full', array(
+ 'entity' => $album,
+ 'icon' => $owner_icon,
+ 'summary' => $summary,
+ 'body' => $body,
+));
diff --git a/views/default/object/album/summary.php b/views/default/object/album/summary.php
new file mode 100644
index 000000000..78eec3517
--- /dev/null
+++ b/views/default/object/album/summary.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Summary of an album for lists/galleries
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$album = elgg_extract('entity', $vars);
+
+$album_cover = elgg_view('output/img', array(
+ 'src' => $album->getCoverImageURL(),
+ 'alt' => $album->getTitle(),
+ 'class' => 'elgg-photo',
+));
+
+$header = elgg_view('output/url', array(
+ 'text' => $album->getTitle(),
+ 'href' => $album->getURL(),
+));
+
+$body = elgg_view('output/url', array(
+ 'text' => $album_cover,
+ 'href' => $album->getURL(),
+ 'encode_text' => false,
+ 'is_trusted' => true,
+));
+
+$footer = elgg_view('output/url', array(
+ 'text' => $album->getContainerEntity()->name,
+ 'href' => $album->getContainerEntity()->getURL(),
+ 'is_trusted' => true,
+));
+$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>';
+
+$params = array(
+ 'footer' => $footer,
+);
+echo elgg_view_module('tidypics-album', $header, $body, $params);
diff --git a/views/default/object/image.php b/views/default/object/image.php
index 8c1f23ec2..12d58440d 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -1,9 +1,24 @@
<?php
/**
+ * Image view
*
- * Tidypics image object views
+ * @uses $vars['entity'] TidypicsImage
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
+
+$full_view = elgg_extract('full_view', $vars, false);
+
+if ($full_view) {
+ echo elgg_view('object/image/full', $vars);
+} else {
+ echo elgg_view('object/image/summary', $vars);
+}
+
+return true;
+
global $CONFIG;
include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php";
diff --git a/views/default/object/image/full.php b/views/default/object/image/full.php
new file mode 100644
index 000000000..a4abe2daf
--- /dev/null
+++ b/views/default/object/image/full.php
@@ -0,0 +1,2 @@
+<?php
+
diff --git a/views/default/object/image/summary.php b/views/default/object/image/summary.php
new file mode 100644
index 000000000..71c1be6b9
--- /dev/null
+++ b/views/default/object/image/summary.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Summary of an image for lists/galleries
+ *
+ * @uses $vars['entity'] TidypicsImage
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$image = elgg_extract('entity', $vars);
+
+$img = elgg_view('output/img', array(
+ 'src' => $image->getSrcURL(),
+ 'alt' => $image->getTitle(),
+ 'class' => 'elgg-photo',
+));
+
+$header = elgg_view('output/url', array(
+ 'text' => $image->getTitle(),
+ 'href' => $image->getURL(),
+));
+
+$body = elgg_view('output/url', array(
+ 'text' => $img,
+ 'href' => $image->getURL(),
+ 'encode_text' => false,
+ 'is_trusted' => true,
+));
+
+/*
+$footer = elgg_view('output/url', array(
+ 'text' => $image->getContainerEntity()->name,
+ 'href' => $image->getContainerEntity()->getURL(),
+ 'is_trusted' => true,
+));
+$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>';
+*/
+
+$params = array(
+ 'footer' => $footer,
+);
+echo elgg_view_module('tidypics-image', $header, $body, $params);
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 25a29fdc3..bf47d42b7 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -3,6 +3,18 @@
* tidypics CSS extender
*/
?>
+
+.elgg-module-tidypics-album,
+.elgg-module-tidypics-image {
+ width: 161px;
+ text-align: center;
+ margin: 5px 10px;
+}
+
+<?php
+return true;
+?>
+
/* ---- tidypics object views ---- */
.tidypics_wrapper > table.entity_gallery {