]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Directory/lib/sortablegrouplist.php
Added more checked type-hints.
[quix0rs-gnu-social.git] / plugins / Directory / lib / sortablegrouplist.php
index 2849e75eba6fb69c5e8fc8f84dac17218d966d1c..756b078416f87ee40e2e03f40ffe6a137f0e7046 100644 (file)
@@ -119,7 +119,7 @@ class SortableGroupList extends SortableSubscriptionList
         $this->out->elementStart('tbody');
     }
 
-    function newListItem($profile, $odd)
+    function newListItem(Profile $profile, $odd)
     {
         return new SortableGroupListItem($profile, $this->owner, $this->action, $odd);
     }
@@ -221,6 +221,23 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         $this->endProfile();
     }
 
+    function endActions()
+    {
+        // delete button
+        $cur = common_current_user();
+        list($action, $r2args) = $this->out->returnToArgs();
+        $r2args['action'] = $action;
+        if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
+            $this->out->elementStart('li', 'entity_delete');
+            $df = new DeleteGroupForm($this->out, $this->profile, $r2args);
+            $df->show();
+            $this->out->elementEnd('li');
+        }
+
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('td');
+    }
+
     function showActions()
     {
         $this->startActions();
@@ -234,8 +251,8 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     function showJoinButton()
     {
         $user = $this->owner;
-        if ($user) {
 
+        if ($user instanceof User) {
             $this->out->elementStart('li', 'entity_subscribe');
             // XXX: special-case for user looking at own
             // subscriptions page