]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/usergroups.php
All tests pass except for those that require matching parens or brackets
[quix0rs-gnu-social.git] / actions / usergroups.php
index 748585e1d05fbe98fc7611add04bf0a832540ac7..7ead6e6e49172e4941035e0a4c5d433c210f9026 100644 (file)
@@ -46,13 +46,12 @@ require_once INSTALLDIR.'/lib/grouplist.php';
  * @link     http://laconi.ca/
  */
 
-class UsergroupsAction extends Action
+class UsergroupsAction extends OwnerDesignAction
 {
-    var $user = null;
     var $page = null;
     var $profile = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
@@ -119,9 +118,17 @@ class UsergroupsAction extends Action
 
     function showContent()
     {
+        $this->elementStart('p', array('id' => 'new_group'));
         $this->element('a', array('href' => common_local_url('newgroup'),
-                                  'id' => 'new_group'),
+                                  'class' => 'more'),
                        _('Create a new group'));
+        $this->elementEnd('p');
+
+        $this->elementStart('p', array('id' => 'group_search'));
+        $this->element('a', array('href' => common_local_url('groupsearch'),
+                                  'class' => 'more'),
+                       _('Search for more groups'));
+        $this->elementEnd('p');
 
         $offset = ($this->page-1) * GROUPS_PER_PAGE;
         $limit =  GROUPS_PER_PAGE + 1;
@@ -131,10 +138,28 @@ class UsergroupsAction extends Action
         if ($groups) {
             $gl = new GroupList($groups, $this->user, $this);
             $cnt = $gl->show();
+            if (0 == $cnt) {
+                $this->showEmptyListMessage();
+            }
         }
 
         $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
                           $this->page, 'usergroups',
                           array('nickname' => $this->user->nickname));
     }
+
+    function showEmptyListMessage()
+    {
+        $message = sprintf(_('%s is not a member of any group.'), $this->user->nickname) . ' ';
+
+        if (common_logged_in()) {
+            $current_user = common_current_user();
+            if ($this->user->id === $current_user->id) {
+                $message .= _('Try [searching for groups](%%action.groupsearch%%) and joining them.');
+            }
+        }
+        $this->elementStart('div', 'guide');
+        $this->raw(common_markup_to_html($message));
+        $this->elementEnd('div');
+    }
 }