You are here

function og_subgroups_outline in Subgroups for Organic groups 5.4

Same name and namespace in other branches
  1. 5 og_subgroups.module \og_subgroups_outline()

Implementation of function og_subgroups_outline() Handles all subgroups outline operations.

1 string reference to 'og_subgroups_outline'
og_subgroups_menu in ./og_subgroups.module
Implementation of hook_menu().

File

./og_subgroups.module, line 358
Maintains subgroups hierarchy created by the orgainc groups module.

Code

function og_subgroups_outline($nid) {
  $node = node_load($nid);

  // Get all accessible/ inaccesiable groups for the user.
  $options = og_subgroups_get_eligable_groups('accessibale');
  $inaccessibale = og_subgroups_get_eligable_groups('inaccessibale');
  $description = t('The parent group for this group node in the subgroups.');
  if ($inaccessibale) {
    $description .= '<br/>' . t("There are some groups which are inaccesible to you and their names appears as &lt;private group&gt;.");
  }
  $form['parent'] = array(
    '#type' => 'select',
    '#title' => t('Parent'),
    '#default_value' => $node->og_subgroups,
    '#options' => og_subgroups_tree($options, $node->nid, $inaccessibale),
    '#description' => $description,
  );
  $form['log'] = array(
    '#type' => 'textarea',
    '#title' => t('Log message'),
    '#description' => t('An explanation to help other group admins understand your motivations to change the subgroups.'),
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $nid,
  );
  if (isset($node->og_subgroups)) {
    $form['update'] = array(
      '#type' => 'submit',
      '#value' => t('Update subgroups'),
    );
    $form['remove'] = array(
      '#type' => 'submit',
      '#value' => t('Remove group from subgroups'),
    );
  }
  else {
    $form['add'] = array(
      '#type' => 'submit',
      '#value' => t('Set subgroups'),
    );
  }
  in_array($node->nid, $inaccessibale) ? $title = t('&lt;private group&gt;') : ($title = check_plain($node->title));
  drupal_set_title($title);
  return $form;
}