]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilelist.php
people tag UI elements
[quix0rs-gnu-social.git] / lib / profilelist.php
index 934907bc35ec075b8712a434f8178cab8e966888..af38fa71d9bc62f1fcf0ea3593579f4771a5ffe3 100644 (file)
@@ -33,6 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 }
 
 require_once INSTALLDIR.'/lib/widget.php';
+require_once INSTALLDIR.'/lib/peopletags.php';
 
 /**
  * Widget to show a list of profiles
@@ -168,6 +169,10 @@ class ProfileListItem extends Widget
                 $this->showBio();
                 Event::handle('EndProfileListItemBio', array($this));
             }
+            if (Event::handle('StartProfileListItemTags', array($this))) {
+                $this->showTags();
+                Event::handle('EndProfileListItemTags', array($this));
+            }
             Event::handle('EndProfileListItemProfileElements', array($this));
         }
         $this->endProfile();
@@ -222,8 +227,8 @@ class ProfileListItem extends Widget
     {
         if (!empty($this->profile->homepage)) {
             $this->out->text(' ');
-            $this->out->elementStart('a', array('href' => $this->profile->homepage,
-                                                'class' => 'url'));
+            $aAttrs = $this->homepageAttributes();
+            $this->out->elementStart('a', $aAttrs);
             $this->out->raw($this->highlight($this->profile->homepage));
             $this->out->elementEnd('a');
         }
@@ -238,6 +243,20 @@ class ProfileListItem extends Widget
         }
     }
 
+    function showTags()
+    {
+        $user = common_current_user();
+        if (!empty($user)) {
+            if ($user->id == $this->profile->id) {
+                $tags = new SelftagsWidget($this->out, $user, $this->profile);
+                $tags->show();
+            } else if ($user->getProfile()->canTag($this->profile)) {
+                $tags = new PeopletagsWidget($this->out, $user, $this->profile);
+                $tags->show();
+            }
+        }
+    }
+
     function endProfile()
     {
         $this->out->elementEnd('div');
@@ -305,4 +324,10 @@ class ProfileListItem extends Widget
                      'class' => 'url entry-title',
                      'rel' => 'contact');
     }
+
+    function homepageAttributes()
+    {
+        return array('href' => $this->profile->homepage,
+                     'class' => 'url');
+    }
 }