diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/tidypics/albums.php | 45 | ||||
-rw-r--r-- | views/default/tidypics/groupprofile_albums.php | 61 | ||||
-rw-r--r-- | views/default/widgets/album_view/view.php | 43 |
3 files changed, 50 insertions, 99 deletions
diff --git a/views/default/tidypics/albums.php b/views/default/tidypics/albums.php new file mode 100644 index 000000000..de56f08e1 --- /dev/null +++ b/views/default/tidypics/albums.php @@ -0,0 +1,45 @@ +<?php
+
+ //the number of albums to display
+ $number = (int)$vars['num_albums'];
+ if (!$number)
+ $number = 5;
+
+ $owner = page_owner_entity();
+ $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
+
+ if ($owner_albums) {
+ echo '<div id="tidypics_album_widget_container">';
+ foreach($owner_albums as $album) {
+
+ if($album->cover)
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" border="0" class="tidypics_album_cover" alt="' . $album->title . '"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/img_error.jpg" border="0" class="tidypics_album_cover" alt="' . $album->title . '">';
+?>
+ <div class="tidypics_album_widget_single_item">
+ <div class="tidypics_album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
+ <div class="tidypics_album_widget_timestamp"> <?php echo elgg_echo("album:created:on") . ' ' . friendly_time($album->time_created);?></div>
+<?php
+ //get the number of comments
+ $numcomments = elgg_count_comments($album);
+ if ($numcomments)
+ echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a><br>";
+?>
+ <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a>
+ </div>
+<?php
+ } //end of foreach loop
+
+ // bottom link to all group/user albums
+ if (is_null($owner->username) || empty($owner->username)) {
+ echo '<a href="' . $vars['url'] . 'pg/photos/world">' . elgg_echo('album:all') . '</a>';
+ } else {
+ echo '<a href="' . $vars['url'] . 'pg/photos/owned/' . $owner->username . '">' . elgg_echo('album:more') . '</a>';
+ }
+
+ //close album_widget_container div
+ echo "</div>";
+
+ }
+?>
\ No newline at end of file diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php index de61b0845..060c540d4 100644 --- a/views/default/tidypics/groupprofile_albums.php +++ b/views/default/tidypics/groupprofile_albums.php @@ -1,64 +1,9 @@ <?php
if ($vars['entity']->photos_enable != 'no') {
-
- //the number of files to display
- $number = (int) $vars['entity']->num_display;
- //if no number has been set, default to 5
- if (!$number)
- $number = 5;
-
- $owner = page_owner_entity();
- $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false);
-
echo '<div id="group_albums_widget">';
- echo '<h2>' . elgg_echo('albums') . '</h2>';
-
- if ($owner_albums) {
- echo '<div id="tidypics_album_widget_container">';
- foreach($owner_albums as $album){
-
- //get album cover if one was set
- if($album->cover)
- $album_cover = '<img src="'.$vars['url'].'/mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" border="0" class="tidypics_album_cover" alt="album cover"/>';
- else
- $album_cover = '<img src="'.$vars['url'].'/mod/tidypics/graphics/img_error.jpg" class="tidypics_album_cover" alt="new album">';
-
- ?>
- <div class="tidypics_album_widget_single_item">
- <div class="tidypics_album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
- <div class="tidypics_album_widget_timestamp"> <?php echo elgg_echo("album:created:on") . ' ' . friendly_time($album->time_created);?></div>
- <?php
- //get the number of comments
- $numcomments = elgg_count_comments($album);
- if ($numcomments)
- echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a><br>";
- ?>
- <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a>
- </div>
- <?php
- } //end of loop
-
- //get a link to the group's album, or world if unavailable
- if (is_null($owner->username) || empty($owner->username)) {
- echo '<a href="' . $vars['url'] . 'pg/photos/world">' . elgg_echo('album:all') . '</a>';
- } else {
- echo '<a href="' . $vars['url'] . 'pg/photos/owned/' . $owner->username . '">' . elgg_echo('album:more') . '</a>';
- }
-
- //close album_widget_container div
- echo "</div>";
- } else {
-
- //echo '<div id="no_album_found">';
- //echo '<p class="pages_add_title">'.elgg_echo("album:none").'</p>';
- if ($owner && ($owner->canWriteToContainer($_SESSION['user']))){
- //echo '<a class="add_topic_button" href='.$CONFIG->url .'pg/photos/new/'.$owner->username.'>'.elgg_echo("album:add").'</a>';
- //echo '</div>';
- }
-
- }
- //close group_albums_widget div
- echo "</div>";
+ echo '<h2>' . elgg_echo('album:group') . '</h2>';
+ echo elgg_view('tidypics/albums', array('num_albums' => 5));
+ echo '</div>';
}
?>
\ No newline at end of file diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php index b8b206b22..b4248df35 100644 --- a/views/default/widgets/album_view/view.php +++ b/views/default/widgets/album_view/view.php @@ -1,52 +1,13 @@ <div class="contentWrapper"> <?php + //the number of files to display $number = (int) $vars['entity']->num_display; //if no number has been set, default to 5 if (!$number) $number = 5; - - $owner = page_owner_entity(); - $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); - if ($owner_albums) { - echo '<div id="tidypics_album_widget_container">'; - - foreach($owner_albums as $album){ - - //get album cover if one was set - if($album->cover) - $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$album->cover.'&size=small" border="0" class="tidypics_album_cover" alt="' . $album->title . '"/>'; - else - $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/img_error.jpg" border="0" class="tidypics_album_cover" alt="' . $album->title . '">'; - ?> - <div class="tidypics_album_widget_single_item"> - <div class="tidypics_album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div> - <div class="tidypics_album_widget_timestamp"> <?php echo elgg_echo("album:created:on") . ' '. friendly_time($album->time_created);?></div> - <?php - //get the number of comments - $numcomments = elgg_count_comments($album); - if ($numcomments) - echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a><br>"; - ?> - <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a> - </div> - <?php - } - - //get a link to the users album - $users_album_url = $vars['url'] . "pg/photos/owned/" . $owner->username; - echo "<a href=\"{$users_album_url}\">" . elgg_echo('album:more') . "</a>"; - echo "</div>"; - - } else { - - echo '<p class="pages_add_title">' . elgg_echo("album:none") . '</p>'; + echo elgg_view('tidypics/albums', array('num_albums' => $number)); - if (get_loggedin_userid() == page_owner()) { - echo '<p class="pages_add"><a class="pages add" href='.$CONFIG->url .'pg/photos/new/'.$owner->username.'>'.elgg_echo("album:create").'</a></p>'; - } - - } ?> </div>
\ No newline at end of file |