aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-26 12:30:18 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-26 12:30:18 +0000
commit12da36e25bc1bab6b3235117399f265b7514c4f1 (patch)
treef5dfa342bc9ae4dce29fc8938ac16fc0865a5021
parent12826e2cd95c2b6e3dfdd637a2529ea25ef3f310 (diff)
downloadelgg-12da36e25bc1bab6b3235117399f265b7514c4f1.tar.gz
elgg-12da36e25bc1bab6b3235117399f265b7514c4f1.tar.bz2
adding activity module to groups
git-svn-id: http://code.elgg.org/elgg/trunk@7941 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/groups/languages/en.php3
-rw-r--r--mod/groups/start.php37
-rw-r--r--mod/groups/views/default/groups/css.php2
-rw-r--r--mod/groups/views/default/groups/profile/activity_module.php (renamed from mod/groups/views/default/groups/profile/activity_widget.php)41
-rw-r--r--mod/groups/views/default/groups/profile/widgets.php5
5 files changed, 67 insertions, 21 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 7ea83bcee..c16db859a 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -56,8 +56,11 @@ $english = array(
'groups:viagroups' => "via groups",
'groups:group' => "Group",
'groups:search:tags' => "tag",
+
'groups:activity' => "Group activity",
+ 'groups:enableactivity' => 'Enable group activity',
'groups:no_activity' => "There is no group activity yet",
+
'groups:notfound' => "Group not found",
'groups:notfound:details' => "The requested group either does not exist or you do not have access to it",
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 0abd48571..72ea31480 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -50,6 +50,13 @@ function groups_init() {
// Add some widgets
elgg_register_widget_type('a_users_groups', elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description'));
+ // add group activity tool option
+ add_group_tool_option('activity', elgg_echo('groups:enableactivity'), true);
+ elgg_extend_view('groups/tool_latest', 'groups/profile/activity_module');
+
+ // add link to owner block
+ elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'groups_activity_owner_block_menu');
+
//extend some views
elgg_extend_view('profile/icon', 'groups/icon');
@@ -126,7 +133,7 @@ function groups_submenus() {
global $CONFIG;
// Get the page owner entity
- $page_owner = elgg_get_page_owner();
+ $page_owner = elgg_get_page_owner_entity();
if (elgg_get_context() == 'groups') {
if ($page_owner instanceof ElggGroup) {
@@ -257,6 +264,20 @@ function groups_url($entity) {
return "pg/groups/profile/{$entity->guid}/$title";
}
+/**
+ * Add owner block link
+ */
+function groups_activity_owner_block_menu($hook, $type, $return, $params) {
+ if (elgg_instanceof($params['entity'], 'group')) {
+ if ($params['entity']->activity_enable != "no") {
+ $url = "pg/groups/activity/{$params['entity']->guid}";
+ $item = new ElggMenuItem('activity', elgg_echo('groups:activity'), $url);
+ $return[] = $item;
+ }
+ }
+
+ return $return;
+}
/**
* Groups created so create an access list for it
@@ -302,7 +323,7 @@ function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
* Return the write access for the current group if the user has write access to it.
*/
function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params) {
- $page_owner = elgg_get_page_owner();
+ $page_owner = elgg_get_page_owner_entity();
if (!$loggedin = get_loggedin_user()) {
return $returnvalue;
}
@@ -443,18 +464,6 @@ function group_access_options($group) {
return $access_array;
}
-function forum_profile_menu($hook, $entity_type, $return_value, $params) {
- global $CONFIG;
-
- if ($params['owner'] instanceof ElggGroup && $group_owner->forum_enable != 'no') {
- $return_value[] = array(
- 'text' => elgg_echo('groups:forum'),
- 'href' => "pg/groups/forum/{$params['owner']->getGUID()}"
- );
- }
- return $return_value;
-}
-
function activity_profile_menu($hook, $entity_type, $return_value, $params) {
global $CONFIG;
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 5a7366fe3..5be21e981 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -17,7 +17,7 @@
margin-right: 30px;
}
-#group_tools_latest > .elgg-module .elgg-head {
+#group_tools_latest > .elgg-module > .elgg-inner > .elgg-head {
padding: 5px 5px 3px;
background-color: #e4e4e4;
border-bottom: 1px solid #cccccc;
diff --git a/mod/groups/views/default/groups/profile/activity_widget.php b/mod/groups/views/default/groups/profile/activity_module.php
index 3ac385553..8a2d587c9 100644
--- a/mod/groups/views/default/groups/profile/activity_widget.php
+++ b/mod/groups/views/default/groups/profile/activity_module.php
@@ -4,11 +4,50 @@
*
* @package Groups
*/
+
+global $CONFIG;
+
+if ($vars['entity']->activity_enable == 'no') {
+ return true;
+}
+
+$group = $vars['entity'];
+
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "pg/groups/activity/$group->guid",
+ 'text' => elgg_echo('link:view:all'),
+));
+
+$header = "<span class=\"group-widget-viewall\">$all_link</span>";
+$header .= '<h3>' . elgg_echo('groups:activity') . '</h3>';
+
+
+elgg_push_context('widgets');
+$content = elgg_list_river(array(
+ 'limit' => 4,
+ 'pagination' => false,
+ 'joins' => array("join {$CONFIG->dbprefix}entities e1 on e1.guid = rv.object_guid"),
+ 'wheres' => array("(e1.container_guid = $group->guid)"),
+));
+elgg_pop_context();
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('groups:activity:none') . '</p>';
+}
+
+$params = array(
+ 'header' => $header,
+ 'body' => $content,
+);
+echo elgg_view('layout/objects/module', $params);
+
+return true;
?>
<span class="group_widget_link"><a href="<?php echo elgg_get_site_url() . "pg/groups/activity/" . elgg_get_page_owner_guid(); ?>"><?php echo elgg_echo('link:view:all')?></a></span>
<h3><?php echo elgg_echo("activity"); ?></h3>
<?php
- $owner = elgg_get_page_owner();
+ $owner = elgg_get_page_owner_entity();
$group_guid = $owner->guid;
$limit = 5;
diff --git a/mod/groups/views/default/groups/profile/widgets.php b/mod/groups/views/default/groups/profile/widgets.php
index 3e28c0091..b72932ab3 100644
--- a/mod/groups/views/default/groups/profile/widgets.php
+++ b/mod/groups/views/default/groups/profile/widgets.php
@@ -7,11 +7,6 @@
// tools widget area
echo "<div id='group_tools_latest' class='clearfix'>";
-
- // activity latest
- echo "<div class='group_tool_widget activity clearfix'>";
- echo elgg_view("groups/profile/activity_widget", array('entity' => $vars['entity']));
- echo "</div>";
// enable tools to extend this area
echo elgg_view("groups/tool_latest", array('entity' => $vars['entity']));