diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-24 00:12:17 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-24 00:12:17 +0000 |
commit | 01afda7ed87e7def6a411d871daf49522e977b26 (patch) | |
tree | 53a2ca457b94c777db3a808afad0173f4b96095b /views/default/river/item/controls.php | |
parent | 7cca9471c04848c4e41077c83b01089d0736fbed (diff) | |
download | elgg-01afda7ed87e7def6a411d871daf49522e977b26.tar.gz elgg-01afda7ed87e7def6a411d871daf49522e977b26.tar.bz2 |
organized the river views according to the subview pattern
git-svn-id: http://code.elgg.org/elgg/trunk@8452 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/river/item/controls.php')
-rw-r--r-- | views/default/river/item/controls.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/views/default/river/item/controls.php b/views/default/river/item/controls.php new file mode 100644 index 000000000..9c3305635 --- /dev/null +++ b/views/default/river/item/controls.php @@ -0,0 +1,52 @@ +<?php +/** + * Controls on an river item + * + * + * @uses $vars['item'] + */ + +$object = $vars['item']->getObjectEntity(); + +if (elgg_is_logged_in()) { + // comments and non-objects cannot be commented on or liked + if ($vars['item']->annotation_id == 0) { + // comments + if ($object->canComment()) { + $params = array( + 'href' => '#', + 'text' => elgg_echo('generic_comments:text'), + 'class' => "elgg-toggler elgg-toggles-comments-add-{$object->getGUID()}", + ); + echo elgg_view('output/url', $params); + } + + // like this + if ($object->canAnnotate(0, 'likes')) { + 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 { + $options = array( + 'guid' => $guid, + 'annotation_name' => 'likes', + 'owner_guid' => elgg_get_logged_in_user_guid() + ); + $likes = elgg_get_annotations($options); + $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 |