You are here

function hosting_client_platform_access_form in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 client/hosting_client.module \hosting_client_platform_access_form()
  2. 7.3 client/hosting_client.module \hosting_client_platform_access_form()

Page callback for the client platform access form.

1 string reference to 'hosting_client_platform_access_form'
hosting_client_menu in client/hosting_client.module
Implementation of hook_menu().

File

client/hosting_client.module, line 639

Code

function hosting_client_platform_access_form($form, $node) {
  $form = array();
  $clients = isset($node->clients) ? $node->clients : array();
  if (count($clients)) {
    foreach ($clients as $client) {
      $client_node = hosting_get_client($client);
      $form['name'][$client] = array(
        '#type' => 'markup',
        '#value' => l($client_node->title, 'node/' . $client),
      );

      // Remove the label for the checkbox
      $clients[$client] = '';
    }
  }
  else {

    // No access control on this platform.
    $form['name']['all'] = array(
      '#type' => 'markup',
      '#value' => 'All clients have access to this platform.',
    );
  }
  $form['clients'] = array(
    '#type' => 'checkboxes',
    '#options' => $clients,
  );
  $form['header'] = array(
    '#type' => 'value',
    '#value' => array(
      array(
        'data' => t('Allowed clients'),
      ),
      array(
        'data' => t('Remove'),
      ),
    ),
  );
  $form['new_client'] = array(
    '#type' => 'textfield',
    '#title' => t('Grant a client access to this platform'),
    '#weight' => 2,
    '#autocomplete_path' => 'hosting_client/autocomplete/client',
    '#description' => t('This field allows you to grant a client access to this platform.
                         Remove all clients from this list to grant all clients access to this platform'),
  );
  $form['#theme'] = 'hosting_client_platform_access_form';
  $form['apply'] = array(
    '#type' => 'submit',
    '#value' => t('Apply'),
    '#access' => user_access('administer clients'),
    '#submit' => array(
      'hosting_client_platform_access_form_submit',
    ),
    '#weight' => 10,
  );
  return $form;
}