aboutsummaryrefslogtreecommitdiff
path: root/views/default/favorites
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/favorites')
-rw-r--r--views/default/favorites/button.php46
-rw-r--r--views/default/favorites/sidebar.php13
-rw-r--r--views/default/favorites/sidebar/groups.php24
-rw-r--r--views/default/favorites/sidebar/users.php13
-rw-r--r--views/default/favorites/view.php15
5 files changed, 111 insertions, 0 deletions
diff --git a/views/default/favorites/button.php b/views/default/favorites/button.php
new file mode 100644
index 000000000..bc355d595
--- /dev/null
+++ b/views/default/favorites/button.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Elgg Lorea Favorites Plugin
+ *
+ * @package ElggFavorites
+ */
+
+if (!isset($vars['entity'])) {
+ return true;
+}
+
+if (!elgg_is_logged_in()) {
+ return true;
+}
+
+$fav_entity_guid = $vars['entity']->getGUID();
+$fav_user_guid = elgg_get_logged_in_user_guid();
+
+if (!check_entity_relationship($fav_user_guid ,'flags_content', $fav_entity_guid)) {
+
+ $fav_url = elgg_get_site_url() . "action/favorites/add/?guid={$fav_entity_guid}";
+ $fav_params = array(
+ 'href' => $fav_url,
+ 'text' => elgg_view_icon('star-empty'),
+ 'title' => elgg_echo('favorites:add'),
+ 'class' => 'favorites-add',
+ 'is_action' => true,
+ 'is_trusted' => true,
+ );
+ $fav_button = elgg_view('output/url', $fav_params);
+
+} else {
+
+ $fav_url = elgg_get_site_url() . "action/favorites/remove/?guid={$fav_entity_guid}";
+ $fav_params = array(
+ 'href' => $fav_url,
+ 'text' => elgg_view_icon('star'),
+ 'title' => elgg_echo('favorites:remove'),
+ 'class' => 'favorites-remove',
+ 'is_action' => true,
+ 'is_trusted' => true,
+ );
+ $fav_button = elgg_view('output/url', $fav_params);
+}
+
+echo $fav_button;
diff --git a/views/default/favorites/sidebar.php b/views/default/favorites/sidebar.php
new file mode 100644
index 000000000..6e2e94f47
--- /dev/null
+++ b/views/default/favorites/sidebar.php
@@ -0,0 +1,13 @@
+<?php
+if (elgg_is_logged_in()) {
+ if (elgg_get_context() == 'groups')
+ {
+ echo elgg_view("favorites/sidebar/groups", $vars);
+
+
+ }
+ elseif (elgg_get_context() == 'members') {
+ echo elgg_view('favorites/sidebar/users', $vars);
+ }
+}
+?>
diff --git a/views/default/favorites/sidebar/groups.php b/views/default/favorites/sidebar/groups.php
new file mode 100644
index 000000000..89d21b022
--- /dev/null
+++ b/views/default/favorites/sidebar/groups.php
@@ -0,0 +1,24 @@
+<?php
+
+elgg_push_context('widgets');
+
+$fav_group_params = array(
+ 'type' => 'group',
+ 'relationship_guid' => elgg_get_logged_in_user_guid(),
+ 'relationship' => 'flags_content',
+ 'limit' => 0,
+ 'pagination' => false,
+ 'list_type' => 'gallery',
+ 'gallery_class' => 'elgg-gallery-groups',
+ 'full_view' => false
+);
+
+$fav_group_params['count'] = true;
+if(elgg_get_entities_from_relationship($fav_group_params) == 0) {
+ return true;
+}
+$fav_group_params['count'] = false;
+
+$fav_group_body = elgg_list_entities_from_relationship($fav_group_params);
+
+echo elgg_view_module('aside', elgg_echo('favorites:groups'), $fav_group_body);
diff --git a/views/default/favorites/sidebar/users.php b/views/default/favorites/sidebar/users.php
new file mode 100644
index 000000000..681a7728f
--- /dev/null
+++ b/views/default/favorites/sidebar/users.php
@@ -0,0 +1,13 @@
+<?php
+
+$fav_user_body = elgg_list_entities_from_relationship(array(
+ 'relationship' => 'flags_content',
+ 'relationship_guid' => elgg_get_logged_in_user_guid(),
+ 'type' => 'user',
+ 'list_type' => 'gallery',
+ 'gallery_class' => 'elgg-gallery-users',
+ 'pagination' => false,
+));
+if ($fav_user_body) {
+ echo elgg_view_module('aside', elgg_echo('favorites:users'), $fav_user_body);
+}
diff --git a/views/default/favorites/view.php b/views/default/favorites/view.php
new file mode 100644
index 000000000..53e322f39
--- /dev/null
+++ b/views/default/favorites/view.php
@@ -0,0 +1,15 @@
+<?php
+
+if (!elgg_is_logged_in()) {
+ return;
+}
+
+$fav_options = array(
+ 'type' => 'object',
+ 'relationship_guid' => elgg_get_logged_in_user_guid(),
+ 'relationship' => 'flags_content',
+ 'full_view' => FALSE,
+ 'view_type_toggle' => FALSE,
+);
+
+echo elgg_list_entities_from_relationship($fav_options);