]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Directory/lib/sortablesubscriptionlist.php
Added more checked type-hints.
[quix0rs-gnu-social.git] / plugins / Directory / lib / sortablesubscriptionlist.php
index 234923c00323f3c904b44f44ef8892e265b07c7c..7e9c3103583767ab350717d36407e2df1d913b1d 100644 (file)
@@ -130,24 +130,28 @@ class SortableSubscriptionList extends SubscriptionList
 
     function showProfiles()
     {
-        $cnt = 0;
+        // Note: we don't use fetchAll() because it's borked with query()
+
+        $profiles = array();
 
         while ($this->profile->fetch()) {
-            $cnt++;
-            if($cnt > PROFILES_PER_PAGE) {
-                break;
-            }
+            $profiles[] = clone($this->profile);
+        }
+
+        $cnt = count($profiles);
 
-            $odd = ($cnt % 2 == 0); // for zebra striping
+        $max = min($cnt, $this->maxProfiles());
 
-            $pli = $this->newListItem($this->profile, $odd);
+        for ($i = 0; $i < $max; $i++) {
+            $odd = ($i % 2 == 0); // for zebra striping
+            $pli = $this->newListItem($profiles[$i], $odd);
             $pli->show();
         }
 
         return $cnt;
     }
 
-    function newListItem($profile, $odd)
+    function newListItem(Profile $profile, $odd)
     {
         return new SortableSubscriptionListItem($profile, $this->owner, $this->action, $odd);
     }
@@ -187,7 +191,7 @@ class SortableSubscriptionListItem extends SubscriptionListItem
 
     function startProfile()
     {
-        $this->out->elementStart('td', 'entity_profile vcard entry-content');
+        $this->out->elementStart('td', 'entity_profile h-card');
     }
 
     function endProfile()
@@ -203,6 +207,18 @@ class SortableSubscriptionListItem extends SubscriptionListItem
 
     function endActions()
     {
+               
+               // delete button
+               $cur = common_current_user();
+        list($action, $r2args) = $this->out->returnToArgs();
+        $r2args['action'] = $action;        
+               if ($cur instanceof User && $cur->hasRight(Right::DELETEUSER)) {
+                       $this->out->elementStart('li', 'entity_delete');
+                       $df = new DeleteUserForm($this->out, $this->profile, $r2args);
+                       $df->show();            
+                       $this->out->elementEnd('li');
+               }
+                       
         $this->out->elementEnd('ul');
         $this->out->elementEnd('td');
     }