aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
committerCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
commit4e0c1576475390faa2f1fb4c4dc2902a953f440e (patch)
treecd3a47df019344d7f6c938ebe31c60cfa9b03677 /views/default/widgets
downloadelgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.gz
elgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.bz2
First commit
Diffstat (limited to 'views/default/widgets')
-rw-r--r--views/default/widgets/album_view/edit.php21
-rw-r--r--views/default/widgets/album_view/view.php53
2 files changed, 74 insertions, 0 deletions
diff --git a/views/default/widgets/album_view/edit.php b/views/default/widgets/album_view/edit.php
new file mode 100644
index 000000000..2d7c7708f
--- /dev/null
+++ b/views/default/widgets/album_view/edit.php
@@ -0,0 +1,21 @@
+<p>
+ <?php echo elgg_echo("album:num_albums"); ?>:
+
+ <?php
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 5;
+ ?>
+ <select name="params[num_display]">
+ <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
+ <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
+ <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
+ <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
+ <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
+ <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
+ <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
+ <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
+ <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
+ <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
+ <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
+ <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>
+ </select>
+</p> \ No newline at end of file
diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php
new file mode 100644
index 000000000..347332971
--- /dev/null
+++ b/views/default/widgets/album_view/view.php
@@ -0,0 +1,53 @@
+<?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="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="album_cover" alt="' . $album->title . '"/>';
+ else
+ $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/img_error.jpg" border="0" class="album_cover" alt="' . $album->title . '">';
+ ?>
+ <div class="album_widget_single_item">
+ <div class="album_widget_title"><a href="<?php echo $album->getURL();?>"><?php echo $album->title;?></a></div>
+ <div class="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>';
+
+ //check if owner has write rights. If so, let him edit the album
+ $container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
+
+ if ($owner->username == get_entity($container_guid)->username){
+ echo '<p class="pages_add"><a class="pages add" href='.$CONFIG->url .'pg/photos/new/'.$owner->username.'>'.elgg_echo("album:create").'</a></p>';
+ }
+
+ }
+?> \ No newline at end of file