aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/groups/actions/featured.php44
-rw-r--r--mod/groups/all.php4
-rw-r--r--mod/groups/languages/en.php4
-rw-r--r--mod/groups/start.php1
-rw-r--r--mod/groups/views/default/groups/featured.php21
-rw-r--r--mod/groups/views/default/groups/grouplisting.php15
6 files changed, 85 insertions, 4 deletions
diff --git a/mod/groups/actions/featured.php b/mod/groups/actions/featured.php
new file mode 100644
index 000000000..cfec34ba0
--- /dev/null
+++ b/mod/groups/actions/featured.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * Join a group action.
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ // Load configuration
+ global $CONFIG;
+
+ admin_gatekeeper();
+
+ $group_guid = get_input('group_guid');
+ $action = get_input('action');
+
+ $group = get_entity($group_guid);
+
+ if($group){
+
+ //get the action, is it to feature or unfeature
+ if($action == "feature"){
+
+ $group->featured_group = "yes";
+ system_message(elgg_echo('groups:featuredon'));
+
+ }
+
+ if($action == "unfeature"){
+
+ $group->featured_group = "no";
+ system_message(elgg_echo('groups:unfeatured'));
+
+ }
+
+ }
+
+ forward("pg/groups/world/");
+
+?> \ No newline at end of file
diff --git a/mod/groups/all.php b/mod/groups/all.php
index 5ba34947e..97e5126e3 100644
--- a/mod/groups/all.php
+++ b/mod/groups/all.php
@@ -52,7 +52,9 @@
$area1 .= elgg_view("groups/side_menu");
//featured groups
- $area1 .= elgg_view("groups/featured");
+ $featured_groups = get_entities_from_metadata("featured_group", "yes", "group", "", 0, 10, false, false, false);
+ $area1 .= elgg_view("groups/featured", array("featured" => $featured_groups));
+
set_context($context);
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index d73611dfc..6d9c9c832 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -41,7 +41,9 @@
'groups:noaccess' => 'No access to group',
'groups:cantedit' => 'You can not edit this group',
'groups:saved' => 'Group saved',
-
+ 'groups:featured' => 'Featured groups',
+ 'groups:featuredon' => 'You have made this group a featured one.',
+ 'groups:unfeature' => 'You have removed this group from the featured list',
'groups:joinrequest' => 'Request membership',
'groups:join' => 'Join group',
'groups:leave' => 'Leave group',
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 8b723eb97..ae03c8e2f 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -481,5 +481,6 @@
register_action("groups/addpost",false,$CONFIG->pluginspath . "groups/actions/forums/addpost.php");
register_action("groups/edittopic",false,$CONFIG->pluginspath . "groups/actions/forums/edittopic.php");
register_action("groups/deletepost",false,$CONFIG->pluginspath . "groups/actions/forums/deletepost.php");
+ register_action("groups/featured",false,$CONFIG->pluginspath . "groups/actions/featured.php");
?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/featured.php b/mod/groups/views/default/groups/featured.php
index ab7691a0b..381e01a4d 100644
--- a/mod/groups/views/default/groups/featured.php
+++ b/mod/groups/views/default/groups/featured.php
@@ -4,6 +4,25 @@
* This view will display featured groups - these are set by admin
**/
+
?>
-<h3>Featured groups</h3> \ No newline at end of file
+<h3><?php echo elgg_echo("groups:featured"); ?></h3>
+
+<?php
+ if($vars['featured']){
+
+ foreach($vars['featured'] as $group){
+ $icon = elgg_view(
+ "groups/icon", array(
+ 'entity' => $group,
+ 'size' => 'small',
+ )
+ );
+
+ echo "<div class=\"featured_group\">" . $icon . " " . $group->name . "<br />";
+ echo $group->briefdescription . "</div>";
+
+ }
+ }
+?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/grouplisting.php b/mod/groups/views/default/groups/grouplisting.php
index 8d7e3c6d8..418a3d16f 100644
--- a/mod/groups/views/default/groups/grouplisting.php
+++ b/mod/groups/views/default/groups/grouplisting.php
@@ -25,7 +25,20 @@
else
$mem = elgg_echo("groups:closed");
- $info .= "<div style=\"float:right;\">" . $mem . " / " . elgg_echo("groups:member") . " (" . get_group_members($vars['entity']->guid, 10, 0, 0, true) . ")</div>";
+ //for admins display the feature or unfeature option
+ if($vars['entity']->featured_group == "yes"){
+ $url = $vars['url'] . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action=unfeature";
+ $wording = "Unfeature";
+ }else{
+ $url = $vars['url'] . "action/groups/featured?group_guid=" . $vars['entity']->guid . "&action=feature";
+ $wording = "Make featured";
+ }
+
+ $info .= "<div style=\"float:right;\">" . $mem . " / " . elgg_echo("groups:member") . " (" . get_group_members($vars['entity']->guid, 10, 0, 0, true) . ")<br />";
+ //if admin, show make featured option
+ if(isadminloggedin())
+ $info .= "<a href=\"{$url}\">{$wording}</a>";
+ $info .= "</div>";
$info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></b></p>";
$info .= "<p class=\"owner_timestamp\">" . $vars['entity']->description . "</p>";