function gs_prov_groups_get() { $DB = gs_db_master_connect(); if (!$DB) { return new GsError('Could not connect to database.'); } $mptt = new YADB_MPTT($DB, 'user_groups', 'lft', 'rgt', 'id'); $groups = $mptt->get_tree_as_list(null); if (!is_array($groups)) { return new GsError('Failed to get the list of groups'); } return $groups; }
<?php echo '<input type="hidden" name="u_prv_grp_ed" value="yes" />', "\n"; ?> <table cellspacing="1"> <tbody> <tr> <th style="width:180px;"> <?php echo __('Provisioning-Gruppe'); ?> </th> <td style="width:280px;"> <?php $mptt = new YADB_MPTT($DB, 'user_groups', 'lft', 'rgt', 'id'); $u_prv_groups = $mptt->get_tree_as_list(null); echo '<select name="u_prv_grp_id">', "\n"; echo '<option value=""'; if ($r['group_id'] == '') { echo ' selected="selected"'; } echo '>- ', __('keine'), ' -</option>', "\n"; if (is_array($u_prv_groups)) { $is_root_node = true; $root_level = 0; foreach ($u_prv_groups as $u_prv_group) { if ($is_root_node) { # skip root node $root_level = $u_prv_group['__mptt_level']; $is_root_node = false; continue;