You are here

function bbb_form_alter in BigBlueButton 6

Same name and namespace in other branches
  1. 7 bbb.module \bbb_form_alter()

Implement HOOK_form_alter().

File

./bbb.module, line 229
Big Blue Button - Enables universities and colleges to deliver a high-quality learning experience.

Code

function bbb_form_alter(&$form, &$form_state, $form_id) {

  // Node type settings form
  if ($form_id == 'node_type_form') {
    $bbb_api_version = variable_get('bbb_api_version', NULL);
    $form['bbb'] = array(
      '#title' => t('Big Blue Button settings'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    if (!is_numeric($bbb_api_version)) {
      $form['bbb']['#value'] = '<p>' . t('Please go to the !page and setup your Big Blue button server.', array(
        '!page' => l(t('administration page'), 'admin/settings/bigbluebutton'),
      )) . '</p>';
    }
    else {
      $form['bbb']['bbb_content_type'] = array(
        '#type' => 'checkbox',
        '#title' => t('Treat this node type as meeting'),
        '#default_value' => variable_get('bbb_content_type_' . $form['#node_type']->type, FALSE),
      );
      $form['bbb']['bbb_content_type_show_links'] = array(
        '#type' => 'checkbox',
        '#title' => t('Show links to attend, moderate or terminate a meeting beneath the node'),
        '#default_value' => variable_get('bbb_content_type_show_links_' . $form['#node_type']->type, FALSE),
      );
      $form['bbb']['bbb_content_type_show_status'] = array(
        '#type' => 'checkbox',
        '#title' => t('Display meeting status on node'),
        '#default_value' => variable_get('bbb_content_type_show_status_' . $form['#node_type']->type, FALSE),
      );
      $form['bbb']['bbb_content_type_welcome'] = array(
        '#title' => t('Welcome message'),
        '#type' => 'textfield',
        '#default_value' => variable_get('bbb_content_type_welcome_' . $form['#node_type']->type, ''),
        '#maxlength' => 255,
        '#description' => t('A welcome message that gets displayed on the chat window when the participant joins. You can include keywords (%%CONFNAME%%, %%DIALNUM%%, %%CONFNUM%%) which will be substituted automatically.'),
      );
      $form['bbb']['bbb_content_type_dialNumber'] = array(
        '#title' => t('Dial number'),
        '#type' => 'textfield',
        '#default_value' => variable_get('bbb_content_type_dialNumber_' . $form['#node_type']->type, ''),
        '#maxlength' => 32,
        '#description' => t('The dial access number that participants can call in using regular phone.'),
      );
      $form['bbb']['bbb_content_type_moderatorPW'] = array(
        '#title' => t('Moderator password'),
        '#type' => 'textfield',
        '#default_value' => variable_get('bbb_content_type_moderatorPW_' . $form['#node_type']->type, ''),
        '#maxlength' => 32,
        '#description' => t('The password that will be required for moderators to join the meeting or for certain administrative actions (i.e. ending a meeting).'),
      );
      $form['bbb']['bbb_content_type_attendeePW'] = array(
        '#title' => t('Attendee password'),
        '#type' => 'textfield',
        '#default_value' => variable_get('bbb_content_type_attendeePW_' . $form['#node_type']->type, ''),
        '#maxlength' => 32,
        '#description' => t('The password that will be required for attendees to join the meeting.'),
      );
      $form['bbb']['bbb_content_type_logoutURL'] = array(
        '#title' => t('Logout URL'),
        '#type' => 'textfield',
        '#default_value' => variable_get('bbb_content_type_logoutURL_' . $form['#node_type']->type, ''),
        '#maxlength' => 255,
        '#description' => t('The URL that the Big Blue Button client will go to after users click the OK button on the <em>You have been logged out message</em>.'),
      );
    }
  }

  // Node edit form
  $node_type = $form['type']['#value'];
  if (drupal_substr($form_id, drupal_strlen($form_id) - 10, 10) == '_node_form' && bbb_is_meeting_type($node_type) && user_access('administer big blue button')) {
    if (is_numeric($form['nid']['#value'])) {
      $meeting = bbb_get_meeting($form['nid']['#value']);
    }
    $form['bbb'] = array(
      '#title' => t('Meeting settings'),
      '#type' => 'fieldset',
      '#description' => t("The following settings maybe changed until the meeting first starts."),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#tree' => TRUE,
    );
    $form['bbb']['welcome'] = array(
      '#title' => t('Welcome message'),
      '#type' => 'textfield',
      '#default_value' => variable_get('bbb_content_type_welcome_' . $node_type, ''),
      '#maxlength' => 255,
      '#description' => t('A welcome message that gets displayed on the chat window when the participant joins. You can include keywords (%%CONFNAME%%, %%DIALNUM%%, %%CONFNUM%%) which will be substituted automatically.'),
      '#attributes' => $meeting->meetingID ? array(
        'disabled' => 'disabled',
      ) : array(),
    );
    $form['bbb']['dialNumber'] = array(
      '#title' => t('Dial number'),
      '#type' => 'textfield',
      '#default_value' => variable_get('bbb_content_type_dialNumber_' . $node_type, ''),
      '#maxlength' => 32,
      '#description' => t('The dial access number that participants can call in using regular phone.'),
      '#attributes' => $meeting->meetingID ? array(
        'disabled' => 'disabled',
      ) : array(),
    );
    $form['bbb']['moderatorPW'] = array(
      '#title' => t('Moderator password'),
      '#type' => 'textfield',
      '#default_value' => variable_get('bbb_content_type_moderatorPW_' . $node_type, ''),
      '#maxlength' => 32,
      '#description' => t('The password that will be required for moderators to join the meeting or for certain administrative actions (i.e. ending a meeting).'),
      '#attributes' => $meeting->meetingID ? array(
        'disabled' => 'disabled',
      ) : array(),
    );
    $form['bbb']['attendeePW'] = array(
      '#title' => t('Attendee password'),
      '#type' => 'textfield',
      '#default_value' => variable_get('bbb_content_type_attendeePW_' . $node_type, ''),
      '#maxlength' => 32,
      '#description' => t('The password that will be required for attendees to join the meeting.'),
      '#attributes' => $meeting->meetingID ? array(
        'disabled' => 'disabled',
      ) : array(),
    );
    $form['bbb']['logoutURL'] = array(
      '#title' => t('Logout URL'),
      '#type' => 'textfield',
      '#default_value' => variable_get('bbb_content_type_logoutURL_' . $node_type, ''),
      '#maxlength' => 255,
      '#description' => t('The URL that the Big Blue Button client will go to after users click the OK button on the <em>You have been logged out message</em>.'),
      '#attributes' => $meeting->meetingID ? array(
        'disabled' => 'disabled',
      ) : array(),
    );
  }
}