]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/usergroups.php
change laconi.ca to status.net
[quix0rs-gnu-social.git] / actions / usergroups.php
index f56f9c6b29119c3c1ced54e05fab06c7d983c813..9543eb48011c6d8b28b2e66c4e2aea18f6dcb65e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * User groups information
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Personal
- * @package   Laconica
+ * @package   StatusNet
  * @author    Evan Prodromou <evan@controlyourself.ca>
  * @author    Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @copyright 2008-2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
 if (!defined('LACONICA')) {
     exit(1);
 }
 
-define('GROUPS_PER_PAGE', 20);
+require_once INSTALLDIR.'/lib/grouplist.php';
 
 /**
  * User groups page
@@ -40,18 +40,22 @@ define('GROUPS_PER_PAGE', 20);
  * Show the groups a user belongs to
  *
  * @category Personal
- * @package  Laconica
+ * @package  StatusNet
  * @author   Evan Prodromou <evan@controlyourself.ca>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  */
 
-class UsergroupsAction extends Action
+class UsergroupsAction extends OwnerDesignAction
 {
-    var $user = null;
     var $page = null;
     var $profile = null;
 
+    function isReadOnly($args)
+    {
+        return true;
+    }
+
     function title()
     {
         if ($this->page == 1) {
@@ -114,6 +118,18 @@ class UsergroupsAction extends Action
 
     function showContent()
     {
+        $this->elementStart('p', array('id' => 'new_group'));
+        $this->element('a', array('href' => common_local_url('newgroup'),
+                                  '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;
 
@@ -122,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');
+    }
 }