<?php $config = group_subtypes_get_config(); $dbprefix = elgg_get_config('dbprefix'); $query = "SELECT subtype FROM {$dbprefix}entity_subtypes WHERE type = 'group'"; $data = get_data($query); foreach ($data as $row) { if (!isset($config[$row->subtype])) { $config[$row->subtype] = array(); } } foreach ($config as $subtype => $options) { $mod = elgg_view('forms/admin/groups/subtypes/subtype', array('subtypes' => array_keys($config), 'subtype' => $subtype, 'options' => $options)); echo elgg_view_module('info', elgg_echo("group:{$subtype}"), $mod, array('class' => 'groups-subtypes-config-module')); } echo elgg_view('input/submit');
/** * Configure tools available to subtype * Called before the group edit form is rendered * * @param string $subtype Group subtype * @return void */ function group_subtypes_configure_tools($subtype) { $conf = group_subtypes_get_config(); if ($conf[$subtype]['preset_tools']) { elgg_set_config('group_tool_options', null); } else { $tools = elgg_get_config('group_tool_options'); if ($tools) { foreach ($tools as $key => $group_option) { if (!in_array($group_option->name, $conf[$subtype]['tools'])) { unset($tools[$key]); } } } elgg_set_config('group_tool_options', $tools); } }