]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better tag handling for profile lists
authorEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 02:44:34 +0000 (21:44 -0500)
committerEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 02:44:34 +0000 (21:44 -0500)
darcs-hash:20081124024434-84dde-e68f54652c2d0dfb802b1abcafba53556c1f057a.gz

lib/profilelist.php

index 26e3f242f28a2a7840aed8ccb44a9f7fb1dbbda6..f8d47f4edab84aae7f32d203a8256a1c6c7f65e2 100644 (file)
@@ -25,9 +25,11 @@ define('PROFILES_PER_PAGE', 20);
 class ProfileList {
 
        var $profile = NULL;
+       var $owner = NULL;
        
-       function __construct($profile) {
+       function __construct($profile, $owner=NULL) {
                $this->profile = $profile;
+               $this->owner = $owner;
        }
        
        function show_list() {
@@ -107,25 +109,41 @@ class ProfileList {
                        common_raw($this->highlight($this->profile->bio));
                        common_element_end('p');
                }
-               
-               $tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
-
 
-               if ($tags) {
-                       common_element_start('div', 'tags_self');
+               # If we're on a list with an owner (subscriptions or subscribers)...
+               
+               if ($this->owner) {
+                       # Get tags
+                       $tags = Profile_tag::getTags($this->owner->id, $this->profile->id);
+                       
+                       common_element_start('div', 'tags_user');
                        common_element_start('dl');
-                       common_element('dt', null, _("User's tags:"));
+                       common_element_start('dt');
+                       if ($user->id == $this->owner->id) {
+                               common_element('a', array('href' => common_local_url('tagother',
+                                                                                                                                        array('id' => $this->profile->id))),
+                                                          _('Tags'));
+                       } else {
+                               common_element(_('Tags'));
+                       }
+                       common_text(":");
+                       common_element_end('dt');
                        common_element_start('dd');
-                       common_element_start('ul', 'tags xoxo');
-                       foreach ($tags as $tag) {
-                               common_element_start('li');
-                               common_element('a', array('rel' => 'tag',
-                                                                                 'href' => common_local_url('peopletag',
-                                                                                                                                        array('tag' => $tag))),
-                                                          $tag);
-                               common_element_end('li');
+                       if ($tags) {
+                               common_element_start('ul', 'tags xoxo');
+                               foreach ($tags as $tag) {
+                                       common_element_start('li');
+                                       common_element('a', array('rel' => "tag",
+                                                                                         'href' => common_local_url($action,
+                                                                                                                                                array('nickname' => $user->nickname,
+                                                                                                                                                          'tag' => $tag))),
+                                                                  $tag);
+                                       common_element_end('li');
+                               }
+                               common_element_end('ul');
+                       } else {
+                               common_text(_('(none)'));
                        }
-                       common_element_end('ul');
                        common_element_end('dd');
                        common_element_end('dl');
                        common_element_end('div');
@@ -142,35 +160,6 @@ class ProfileList {
                        }
                        
                        
-                       if ($action) {
-                               $tags = Profile_tag::getTags($user->id, $this->profile->id);
-                               
-                               if ($tags) {
-                                       common_element_start('div', 'tags_user');
-                                       common_element_start('dl');
-                                       common_element_start('dt');
-                                       common_element('a', array('href' => common_local_url('tagother',
-                                                                                                                                        array('id' => $this->profile->id))),
-                                                          _('Your tags'));
-                                       common_text(":");
-                                       common_element_end('dt');
-                                       common_element_start('dd');
-                                       common_element_start('ul', 'tags xoxo');
-                                       foreach ($tags as $tag) {
-                                               common_element_start('li');
-                                               common_element('a', array('rel' => "tag",
-                                                                                                 'href' => common_local_url($action,
-                                                                                                                                                        array('nickname' => $user->nickname,
-                                                                                                                                                                  'tag' => $tag))),
-                                                                          $tag);
-                                               common_element_end('li');
-                                       }                                       
-                                       common_element_end('ul');
-                                       common_element_end('dd');
-                                       common_element_end('dl');
-                                       common_element_end('div');
-                               }
-                       }
                }
                
                common_element_end('li');