diff options
Diffstat (limited to 'mod/likes/views')
-rw-r--r-- | mod/likes/views/default/likes/button.php | 25 | ||||
-rw-r--r-- | mod/likes/views/default/likes/count.php | 30 | ||||
-rw-r--r-- | mod/likes/views/default/likes/css.php | 4 |
3 files changed, 35 insertions, 24 deletions
diff --git a/mod/likes/views/default/likes/button.php b/mod/likes/views/default/likes/button.php index 2dc50ddd0..383e1bb63 100644 --- a/mod/likes/views/default/likes/button.php +++ b/mod/likes/views/default/likes/button.php @@ -1,6 +1,6 @@ <?php /** - * Elgg likes display + * Elgg likes button * * @uses $vars['entity'] */ @@ -40,26 +40,3 @@ if (elgg_is_logged_in() && $vars['entity']->canAnnotate(0, 'likes')) { } echo $likes_button; - -$list = ''; -$num_of_likes = likes_count($vars['entity']); - -if ($num_of_likes) { - // display the number of likes - if ($num_of_likes == 1) { - $likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes)); - } else { - $likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes)); - } - $params = array( - 'text' => $likes_string, - 'title' => elgg_echo('likes:see'), - 'rel' => 'popup', - 'href' => "#likes-$guid" - ); - $list = elgg_view('output/url', $params); - $list .= "<div class='elgg-module elgg-module-popup elgg-likes-list hidden clearfix' id='likes-$guid'>"; - $list .= elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99)); - $list .= "</div>"; - echo $list; -} diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php new file mode 100644 index 000000000..3d03fec66 --- /dev/null +++ b/mod/likes/views/default/likes/count.php @@ -0,0 +1,30 @@ +<?php +/** + * Count of who has liked something + * + * @uses $vars['entity'] + */ + + +$list = ''; +$num_of_likes = likes_count($vars['entity']); + +if ($num_of_likes) { + // display the number of likes + if ($num_of_likes == 1) { + $likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes)); + } else { + $likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes)); + } + $params = array( + 'text' => $likes_string, + 'title' => elgg_echo('likes:see'), + 'rel' => 'popup', + 'href' => "#likes-$guid" + ); + $list = elgg_view('output/url', $params); + $list .= "<div class='elgg-module elgg-module-popup elgg-likes-list hidden clearfix' id='likes-$guid'>"; + $list .= elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99)); + $list .= "</div>"; + echo $list; +} diff --git a/mod/likes/views/default/likes/css.php b/mod/likes/views/default/likes/css.php index cb0334b7c..fabf54e46 100644 --- a/mod/likes/views/default/likes/css.php +++ b/mod/likes/views/default/likes/css.php @@ -11,3 +11,7 @@ width: 345px; position: absolute; } + +.elgg-menu .elgg-menu-item-likes-count { + margin-left: 3px; +} |