show dropdown of tags only when tags are available and add tags function to profile

darcs-hash:20081124015802-84dde-d72651ff0c466d15835fe263e96bdd9b34162849.gz
This commit is contained in:
Evan Prodromou 2008-11-23 20:58:02 -05:00
parent 58c7af21db
commit 82696b150e
2 changed files with 24 additions and 9 deletions

View File

@ -145,4 +145,17 @@ class Profile extends Memcached_DataObject
}
return NULL;
}
# Get list of tags we tagged other users with
function getAllTags() {
$profile_tag = new Notice_tag();
$profile_tag->query('SELECT DISTINCT(tag) FROM profile_tag WHERE tagger = ' . $this->id);
$tags = array();
while ($profile_tag->fetch()) {
$tags[] = $profile_tag->tag;
}
$profile_tag->free();
return $tags;
}
}

View File

@ -86,6 +86,7 @@ class GalleryAction extends Action {
foreach ($tags as $t) {
$content[common_local_url($this->trimmed('action'), array('tag' => $t))] = $t;
}
if ($tags) {
common_element('a', array('href' => common_local_url($this->trimmed('action'),
array('nickname' => $profile->nickname))),
_('All'));
@ -95,6 +96,7 @@ class GalleryAction extends Action {
common_submit('go', _('Go'));
common_element_end('form');
}
}
function show_top($profile) {
common_element('div', 'instructions',
@ -119,7 +121,7 @@ class GalleryAction extends Action {
}
# XXX: memcached results
# XXX: SQL injection on $tag
# FIXME: SQL injection on $tag
$other->query('SELECT profile.* ' .
'FROM profile JOIN subscription ' .