aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default/blog/sidebar_menu.php
blob: 93af0c5ba260b491a44b73f1924aea725fe3bb33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
 * Blog sidebar menu.
 *
 * @package Blog
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2010
 * @link http://elgg.org/
 */

// a few cases to consider:
// 1. looking at all posts
// 2. looking at a user's post
// 3. looking at your posts

/*
Logged in or not doesn't matter unless you're looking at your blog.
	Does it matter then on the side bar?

All blogs:
	Archives

Owned blogs;
	Archives
*/

$loggedin_user = get_loggedin_user();
$page_owner = page_owner_entity();

// include a view for plugins to extend
echo elgg_view("blogs/sidebar", array("object_type" => 'blog'));

// fetch & display latest comments on all blog posts
$comments = get_annotations(0, "object", "blog", "generic_comment", "", 0, 4, 0, "desc");
echo elgg_view('annotation/latest_comments', array('comments' => $comments));


// 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 "<h3>".elgg_echo('blog:archives')."</h3>";

		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');
echo <<<___END
<h3>Tagcloud</h3>
<div class="tagcloud sidebar">$tags</div>
<a href="{$vars['url']}mod/tagcloud/tagcloud.php">All site tags</a>
___END;

?>