]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
Merge branch '1.0.x' into testing
[quix0rs-gnu-social.git] / actions / showgroup.php
index b198352cb0cc5225402bdc4d29ff0248fae4de7b..7ad9f112e619c0b86119426c64c490f7ed5bd549 100644 (file)
@@ -50,6 +50,8 @@ class ShowgroupAction extends GroupDesignAction
 {
     /** page we're viewing. */
     var $page = null;
+    var $userProfile = null;
+    var $notice = null;
 
     /**
      * Is this page read-only?
@@ -144,6 +146,13 @@ class ShowgroupAction extends GroupDesignAction
             return false;
         }
 
+        $this->userProfile = Profile::current();
+
+        $stream = new GroupNoticeStream($this->group, $this->userProfile);
+
+        $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
+                                            NOTICES_PER_PAGE + 1);
+
         common_set_returnto($this->selfUrl());
 
         return true;
@@ -190,10 +199,7 @@ class ShowgroupAction extends GroupDesignAction
      */
     function showGroupNotices()
     {
-        $notice = $this->group->getNotices(($this->page-1)*NOTICES_PER_PAGE,
-                                           NOTICES_PER_PAGE + 1);
-
-        $nl = new ThreadedNoticeList($notice, $this);
+        $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
         $cnt = $nl->show();
 
         $this->pagination($this->page > 1,
@@ -323,7 +329,9 @@ class ShowgroupAction extends GroupDesignAction
         // TRANS: Header for group statistics on a group page (h2).
         $this->element('h2', null, _('Statistics'));
 
-        $this->elementEnd('dl');
+        $this->elementStart('dl');
+
+        // TRANS: Label for group creation date.
         $this->element('dt', null, _m('LABEL','Created'));
         $this->element('dd', 'entity_created', date('j M Y',
                                                  strtotime($this->group->created)));
@@ -363,6 +371,18 @@ class ShowgroupAction extends GroupDesignAction
         $this->raw(common_markup_to_html($m));
         $this->elementEnd('div');
     }
+
+    function noticeFormOptions()
+    {
+        $options = parent::noticeFormOptions();
+        $cur = common_current_user();
+
+        if (!empty($cur) && $cur->isMember($this->group)) {
+            $options['to_group'] =  $this->group;
+        }
+
+        return $options;
+    }
 }
 
 class GroupAdminSection extends ProfileSection
@@ -382,8 +402,8 @@ class GroupAdminSection extends ProfileSection
 
     function title()
     {
-        // TRANS: Header for list of group administrators on a group page (h2).
-        return _('Admins');
+        // TRANS: Title for list of group administrators on a group page.
+        return _m('TITLE','Admins');
     }
 
     function divId()