aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-24 19:49:40 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-24 19:49:40 +0000
commit3b0b462b5790f15fcb612de66544838bdbce658b (patch)
tree6bd088104c04946c55f7496f5e678c5867ce17a0 /mod/blog/views
parentd47809ecb0dee997682fb53d220ef5377406a975 (diff)
downloadelgg-3b0b462b5790f15fcb612de66544838bdbce658b.tar.gz
elgg-3b0b462b5790f15fcb612de66544838bdbce658b.tar.bz2
Added archive view for blogs.
git-svn-id: http://code.elgg.org/elgg/trunk@5497 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/views')
-rw-r--r--mod/blog/views/default/blog/sidebar_menu.php40
1 files changed, 24 insertions, 16 deletions
diff --git a/mod/blog/views/default/blog/sidebar_menu.php b/mod/blog/views/default/blog/sidebar_menu.php
index bd348c7e6..a3fe1c181 100644
--- a/mod/blog/views/default/blog/sidebar_menu.php
+++ b/mod/blog/views/default/blog/sidebar_menu.php
@@ -35,24 +35,32 @@ echo elgg_view("blogs/sidebar", array("object_type" => 'blog'));
$comments = get_annotations(0, "object", "blog", "generic_comment", "", 0, 4, 0, "desc");
echo elgg_view('annotation/latest_comments', array('comments' => $comments));
-if ($dates = get_entity_dates('object', 'blog', page_owner())) {
- echo elgg_view_title(elgg_echo('blog:archives'));
-
- echo '<ul>';
- foreach($dates as $date) {
- $timestamplow = mktime(0,0,0,substr($date,4,2),1,substr($date,0,4));
- $timestamphigh = mktime(0,0,0,((int) substr($date,4,2)) + 1,1,substr($date,0,4));
-
- if (!isset($page_owner)) $page_owner = page_owner_entity();
- $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh;
- //add_submenu_item(sprintf(elgg_echo('date:month:' . substr($date,4,2)), substr($date, 0, 4)), $link, 'filter');
- $month = sprintf(elgg_echo('date:month:' . substr($date,4,2)), substr($date, 0, 4));
- echo "<li><a href=\"$link\" title=\"$month\">$month</a><li>";
- }
- echo '</ul>';
-}
+// only show archives for users or groups.
+// This is a limitation of the URL schema.
+if ($page_owner) {
+ $dates = blog_get_blog_months($user);
+
+ if ($dates) {
+ echo elgg_view_title(elgg_echo('blog:archives'));
+
+ echo '<ul>';
+ foreach($dates as $date) {
+ $date = $date->yearmonth;
+ $timestamplow = mktime(0,0,0,substr($date,4,2),1,substr($date,0,4));
+ $timestamphigh = mktime(0,0,0,((int) substr($date,4,2)) + 1,1,substr($date,0,4));
+
+ if (!isset($page_owner)) $page_owner = page_owner_entity();
+ $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh;
+ //add_submenu_item(sprintf(elgg_echo('date:month:' . substr($date,4,2)), substr($date, 0, 4)), $link, 'filter');
+ $month = sprintf(elgg_echo('date:month:' . substr($date,4,2)), substr($date, 0, 4));
+ echo "<li><a href=\"$link\" title=\"$month\">$month</a><li>";
+ }
+
+ echo '</ul>';
+ }
+}
// temporarily force tag-cloud display
$tags = display_tagcloud(0, 100, 'tags');