You are here

function pmorganization_admin_settings in Drupal PM (Project Management) 7

Admin settings form for pmproject module

1 string reference to 'pmorganization_admin_settings'
pmorganization_menu in pmorganization/pmorganization.module
Implements hook_menu().

File

pmorganization/pmorganization.module, line 476

Code

function pmorganization_admin_settings() {
  $form = array();
  $query = db_select('node', 'n')
    ->fields('n', array(
    'nid',
    'title',
  ))
    ->condition('status', 1)
    ->condition('type', 'pmorganization')
    ->addTag('node_access')
    ->orderBy('title', 'ASC');
  $result = $query
    ->execute();
  $organizations = array();
  while ($organization = $result
    ->fetchObject()) {
    $organizations[$organization->nid] = $organization->title;
  }
  if (count($organizations) > 0) {
    $form['pm_organization_nid'] = array(
      '#type' => 'select',
      '#title' => t('Host organization'),
      '#options' => $organizations,
      '#default_value' => variable_get('pm_organization_nid', 0),
      '#description' => t('The organization that owns this system'),
      '#weight' => -30,
    );
  }
  else {
    $form['pm_organization_nid'] = array(
      '#type' => 'item',
      '#title' => t('Host organization'),
      '#markup' => t('There are no Project Management Organizations in the system.') . '<br />' . l(t('Create a Project Management Organization'), 'node/add/pmorganization'),
    );
  }
  return system_settings_form($form);
}