]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3751 adds a group blog archive page
authorCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 04:01:08 +0000 (23:01 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 04:01:08 +0000 (23:01 -0500)
mod/blog/lib/blog.php
mod/blog/start.php
mod/blog/views/default/blog/sidebar.php
mod/blog/views/default/blog/sidebar/archives.php

index 590547a8c133b7c855f13a45c59c366d9afd262d..286fe1832802b5414101f058a52457166f4bcd72 100644 (file)
@@ -187,11 +187,16 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) {
 
        $now = time();
 
-       $user = get_user($owner_guid);
+       $owner = get_entity($owner_guid);
        elgg_set_page_owner_guid($owner_guid);
 
-       $crumbs_title = $user->name;
-       elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}");
+       $crumbs_title = $owner->name;
+       if (elgg_instanceof($owner, 'user')) {
+               $url = "blog/owner/{$owner->username}";
+       } else {
+               $url = "blog/group/$owner->guid/all";
+       }
+       elgg_push_breadcrumb($crumbs_title, $url);
        elgg_push_breadcrumb(elgg_echo('blog:archives'));
 
        if ($lower) {
@@ -209,7 +214,7 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) {
        );
 
        if ($owner_guid) {
-               $options['owner_guid'] = $owner_guid;
+               $options['container_guid'] = $owner_guid;
        }
 
        // admin / owners can see any posts
index 53a4dcadf2d65a31e5b5bfb90dfd560e689e134a..90a800799f1b62e7978581dac6c9cfb37bf39d2f 100644 (file)
@@ -136,7 +136,11 @@ function blog_page_handler($page) {
                        $params = blog_get_page_content_edit($page_type, $page[1], $page[2]);
                        break;
                case 'group':
-                       $params = blog_get_page_content_list($page[1]);
+                       if ($page[2] == 'all') {
+                               $params = blog_get_page_content_list($page[1]);
+                       } else {
+                               $params = blog_get_page_content_archive($page[1], $page[3], $page[4]);
+                       }
                        break;
                case 'all':
                        $params = blog_get_page_content_list();
index 97a23c17e885948211a173bf43b3ca3126a0a81d..0ae2b431cd4b575275a40462b36cfa4017ce8eab 100644 (file)
@@ -18,7 +18,7 @@ if ($vars['page'] == 'all') {
 }
 
 // only users can have archives at present
-if (elgg_instanceof(elgg_get_page_owner_entity(), 'user')) {
+if ($vars['page'] == 'owner' || $vars['page'] == 'group') {
        echo elgg_view('blog/sidebar/archives', $vars);
 }
 
index 3aa3db44f65829f4c428337ccbde4757f7a19df2..3d8f28ca4c259eaddbc3e61da92e615fad13a3a5 100644 (file)
@@ -6,6 +6,12 @@
 $loggedin_user = elgg_get_logged_in_user_entity();
 $page_owner = elgg_get_page_owner_entity();
 
+if (elgg_instanceof($page_owner, 'user')) {
+       $url_segment = 'blog/archive/' . $page_owner->username;
+} else {
+       $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive';
+}
+
 // This is a limitation of the URL schema.
 if ($page_owner && $vars['page'] != 'friends') {
        $dates = get_entity_dates('object', 'blog', $page_owner->getGUID());
@@ -13,11 +19,11 @@ if ($page_owner && $vars['page'] != 'friends') {
        if ($dates) {
                $title = elgg_echo('blog:archives');
                $content = '<ul class="blog-archives">';
-               foreach($dates as $date) {
+               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));
 
-                       $link = elgg_get_site_url() . 'blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh;
+                       $link = elgg_get_site_url() . $url_segment . '/' . $timestamplow . '/' . $timestamphigh;
                        $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));
                        $content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>";
                }