From 230748c73d48abcba0f53e49151d775c9b462ffe Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 18 Feb 2009 16:18:56 +0000 Subject: admins can highlight featured groups git-svn-id: https://code.elgg.org/elgg/trunk@2799 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/actions/featured.php | 44 ++++++++++++++++++++++++ mod/groups/all.php | 4 ++- mod/groups/languages/en.php | 4 ++- mod/groups/start.php | 1 + mod/groups/views/default/groups/featured.php | 21 ++++++++++- mod/groups/views/default/groups/grouplisting.php | 15 +++++++- 6 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 mod/groups/actions/featured.php 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 @@ +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 **/ + ?> -

Featured groups

\ No newline at end of file +

+ + $group, + 'size' => 'small', + ) + ); + + echo "
" . $icon . " " . $group->name . "
"; + echo $group->briefdescription . "
"; + + } + } +?> \ 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 .= "
" . $mem . " / " . elgg_echo("groups:member") . " (" . get_group_members($vars['entity']->guid, 10, 0, 0, true) . ")
"; + //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 .= "
" . $mem . " / " . elgg_echo("groups:member") . " (" . get_group_members($vars['entity']->guid, 10, 0, 0, true) . ")
"; + //if admin, show make featured option + if(isadminloggedin()) + $info .= "{$wording}"; + $info .= "
"; $info .= "

getUrl() . "\">" . $vars['entity']->name . "

"; $info .= "

" . $vars['entity']->description . "

"; -- cgit v1.2.3