aboutsummaryrefslogtreecommitdiff
path: root/views/default/core/river
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-29 18:16:54 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-29 18:16:54 +0000
commit3c083f6c4ff4d354a546e03477e7a4acbb16d4a9 (patch)
tree961ad1135905070b95a51bc0c6bdbd948754b562 /views/default/core/river
parent298114995174acf451cc1477fdeec34a42ef608b (diff)
downloadelgg-3c083f6c4ff4d354a546e03477e7a4acbb16d4a9.tar.gz
elgg-3c083f6c4ff4d354a546e03477e7a4acbb16d4a9.tar.bz2
rewrote the display of likes
git-svn-id: http://code.elgg.org/elgg/trunk@7748 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/core/river')
-rw-r--r--views/default/core/river/controls.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/views/default/core/river/controls.php b/views/default/core/river/controls.php
index e239a2adb..66fbc5059 100644
--- a/views/default/core/river/controls.php
+++ b/views/default/core/river/controls.php
@@ -9,7 +9,7 @@
$object = $vars['item']->getObjectEntity();
if (isloggedin()) {
- // comments and non-objects cannot be commented on
+ // comments and non-objects cannot be commented on or liked
if ($object->getType() == 'object' && $vars['item']->annotation_id == 0) {
$params = array(
'href' => '#',
@@ -18,6 +18,26 @@ if (isloggedin()) {
'internalid' => "elgg-toggler-{$object->getGUID()}",
);
echo elgg_view('output/url', $params);
- //echo elgg_view('forms/likes/link', array('entity' => $object));
+
+ // like this
+ if (!elgg_annotation_exists($object->getGUID(), 'likes')) {
+ $url = "action/likes/add?guid={$object->getGUID()}";
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('likes:likethis'),
+ 'is_action' => true,
+ );
+ echo elgg_view('output/url', $params);
+ } else {
+ $likes = get_annotations($guid, '', '', 'likes', '', get_loggedin_userid());
+ $url = elgg_get_site_url() . "action/likes/delete?annotation_id={$likes[0]->id}";
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('likes:remove'),
+ 'is_action' => true,
+ );
+ echo elgg_view('output/url', $params);
+ }
}
+
} \ No newline at end of file