You are here

function bbb_meeting_attend in BigBlueButton 7

Same name and namespace in other branches
  1. 6 bbb.module \bbb_meeting_attend()

Redirect to big blue button instance; Menu callback

Parameters

OBJECT $node: A Drupal node object

1 string reference to 'bbb_meeting_attend'
bbb_menu in ./bbb.module
Implement HOOK_menu().

File

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

Code

function bbb_meeting_attend($node) {
  global $user;
  $url = array();
  $mode = 'attend';
  $meeting = bbb_get_meeting($node->nid);
  $params = array(
    'meetingID' => $meeting->meetingID,
    'password' => $meeting->attendeePW,
  );
  $status = bbb_api_getMeetingInfo($params);
  if ($status && property_exists($status, 'hasBeenForciblyEnded') && $status->hasBeenForciblyEnded == 'true') {
    drupal_set_message('The meeting has been terminated and is not available for attending.');
    drupal_goto('node/' . $node->nid);
  }
  drupal_set_title($node->title);
  if ($meeting->running) {
    if (BIGBLUEBUTTON_DISPLAY_MODE == 'blank') {
      bbb_redirect($node, $mode);
    }
  }
  else {
    if (variable_get('bbb_content_type_moderator_required_' . $node->type, FALSE)) {
      drupal_add_js('var bbb_check_status_url = ' . drupal_json_encode(url('node/' . $node->nid . '/meeting/status')), 'inline');
      drupal_add_js(drupal_get_path('module', 'bbb') . '/js/check_status.bbb.js');
      drupal_set_message(t('You signed up for this meeting. Please stay on this page, you will be redirected immediately after the meeting has started.'));
      return node_show($node, NULL);
    }
    else {
      if (empty($meeting->initialized)) {
        if ($data = bbb_create_meeting($node, (array) $params)) {

          // Update local data
          bbb_update_meeting($node, array_merge((array) $meeting, (array) $data));
        }
      }
      if (BIGBLUEBUTTON_DISPLAY_MODE == 'blank') {
        bbb_redirect($node, $mode);
      }
    }
  }
  $variables = array(
    'meeting' => $meeting,
    'mode' => $mode,
    'height' => BIGBLUEBUTTON_DISPLAY_HEIGHT,
    'width' => BIGBLUEBUTTON_DISPLAY_WIDTH,
  );
  return theme('bbb_meeting', $variables);
}