i have installed elgg to my system. also added a AU Subgroups plugin. Wish to create a tree view hierarchy which shows all the groups and sub-group of a particular user Login .. please Help me out (step by step)... Im new to elgg . . .
For example if a group ABC engineering college have sub group as Faculties ,mtec btec and each sub groups have Class of 2005,class of 2006 and all...
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Sidharth@sidharth.s33
Sidharth - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Sidharth@sidharth.s33
Sidharth - 0 likes
- Revletta@Revletta
Revletta - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
You must log in to post replies.im w8ing for an answer....!!! :( please help me out ? ??
There's a lot of steps, more than would be simple to write out here.
I suggest you familiarize yourself with Elgg first, the views system in particular.
Then you need to inspect the au_subgroups plugin to see how the groups are related, and how to get a list of child-groups. Then you need to use that to create a recursive function to build the tree, and render it using something like the jstree. See the pages plugin for an example of that.
i have written a code to get details of groups which are joined by the user ... but how to differentiate between child and parent...? please help me out for that...
function groups_yours_menu() {
$viewer = elgg_get_logged_in_user_entity();
//read viewer's groups
$content = elgg_get_entities_from_relationship(array(
'type' => 'group',
'relationship' => 'member',
'relationship_guid' => elgg_get_logged_in_user_guid(),
'inverse_relationship' => false,
'limit' => 0,
));
//create array of entries ($content object had duplicate entries, array keys prevent duplicates (sry for being lazy)
$groupmenu_array = Array();
foreach ($content as $mygroup) {
$groupmenu_array[(string)$mygroup->get('guid')] = $mygroup->get('name');
//print_r ($mygroup);
}
//sort array while keeping the IDs
asort($groupmenu_array);
//create HTML code out of array
foreach ($groupmenu_array as $group_guid=>$group_name) {
$groupmenu .= '<div>'.elgg_view('output/url', array('href' => "groups/profile/$group_guid",'text' => $group_name, 'is_trusted' => true,)).'</a></div>';
}
//add wrapping divs around menu and logo (</a> to close link generated by register_menu_item)
/*$groupmenu = '</a><div id="topbar-mygroups" style="height:22px;">'. elgg_view('output/url', array('href' => "groups/member/{$viewer->username}",'text' => elgg_view_icon('share'), 'is_trusted' => true, 'title' => 'Your groups')) . '<div id="topbar-groupmenu" style="display:none; position:absolute; background-color:#EEEEEE; white-space:nowrap; padding:3px; margin-top: 4px;">' . $groupmenu . '</div></div><a>';*/
//adding the new menu to the topbar
$value = array(
'name' => 'mygroups',
'href' => "",
'text' => $groupmenu,
'title' => elgg_echo('groups:yours'),
'priority' => 250,
);
// echo "<br><br>";
// var_dump($value);
elgg_register_menu_item('site', $value);
Interesting...!!
I would also like to know about it.
There are some functions in the plugin you can use, I don't remember them offhand but you should be able to find them by their names in lib/functions.php
It will be something like au_subgroups_get_children($group)