diff --git a/manifest.xml b/manifest.xml index 95dda333..9b461c46 100644 --- a/manifest.xml +++ b/manifest.xml @@ -49,6 +49,7 @@ ToDo ==================== - group listing - latest activity in my groups + - my groups (and remove menu item) - group icon cron tool - group invite @@ -57,11 +58,15 @@ ToDo - invitation report - per user what happend - better description of options +- group widgets + - group listing on popular +- closed group, but show widgets ==================== Version History ==================== x.x: + - changed: activity filter in group river widget (now more advanced) - changed: group status (open/closed) CSS 1.8 (2011-11-11): diff --git a/views/default/widgets/group_river_widget/edit.php b/views/default/widgets/group_river_widget/edit.php index ee1c4cf0..b3958f0e 100644 --- a/views/default/widgets/group_river_widget/edit.php +++ b/views/default/widgets/group_river_widget/edit.php @@ -7,8 +7,8 @@ $widget = $vars["entity"]; // filter activity + // get filter options $filter_contents = array(); - $filter_contents['all'] = 'all'; if (!empty($vars['config']->registered_entities)) { foreach ($vars['config']->registered_entities as $type => $ar) { if($type == "user"){ @@ -26,6 +26,28 @@ } } } + + // build selector + $activity_filter = $widget->getMetadata("activity_filter"); + if(empty($activity_filter)){ + // fallback to old situation + $activity_filter = $widget->activity_filter; + } + + if(!empty($activity_filter) && !is_array($activity_filter)){ + $activity_filter = array($activity_filter); + } elseif(empty($activity_filter)){ + $activity_filter = array(); + } + + $filter_selector = elgg_view("input/hidden", array("internalname" => "params[activity_filter][]", "value" => "")); // needed to be able to store no selection + foreach($filter_contents as $label => $content){ + if(in_array($content, $activity_filter)){ + $filter_selector .= "" . elgg_echo($label) . "
"; + } else { + $filter_selector .= "" . elgg_echo($label) . "
"; + } + } if($widget->context != "groups"){ //the user of the widget @@ -72,17 +94,8 @@ echo ""; echo "
"; - echo elgg_echo("filter"); - echo ""; + echo elgg_echo("filter") . "
"; + echo $filter_selector; echo "
"; echo "
"; @@ -108,16 +121,7 @@ echo "
"; echo "
"; - echo elgg_echo("filter"); - echo ""; + echo elgg_echo("filter") . "
"; + echo $filter_selector; echo "
"; } \ No newline at end of file diff --git a/views/default/widgets/group_river_widget/view.php b/views/default/widgets/group_river_widget/view.php index 9d3c556e..8ec37c82 100644 --- a/views/default/widgets/group_river_widget/view.php +++ b/views/default/widgets/group_river_widget/view.php @@ -24,9 +24,20 @@ unset($group_guid[$key]); } - $filter = $widget->activity_filter; - if(empty($filter) || ($filter == "all")){ - $filter = ""; + // get activity filter + $activity_filter = $widget->getMetadata("activity_filter"); + if(empty($activity_filter)){ + // fallback to old situation + $activity_filter = $widget->activity_filter; + if($activity_filter == "all"){ + $activity_filter = array(); + } + } + + if(!empty($activity_filter) && !is_array($activity_filter)){ + $activity_filter = array($activity_filter); + } elseif(empty($activity_filter)){ + $activity_filter = array(); } if(!empty($group_guid)){ @@ -43,17 +54,30 @@ $sql .= " INNER JOIN {$CONFIG->dbprefix}entities AS entities1 ON {$CONFIG->dbprefix}river.object_guid = entities1.guid"; $sql .= " WHERE (entities1.container_guid in (" . implode(",", $group_guid) . ")"; $sql .= " OR {$CONFIG->dbprefix}river.object_guid IN (" . implode(",", $group_guid) . "))"; - if(!empty($filter)){ - list($type, $subtype) = explode(",", $filter); + + if(!empty($activity_filter)){ + $filter_wheres = array(); - if(!empty($type)){ - $sql .= " AND {$CONFIG->dbprefix}river.type = '" . sanitise_string($type) . "'"; + foreach($activity_filter as $filter){ + list($type, $subtype) = explode(",", $filter); + + if(!empty($type)){ + $filter_where = " ({$CONFIG->dbprefix}river.type = '" . sanitise_string($type) . "'"; + + if(!empty($subtype)){ + $filter_where .= " AND {$CONFIG->dbprefix}river.subtype = '" . sanitise_string($subtype) . "'"; + } + + $filter_where .= ")"; + $filter_wheres[] = $filter_where; + } } - if(!empty($subtype)){ - $sql .= " AND {$CONFIG->dbprefix}river.subtype = '" . sanitise_string($subtype) . "'"; + if(!empty($filter_wheres)){ + $sql .= " AND (" . implode(" OR ", $filter_wheres) . ")"; } } + $sql .= " AND " . get_access_sql_suffix("entities1"); $sql .= " ORDER BY {$CONFIG->dbprefix}river.posted DESC"; $sql .= " LIMIT {$offset},{$limit}";