aboutsummaryrefslogtreecommitdiff
path: root/views/default/forms/likes
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-15 12:34:48 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-15 12:34:48 +0000
commitd43e034a36768b945986f827f81618492a58f750 (patch)
treed24eede5913545929a6f3236c36cc1942ccf1304 /views/default/forms/likes
parent2ce0878606a75a38dd2eef9403a9c94529f46d5f (diff)
downloadelgg-d43e034a36768b945986f827f81618492a58f750.tar.gz
elgg-d43e034a36768b945986f827f81618492a58f750.tar.bz2
moved likes forms into forms directory
git-svn-id: http://code.elgg.org/elgg/trunk@7631 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/forms/likes')
-rw-r--r--views/default/forms/likes/display.php23
-rw-r--r--views/default/forms/likes/edit.php45
-rw-r--r--views/default/forms/likes/link.php17
3 files changed, 85 insertions, 0 deletions
diff --git a/views/default/forms/likes/display.php b/views/default/forms/likes/display.php
new file mode 100644
index 000000000..36e2cddc2
--- /dev/null
+++ b/views/default/forms/likes/display.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Elgg likes - display users liked link/text
+ *
+ * @package Elgg
+ *
+ * @uses $vars['entity']
+ */
+
+if (isset($vars['entity']) && isloggedin()) {
+
+ //display the number of likes
+ $numoflikes = elgg_count_likes($vars['entity']);
+ if ($numoflikes != 0) {
+ if ($numoflikes == 1) {
+ $user_string = elgg_echo('likes:userlikedthis');
+ } else {
+ $user_string = elgg_echo('likes:userslikedthis');
+ }
+
+ echo "<a class='river_more_comments off likes_user_list_button link'>" . elgg_count_likes($vars['entity']) . " " . $user_string . "</a>";
+ }
+} \ No newline at end of file
diff --git a/views/default/forms/likes/edit.php b/views/default/forms/likes/edit.php
new file mode 100644
index 000000000..33527b53a
--- /dev/null
+++ b/views/default/forms/likes/edit.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Elgg likes add form
+ *
+ * @package Elgg
+ *
+ * @uses $vars['entity']
+ */
+
+if (isset($vars['entity']) && isloggedin()) {
+ $guid = $vars['entity']->getGuid();
+ $url = elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/likes/add?guid={$guid}");
+
+ echo "<span class='likes-list-holder'>";
+ //check to see if the user has already liked
+ if (!elgg_annotation_exists($guid, 'likes') ) {
+ echo "<a class='user-like link' title='".elgg_echo('likes:likethis')."' href=\"{$url}\">" . elgg_echo('likes:likethis') . "</a>";
+ $likes_classname = "not-liked";
+ $likes_titletag = "";
+ } else {
+ $likes_titletag = "title='".elgg_echo('likes:remove')."'";
+ }
+ //display the number of likes
+ $numoflikes = elgg_count_likes($vars['entity']);
+ if ($numoflikes != 0) {
+ if ($numoflikes == 1) {
+ $user_string = elgg_echo('likes:userlikedthis');
+ } else {
+ $user_string = elgg_echo('likes:userslikedthis');
+ }
+
+ echo "<a class='likes-list-button link {$likes_classname}' {$likes_titletag}>" . elgg_count_likes($vars['entity']) . " " . $user_string . "</a>";
+
+ //show the users who liked the object
+ echo "<div class='likes-list hidden clearfix'>";
+ echo list_annotations($vars['entity']->getGUID(), 'likes', 99);
+ echo "</div>";
+ }
+ echo "</span>";
+}
+
+
+
+
+
diff --git a/views/default/forms/likes/link.php b/views/default/forms/likes/link.php
new file mode 100644
index 000000000..decb4aa7f
--- /dev/null
+++ b/views/default/forms/likes/link.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg likes link form - used on riverdashboard where we want the likes link separate from the list of users that liked the object
+ *
+ * @package Elgg
+ *
+ * @uses $vars['entity']
+ */
+
+if (isset($vars['entity']) && isloggedin()) {
+ $guid = $vars['entity']->getGuid();
+ $url = elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/likes/add?guid={$guid}");
+ //check to see if the user has already liked
+ if (!elgg_annotation_exists($guid, 'likes') ) {
+ echo "<span class='river_link_divider'> | </span><a class='river_user-like_button link' href=\"{$url}\">" . elgg_echo('likes:likethis') . "</a>";
+ }
+} \ No newline at end of file