You are here

function og_subgroups_edit_children_page in Subgroups for Organic groups 5.3

1 string reference to 'og_subgroups_edit_children_page'
og_subgroups_menu in ./og_subgroups.module
@file Maintains a hierarchy of group/subgroup relationships.

File

./og_subgroups.module, line 804
Maintains a hierarchy of group/subgroup relationships.

Code

function og_subgroups_edit_children_page($gid) {
  $node = node_load($gid);
  drupal_set_title(check_plain($node->title));
  $header = array(
    '',
    array(
      'data' => t('Group name'),
      'field' => 'name',
    ),
  );
  $result = db_query('SELECT og.nid, n.title FROM {og} og INNER JOIN {node} n where og.nid=n.nid AND og.nid <> %d', $gid);
  $options = array();
  while ($row = db_fetch_object($result)) {
    $options[$row->nid] = $row->title;
  }
  $selected = array();
  $selected = og_subgroups_get_children($gid);
  $form['subgroups'] = array(
    '#type' => 'checkboxes',
    '#default_value' => array_keys($selected),
    '#options' => $options,
    '#description' => t('Check all subgroups.'),
  );
  $form['op'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  $form['gid'] = array(
    '#type' => 'hidden',
    '#value' => $gid,
  );
  return $form;
}