aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/subgroups/views/default')
-rw-r--r--mod/subgroups/views/default/forms/groups/edit.php142
-rw-r--r--mod/subgroups/views/default/forms/subgroups/add.php37
-rw-r--r--mod/subgroups/views/default/group/default.php39
-rw-r--r--mod/subgroups/views/default/group/elements/summary.php67
-rw-r--r--mod/subgroups/views/default/groups/css/elements/components.php6
-rw-r--r--mod/subgroups/views/default/groups/group_sort_menu.php46
-rw-r--r--mod/subgroups/views/default/groups/profile/fields.php41
-rw-r--r--mod/subgroups/views/default/groups/sidebar/subgroups.php44
-rw-r--r--mod/subgroups/views/default/icon/default.php58
-rw-r--r--mod/subgroups/views/default/input/autocomplete.php57
-rw-r--r--mod/subgroups/views/default/navigation/breadcrumbs.php83
-rw-r--r--mod/subgroups/views/default/subgroups/group_module.php51
-rw-r--r--mod/subgroups/views/default/subgroups/groups_i_can_edit.php71
-rw-r--r--mod/subgroups/views/default/subgroups/subgroups_icons.php11
14 files changed, 753 insertions, 0 deletions
diff --git a/mod/subgroups/views/default/forms/groups/edit.php b/mod/subgroups/views/default/forms/groups/edit.php
new file mode 100644
index 000000000..e2f9fb394
--- /dev/null
+++ b/mod/subgroups/views/default/forms/groups/edit.php
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Group edit form
+ *
+ * @package ElggGroups
+ */
+
+// only extract these elements.
+$name = $membership = $vis = $entity = null;
+extract($vars, EXTR_IF_EXISTS);
+
+?>
+<div>
+ <label><?php echo elgg_echo("groups:icon"); ?></label><br />
+ <?php echo elgg_view("input/file", array('name' => 'icon')); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo("groups:name"); ?></label><br />
+ <?php echo elgg_view("input/text", array(
+ 'name' => 'name',
+ 'value' => $name
+ ));
+ ?>
+</div>
+<?php
+
+$group_profile_fields = elgg_get_config('group');
+unset($group_profile_fields['container_guid']);
+
+if ($group_profile_fields > 0) {
+ foreach ($group_profile_fields as $shortname => $valtype) {
+ $line_break = '<br />';
+ if ($valtype == 'longtext') {
+ $line_break = '';
+ }
+ echo '<div><label>';
+ echo elgg_echo("groups:{$shortname}");
+ echo "</label>$line_break";
+ echo elgg_view("input/{$valtype}", array(
+ 'name' => $shortname,
+ 'value' => elgg_extract($shortname, $vars)
+ ));
+ echo '</div>';
+ }
+}
+?>
+
+<div>
+ <label>
+ <?php echo elgg_echo('groups:membership'); ?><br />
+ <?php echo elgg_view('input/dropdown', array(
+ 'name' => 'membership',
+ 'value' => $membership,
+ 'options_values' => array(
+ ACCESS_PRIVATE => elgg_echo('groups:access:private'),
+ ACCESS_PUBLIC => elgg_echo('groups:access:public')
+ )
+ ));
+ ?>
+ </label>
+</div>
+
+<?php
+
+if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
+ $access_options = array(
+ ACCESS_PRIVATE => elgg_echo('groups:access:group'),
+ ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
+ ACCESS_PUBLIC => elgg_echo("PUBLIC")
+ );
+?>
+
+<div>
+ <label>
+ <?php echo elgg_echo('groups:visibility'); ?><br />
+ <?php echo elgg_view('input/access', array(
+ 'name' => 'vis',
+ 'value' => $vis,
+ 'options_values' => $access_options,
+ ));
+ ?>
+ </label>
+</div>
+
+<?php
+}
+
+$tools = elgg_get_config('group_tool_options');
+if ($tools) {
+ usort($tools, create_function('$a,$b', 'return strcmp($a->label,$b->label);'));
+ foreach ($tools as $group_option) {
+ $group_option_toggle_name = $group_option->name . "_enable";
+ $value = elgg_extract($group_option_toggle_name, $vars);
+?>
+<div>
+ <label>
+ <?php echo $group_option->label; ?><br />
+ </label>
+ <?php echo elgg_view("input/radio", array(
+ "name" => $group_option_toggle_name,
+ "value" => $value,
+ 'options' => array(
+ elgg_echo('groups:yes') => 'yes',
+ elgg_echo('groups:no') => 'no',
+ ),
+ ));
+ ?>
+</div>
+<?php
+ }
+}
+?>
+<div class="elgg-foot">
+<?php
+
+if (isset($entity)) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'group_guid',
+ 'value' => $entity->getGUID(),
+ ));
+}
+
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => isset($vars['entity']) ?
+ $entity->getContainerGUID() :
+ get_input('container_guid'),
+));
+
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+if (isset($entity)) {
+ $delete_url = 'action/groups/delete?guid=' . $entity->getGUID();
+ echo elgg_view('output/confirmlink', array(
+ 'text' => elgg_echo('groups:delete'),
+ 'href' => $delete_url,
+ 'confirm' => elgg_echo('groups:deletewarning'),
+ 'class' => 'elgg-button elgg-button-delete float-alt',
+ ));
+}
+?>
+</div>
diff --git a/mod/subgroups/views/default/forms/subgroups/add.php b/mod/subgroups/views/default/forms/subgroups/add.php
new file mode 100644
index 000000000..f0349a728
--- /dev/null
+++ b/mod/subgroups/views/default/forms/subgroups/add.php
@@ -0,0 +1,37 @@
+<label class="subgroups-add-autocomplete" style="display:none">
+<?php
+ echo elgg_echo('subgroups:add:label'); echo '<br />';
+ echo elgg_view('input/autocomplete', array(
+ 'name' => 'othergroup',
+ 'livesearch_url' => elgg_get_site_url().'ajax/view/subgroups/groups_i_can_edit',
+ 'class' => 'mvm',
+ ));
+?>
+</label>
+<label class="subgroups-add-url">
+<?php
+ echo elgg_echo('subgroups:addurl:label'); echo '<br />';
+ echo elgg_view('input/url', array('name' => 'othergroup_url', 'class' => 'mvm'));
+?>
+</label>
+<?php
+ echo elgg_view('input/hidden', array(
+ 'name' => 'group',
+ 'value' => $vars['group']->guid));
+ echo elgg_view('input/submit', array(
+ 'value' => elgg_echo('subgroups:add:button')));
+?>
+<a href="" class="subgroups-dontwork-link mlm" style="display:none">(<?php echo elgg_echo('subgroups:dontwork'); ?>)</a>
+
+<script type="text/javascript">
+$(function(){
+ $('.subgroups-add-autocomplete').show();
+ $('.subgroups-add-url').hide();
+ $('.subgroups-dontwork-link').show().click(function(){
+ $('.subgroups-add-autocomplete').hide();
+ $('.subgroups-add-url').show();
+ $(this).hide();
+ return false;
+ });
+});
+</script>
diff --git a/mod/subgroups/views/default/group/default.php b/mod/subgroups/views/default/group/default.php
new file mode 100644
index 000000000..9c0356550
--- /dev/null
+++ b/mod/subgroups/views/default/group/default.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Group entity view
+ *
+ * @package ElggGroups
+ */
+
+$group = $vars['entity'];
+
+$icon = elgg_view_entity_icon($group, 'tiny');
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $group,
+ 'handler' => 'groups',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if (elgg_get_context() == 'gallery') {
+ echo $icon;
+} elseif ($vars['full_view']) {
+ echo elgg_view("groups/profile/profile_block", $vars);
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $group,
+ 'metadata' => $metadata,
+ 'subtitle' => $group->briefdescription,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('group/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body, $vars);
+}
diff --git a/mod/subgroups/views/default/group/elements/summary.php b/mod/subgroups/views/default/group/elements/summary.php
new file mode 100644
index 000000000..a95d1e296
--- /dev/null
+++ b/mod/subgroups/views/default/group/elements/summary.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Group summary
+ *
+ * @uses $vars['entity'] ElggEntity
+ * @uses $vars['title'] Title link (optional) false = no title, '' = default
+ * @uses $vars['metadata'] HTML for entity menu and metadata (optional)
+ * @uses $vars['subtitle'] HTML for the subtitle (optional)
+ * @uses $vars['tags'] HTML for the tags (optional)
+ * @uses $vars['content'] HTML for the entity content (optional)
+ */
+
+$entity = $vars['entity'];
+
+$title_link = elgg_extract('title', $vars, '');
+if ($title_link === '') {
+ if (isset($entity->title)) {
+ $text = $entity->title;
+ } else {
+ $text = $entity->name;
+ }
+ $params = array(
+ 'text' => $text,
+ 'href' => $entity->getURL(),
+ 'is_trusted' => true,
+ );
+ $title_link = elgg_view('output/url', $params);
+}
+
+$metadata = elgg_extract('metadata', $vars, '');
+$subtitle = elgg_extract('subtitle', $vars, '');
+$content = elgg_extract('content', $vars, '');
+
+$container = get_entity($entity->container_guid);
+
+$tags = elgg_extract('tags', $vars, '');
+if ($tags !== false) {
+ $tags = elgg_view('output/tags', array('tags' => $entity->tags));
+}
+
+if ($metadata) {
+ echo $metadata;
+}
+if ($title_link) {
+ echo "<h3>$title_link</h3>";
+}
+if(elgg_instanceof($container, 'group')) {
+ $container_link = elgg_view('output/url', array(
+ 'text' => $container->name,
+ 'href' => $container->getURL(),
+ 'is_trusted' => true,
+ ));
+ $container_link = elgg_echo('subgroups:owner:single', array($container_link));
+ echo "<div class=\"elgg-subtext\">$container_link</div>";
+}
+echo "<div class=\"elgg-subtext\">$subtitle</div>";
+
+$subgroups = elgg_view('subgroups/subgroups_icons', array('entity' => $entity));
+echo "<div class=\"subgroups-icons\">$subgroups</div>";
+
+echo $tags;
+
+echo elgg_view('object/summary/extend', $vars);
+
+if ($content) {
+ echo "<div class=\"elgg-content\">$content</div>";
+}
diff --git a/mod/subgroups/views/default/groups/css/elements/components.php b/mod/subgroups/views/default/groups/css/elements/components.php
new file mode 100644
index 000000000..0198fa309
--- /dev/null
+++ b/mod/subgroups/views/default/groups/css/elements/components.php
@@ -0,0 +1,6 @@
+/* ***************************************
+ Gallery
+*************************************** */
+.elgg-gallery-groups > li {
+ margin: 0 2px;
+}
diff --git a/mod/subgroups/views/default/groups/group_sort_menu.php b/mod/subgroups/views/default/groups/group_sort_menu.php
new file mode 100644
index 000000000..7e4d1bca6
--- /dev/null
+++ b/mod/subgroups/views/default/groups/group_sort_menu.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * All groups listing page navigation
+ *
+ * @uses $vars['selected'] Name of the tab that has been selected
+ */
+
+$tabs = array(
+ 'newest' => array(
+ 'text' => elgg_echo('groups:newest'),
+ 'href' => 'groups/all?filter=newest',
+ 'priority' => 200,
+ ),
+
+ 'popular' => array(
+ 'text' => elgg_echo('groups:popular'),
+ 'href' => 'groups/all?filter=popular',
+ 'priority' => 400,
+ ),
+
+ 'discussion' => array(
+ 'text' => elgg_echo('groups:latestdiscussion'),
+ 'href' => 'groups/all?filter=discussion',
+ 'priority' => 500,
+ ),
+);
+
+if ($user = elgg_get_logged_in_user_entity()) {
+ $tabs['member'] = array(
+ 'text' => elgg_echo('groups:yours'),
+ 'href' => "groups/member/$user->username",
+ 'priority' => 300,
+ );
+}
+
+foreach ($tabs as $name => $tab) {
+ $tab['name'] = $name;
+
+ if ($vars['selected'] == $name) {
+ $tab['selected'] = true;
+ }
+
+ elgg_register_menu_item('filter', $tab);
+}
+
+echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
diff --git a/mod/subgroups/views/default/groups/profile/fields.php b/mod/subgroups/views/default/groups/profile/fields.php
new file mode 100644
index 000000000..41b0de9a0
--- /dev/null
+++ b/mod/subgroups/views/default/groups/profile/fields.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Group profile fields
+ */
+
+$group = $vars['entity'];
+
+$profile_fields = elgg_get_config('group');
+
+if (is_array($profile_fields) && count($profile_fields) > 0) {
+
+ $even_odd = 'odd';
+ foreach ($profile_fields as $key => $valtype) {
+ // do not show the name or hidden values
+ if ($key == 'name' || $valtype == 'hidden') {
+ continue;
+ }
+
+ $value = $group->$key;
+ if (empty($value)) {
+ continue;
+ }
+
+ $options = array('value' => $group->$key);
+ if ($valtype == 'tags') {
+ $options['tag_names'] = $key;
+ }
+
+ if ($output = elgg_view("output/$valtype", $options)) {
+
+ echo "<div class=\"{$even_odd}\">";
+ echo "<b>";
+ echo elgg_echo("groups:$key");
+ echo ": </b>";
+ echo $output;
+ echo "</div>";
+
+ $even_odd = ($even_odd == 'even') ? 'odd' : 'even';
+ }
+ }
+}
diff --git a/mod/subgroups/views/default/groups/sidebar/subgroups.php b/mod/subgroups/views/default/groups/sidebar/subgroups.php
new file mode 100644
index 000000000..35ffbaef9
--- /dev/null
+++ b/mod/subgroups/views/default/groups/sidebar/subgroups.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Subgroups sidebar
+ *
+ * @package ElggSubgroups
+ *
+ * @uses $vars['entity'] Group entity
+ * @uses $vars['limit'] The number of subgroups to display
+ */
+
+$owner = elgg_get_page_owner_entity();
+
+if(!elgg_instanceof($owner, 'group')) {
+ return false;
+}
+
+$limit = elgg_extract('limit', $vars, 10);
+
+$all_link = elgg_view('output/url', array(
+ 'href' => 'subgroups/owner/' . $owner->guid,
+ 'text' => elgg_echo('subgroups:more'),
+ 'is_trusted' => true,
+));
+
+$params = array(
+ 'type' => 'group',
+ 'container_guid' => $owner->guid,
+ 'limit' => $limit,
+ 'types' => 'group',
+ 'list_type' => 'gallery',
+ 'gallery_class' => 'elgg-gallery-groups',
+ 'full_view' => false
+);
+
+$params['count'] = true;
+if(elgg_get_entities($params) == 0) {
+ return true;
+}
+$params['count'] = false;
+
+$body = elgg_list_entities($params);
+$body .= "<div class='center mts'>$all_link</div>";
+
+echo elgg_view_module('aside', elgg_echo('subgroups'), $body);
diff --git a/mod/subgroups/views/default/icon/default.php b/mod/subgroups/views/default/icon/default.php
new file mode 100644
index 000000000..3ef1a05a1
--- /dev/null
+++ b/mod/subgroups/views/default/icon/default.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Generic icon view.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method
+ * @uses $vars['size'] topbar, tiny, small, medium (default), large, master
+ * @uses $vars['href'] Optional override for link
+ * @uses $vars['img_class'] Optional CSS class added to img
+ * @uses $vars['link_class'] Optional CSS class for the link
+ */
+
+$entity = $vars['entity'];
+
+$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar');
+// Get size
+if (!in_array($vars['size'], $sizes)) {
+ $vars['size'] = "medium";
+}
+
+$class = elgg_extract('img_class', $vars, '');
+
+if (isset($entity->name)) {
+ $title = $entity->name;
+} else {
+ $title = $entity->title;
+}
+$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false);
+
+$url = $entity->getURL();
+if (isset($vars['href'])) {
+ $url = $vars['href'];
+}
+
+$img = elgg_view('output/img', array(
+ 'src' => $entity->getIconURL($vars['size']),
+ 'alt' => $title,
+ 'class' => $class,
+));
+
+if ($url) {
+ $params = array(
+ 'href' => $url,
+ 'text' => $img,
+ 'title' => $title,
+ 'is_trusted' => true,
+ );
+ $class = elgg_extract('link_class', $vars, '');
+ if ($class) {
+ $params['class'] = $class;
+ }
+
+ echo elgg_view('output/url', $params);
+} else {
+ echo $img;
+}
diff --git a/mod/subgroups/views/default/input/autocomplete.php b/mod/subgroups/views/default/input/autocomplete.php
new file mode 100644
index 000000000..4eedac22a
--- /dev/null
+++ b/mod/subgroups/views/default/input/autocomplete.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Displays an autocomplete text input.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @todo This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page.
+ *
+ * @uses $vars['value'] Current value for the text input
+ * @uses $vars['match_on'] Array | str What to match on. all|array(groups|users|friends)
+ * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user.
+ * @uses $vars['livesearsh_url'] Alternative livesearch URL
+ * @uses $vars['class'] Additional CSS class
+ */
+
+if (isset($vars['class'])) {
+ $vars['class'] = "elgg-input-autocomplete {$vars['class']}";
+} else {
+ $vars['class'] = "elgg-input-autocomplete";
+}
+
+if (isset($vars['livesearch_url'])) {
+ $livesearch_url = $vars['livesearch_url'];
+ unset($vars['livesearch_url']);
+} else {
+ $livesearch_url = elgg_get_site_url() . 'livesearch';
+}
+
+$defaults = array(
+ 'value' => '',
+ 'disabled' => false,
+);
+
+$vars = array_merge($defaults, $vars);
+
+$params = array();
+if (isset($vars['match_on'])) {
+ $params['match_on'] = $vars['match_on'];
+ unset($vars['match_on']);
+}
+if (isset($vars['match_owner'])) {
+ $params['match_owner'] = $vars['match_owner'];
+ unset($vars['match_owner']);
+}
+$ac_url_params = http_build_query($params);
+
+elgg_load_js('elgg.autocomplete');
+elgg_load_js('jquery.ui.autocomplete.html');
+
+?>
+
+<script type="text/javascript">
+elgg.provide('elgg.autocomplete');
+elgg.autocomplete.url = "<?php echo $livesearch_url . '?' . $ac_url_params; ?>";
+</script>
+<input type="text" <?php echo elgg_format_attributes($vars); ?> />
diff --git a/mod/subgroups/views/default/navigation/breadcrumbs.php b/mod/subgroups/views/default/navigation/breadcrumbs.php
new file mode 100644
index 000000000..6ceb5eacc
--- /dev/null
+++ b/mod/subgroups/views/default/navigation/breadcrumbs.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Displays breadcrumbs.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['breadcrumbs'] (Optional) Array of arrays with keys 'title' and 'link'
+ * @uses $vars['class']
+ *
+ * @see elgg_push_breadcrumb
+ */
+
+if (isset($vars['breadcrumbs'])) {
+ $breadcrumbs = $vars['breadcrumbs'];
+} else {
+ $breadcrumbs = elgg_get_breadcrumbs();
+}
+
+
+$page_owner = elgg_get_page_owner_entity();
+
+if(elgg_instanceof($page_owner, 'group')) {
+
+ // $breadcrumbs[1] should corresponds to group's breadcrumb
+ // we'll look for it in crumbs link
+
+ $link = $breadcrumbs[1]['link'];
+ $guid = (string) $page_owner->guid;
+ $alias = $page_owner->alias;
+
+ $title = $breadcrumbs[1]['title'];
+ $name = $page_owner->name;
+
+ if(strpos($link, $guid) || $alias && strpos($link, $alias) || !$link && $title == $name) {
+ $first_crumb = array_shift($breadcrumbs);
+ $container = get_entity($page_owner->container_guid);
+ while(elgg_instanceof($container, 'group')) {
+
+ // TODO: I should find a better solution for this.
+ if(strpos($first_crumb['link'], 'groups') !== false) {
+ $container_link = str_replace('all', "profile/$container->guid", $first_crumb['link']);
+ } elseif(strpos($first_crumb['link'], 'discussion') !== false) {
+ $container_link = str_replace('all', "owner/$container->guid", $first_crumb['link']);
+ } else {
+ $container_link = str_replace('all', "group/$container->guid", $first_crumb['link']);
+ }
+
+ $container_link = elgg_trigger_plugin_hook('container_crumb_link', 'breadcrumbs', array('container' => $container, 'first_crumb' => $first_crumb), $container_link);
+
+ array_unshift($breadcrumbs, array(
+ 'title' => $container->name,
+ 'link' => $container_link,
+ ));
+ $container = get_entity($container->container_guid);
+ }
+ array_unshift($breadcrumbs, $first_crumb);
+ }
+}
+
+
+$class = 'elgg-menu elgg-breadcrumbs';
+$additional_class = elgg_extract('class', $vars, '');
+if ($additional_class) {
+ $class = "$class $additional_class";
+}
+
+if (is_array($breadcrumbs) && count($breadcrumbs) > 0) {
+ echo "<ul class=\"$class\">";
+ foreach ($breadcrumbs as $breadcrumb) {
+ if (!empty($breadcrumb['link'])) {
+ $crumb = elgg_view('output/url', array(
+ 'href' => $breadcrumb['link'],
+ 'text' => $breadcrumb['title'],
+ 'is_trusted' => true,
+ ));
+ } else {
+ $crumb = $breadcrumb['title'];
+ }
+ echo "<li>$crumb</li>";
+ }
+ echo '</ul>';
+}
diff --git a/mod/subgroups/views/default/subgroups/group_module.php b/mod/subgroups/views/default/subgroups/group_module.php
new file mode 100644
index 000000000..083e50b16
--- /dev/null
+++ b/mod/subgroups/views/default/subgroups/group_module.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * List subgroups on group profile page
+ *
+ * @package ElggSubgroups
+ */
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->subgroups_enable != "yes") {
+ return true;
+}
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "subgroups/owner/$group->guid/all",
+ 'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
+));
+
+$options = array(
+ 'type' => 'group',
+ 'container_guid' => $group->guid,
+ 'type' => 'group',
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+
+elgg_push_context('widgets');
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('subgroups:none') . '</p>';
+}
+if($group->canEdit()) {
+ $new_link = elgg_view('output/url', array(
+ 'href' => "subgroups/add/$group->guid",
+ 'text' => elgg_echo('subgroups:add'),
+ 'is_trusted' => true,
+ ));
+} else {
+ $new_link = false;
+}
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('subgroups:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));
diff --git a/mod/subgroups/views/default/subgroups/groups_i_can_edit.php b/mod/subgroups/views/default/subgroups/groups_i_can_edit.php
new file mode 100644
index 000000000..45b0c9e6e
--- /dev/null
+++ b/mod/subgroups/views/default/subgroups/groups_i_can_edit.php
@@ -0,0 +1,71 @@
+<?php
+
+if (!elgg_is_logged_in()) {
+ exit();
+}
+
+$q = sanitise_string(get_input('term'));
+
+// replace mysql vars with escaped strings
+$q = str_replace(array('_', '%'), array('\_', '\%'), $q);
+
+$user_guid = elgg_get_logged_in_user_guid();
+$entities = elgg_get_entities(array(
+ 'type' => 'group',
+ 'owner_guid' => $user_guid,
+ 'limit' => 0,
+));
+$entities = array_merge(
+ $entities,
+ elgg_get_entities_from_relationship(array(
+ 'type' => 'group',
+ 'relationship' => 'operator',
+ 'relationship_guid' => $user_guid,
+ 'limit' => 0,
+ ))
+);
+
+$all_entities = array();
+while (!empty($entities)) {
+ $entity = array_pop($entities);
+ $childs = elgg_get_entities(array(
+ 'type' => 'group',
+ 'container_guid' => $entity->guid,
+ ));
+ foreach ($childs as $child) {
+ array_push($entities, $child);
+ }
+ $all_entities[] = $entity;
+}
+
+$results = array();
+foreach ($all_entities as $entity) {
+
+ if (!preg_match("/^{$q}/i", $entity->name)) {
+ continue;
+ }
+
+ $output = elgg_view_list_item($entity, array(
+ 'use_hover' => false,
+ 'class' => 'elgg-autocomplete-item',
+ ));
+
+ $icon = elgg_view_entity_icon($entity, 'tiny', array(
+ 'use_hover' => false,
+ ));
+ $results[$entity->name . $entity->guid] = array(
+ 'type' => 'group',
+ 'name' => $entity->name,
+ 'desc' => strip_tags($entity->description),
+ 'guid' => $entity->guid,
+ 'label' => $output,
+ 'value' => $entity->guid,
+ 'icon' => $icon,
+ 'url' => $entity->getURL(),
+ );
+}
+
+ksort($results);
+header("Content-Type: application/json");
+echo json_encode(array_values($results));
+exit;
diff --git a/mod/subgroups/views/default/subgroups/subgroups_icons.php b/mod/subgroups/views/default/subgroups/subgroups_icons.php
new file mode 100644
index 000000000..dfd5b29fa
--- /dev/null
+++ b/mod/subgroups/views/default/subgroups/subgroups_icons.php
@@ -0,0 +1,11 @@
+<?php
+elgg_load_library('elgg:subgroups');
+
+$subgroups = get_subgroups($vars['entity']);
+foreach ($subgroups as $subgroup) {
+ echo elgg_view('icon/default', array(
+ 'entity' => $subgroup,
+ 'size' => 'tiny'
+ ));
+ echo " ";
+}