aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 15:30:38 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 15:30:38 +0000
commit7858fb3f2017b0d42c56cac16328c35f7d287b11 (patch)
tree0bb5e47f7ec0c56a85c25df6f3a6e68c9ce45ac9
parent688a1e02a89e25caba37c91be7ac56d7bdc6dc4a (diff)
downloadelgg-7858fb3f2017b0d42c56cac16328c35f7d287b11.tar.gz
elgg-7858fb3f2017b0d42c56cac16328c35f7d287b11.tar.bz2
Refs #109: Group members widget.
git-svn-id: https://code.elgg.org/elgg/trunk@1294 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/group.php4
-rw-r--r--engine/lib/pageowner.php3
-rw-r--r--mod/groups/languages/en.php9
-rw-r--r--mod/groups/start.php5
-rw-r--r--mod/groups/views/default/widgets/group_members_widget/edit.php23
-rw-r--r--mod/groups/views/default/widgets/group_members_widget/view.php35
6 files changed, 74 insertions, 5 deletions
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 9cb66a871..134206b02 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -142,9 +142,9 @@
* @param int $offset
* @return mixed
*/
- public function getMembers($limit = 10, $offset = 0)
+ public function getMembers($limit = 10, $offset = 0, $count = false)
{
- return get_group_members($this->getGUID(), $limit, $offset);
+ return get_group_members($this->getGUID(), $limit, $offset, 0 , $count);
}
/**
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php
index c6bd5bcaf..dab7110e0 100644
--- a/engine/lib/pageowner.php
+++ b/engine/lib/pageowner.php
@@ -73,7 +73,8 @@
* return the page owner if required
* (Such functions are required to return false if they don't know)
* @uses $CONFIG
- * @param string $functionname The name of the function to call
+ * @param string $functionname The name of the function to call
+ * @return mixed The guid of the owner or false
*/
function add_page_owner_handler($functionname) {
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 3f26a6f0e..cd89c54da 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -77,8 +77,15 @@ or click below to confirm request:
%s",
'groups:river:member' => 'is now a member of',
- 'groups:nowidgets' => 'No widgets defined!',
+ 'groups:nowidgets' => 'No widgets have been defined for this group.',
+
+
+ 'groups:widgets:members:title' => 'Group members',
+ 'groups:widgets:members:description' => 'List the members of a group.',
+ 'groups:widgets:members:label:displaynum' => 'List the members of a group.',
+ 'groups:widgets:members:label:pleaseedit' => 'Please configure this widget.',
+
);
add_translation("en",$english);
diff --git a/mod/groups/start.php b/mod/groups/start.php
index ca402df15..30d93facc 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -53,9 +53,12 @@
// Use group widgets
use_widgets('groups');
- // Add a page owner
+ // Add a page owner handler
add_page_owner_handler('groups_page_owner_handler');
+ // Add some widgets
+ add_widget_type('group_members_widget',elgg_echo('groups:widgets:members:title'), elgg_echo('groups:widgets:members:description'));
+
// For now, we'll hard code the groups profile items as follows:
// TODO make this user configurable
diff --git a/mod/groups/views/default/widgets/group_members_widget/edit.php b/mod/groups/views/default/widgets/group_members_widget/edit.php
new file mode 100644
index 000000000..622877225
--- /dev/null
+++ b/mod/groups/views/default/widgets/group_members_widget/edit.php
@@ -0,0 +1,23 @@
+<?php
+ /**
+ * Edit the widget
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+?>
+<p>
+ <?php echo elgg_echo('groups:widgets:members:label:displaynum'); ?>
+
+ <select name="params[limit]">
+ <option value="5" <?php if ($vars['entity']->limit == 5) echo " selected=\"yes\" "; ?>>5</option>
+ <option value="8" <?php if ((!$vars['entity']->limit) || ($vars['entity']->limit == 8)) echo " selected=\"yes\" "; ?>>8</option>
+ <option value="12" <?php if ($vars['entity']->limit == 12) echo " selected=\"yes\" "; ?>>12</option>
+ <option value="15" <?php if ($vars['entity']->limit == 15) echo " selected=\"yes\" "; ?>>15</option>
+ </select>
+
+ <input type="hidden" name="params[group_guid]" value="<?php echo get_input('group_guid'); ?>" />
+</p> \ No newline at end of file
diff --git a/mod/groups/views/default/widgets/group_members_widget/view.php b/mod/groups/views/default/widgets/group_members_widget/view.php
new file mode 100644
index 000000000..2ff10f706
--- /dev/null
+++ b/mod/groups/views/default/widgets/group_members_widget/view.php
@@ -0,0 +1,35 @@
+<?php
+ /**
+ * View the widget
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $group_guid = get_input('group_guid');
+ $limit = get_input('limit', 8);
+ $offset = 0;
+
+ if ($vars['entity']->limit)
+ $limit = $vars['entity']->limit;
+
+ $group_guid = $vars['entity']->group_guid;
+
+ if ($group_guid)
+ {
+ $group = get_entity($group_guid);
+ $members = $group->getMembers($limit, $offset);
+ $count = $group->getMembers($limit, $offset, true);
+
+ $result = elgg_view_entity_list($members, $count, $offset, $limit, false);
+ }
+ else
+ {
+ $result = elgg_echo('groups:widgets:members:label:pleaseedit');
+ }
+
+ echo $result;
+?> \ No newline at end of file