You are here

function bbb_get_meeting in BigBlueButton 6

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

Return a meeting object

9 calls to bbb_get_meeting()
bbb_block_meeting in ./bbb.module
Meeting details block
bbb_form_alter in ./bbb.module
Implement HOOK_form_alter().
bbb_link in ./bbb.module
Implement HOOK_link().
bbb_meeting_attend in ./bbb.module
Redirect to big blue button instance; Menu callback
bbb_meeting_end in ./bbb.module
Redirect to big blue button instance; Menu callback

... See full list

File

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

Code

function bbb_get_meeting($nid, $account = NULL, $cached = TRUE) {

  // Simple static cache
  static $meetings = array();
  if (!$account) {
    global $user;
    $account = $user;
  }
  if (!isset($meetings[$nid]) || !$cached) {
    $meeting = new stdClass();
    $meeting = db_fetch_object(db_query("SELECT * FROM {bbb_meetings} WHERE nid = %d", $nid));
    if ($meeting) {
      $meeting->running = bbb_api_isMeetingRunning(array(
        'meetingID' => $meeting->meetingID,
      ))->running ? TRUE : FALSE;
      $meeting->url = array(
        'attend' => bbb_api_join(array(
          'fullName' => $account->name,
          'meetingID' => $meeting->meetingID,
          'password' => $meeting->attendeePW,
        )),
        'moderate' => bbb_api_join(array(
          'fullName' => $account->name,
          'meetingID' => $meeting->meetingID,
          'password' => $meeting->moderatorPW,
        )),
        'end' => bbb_api_end(array(
          'meetingID' => $meeting->meetingID,
          'password' => $meeting->moderatorPW,
        )),
      );

      // Allow alteration for e.g. access control
      // Just implement hook_bbb_meeting_alter(&$data) {} in your module
      drupal_alter('bbb_meeting', $meeting);

      // Static cache
      $meetings[$nid] = $meeting;
    }
  }
  return isset($meetings[$nid]) ? $meetings[$nid] : FALSE;
}