You are here

function bbb_get_meeting in BigBlueButton 7

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

Return a meeting object

10 calls to bbb_get_meeting()
bbb_block_meeting in ./bbb.module
Meeting details block
bbb_form_alter in ./bbb.module
Implements 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 566
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();
    $result = db_query("SELECT * FROM {bbb_meetings} WHERE nid = :nid", array(
      ':nid' => $nid,
    ));
    $meeting = $result
      ->fetchObject();
    if ($meeting) {
      $meeting->running = bbb_api_isMeetingRunning(array(
        'meetingID' => $meeting->meetingID,
      ));

      // insert the recording option
      $recording = $meeting->record == 1 ? array(
        'record' => 'true',
      ) : array();
      $attend = array(
        'fullName' => format_username($account),
        'meetingID' => $meeting->meetingID,
        'password' => $meeting->attendeePW,
      );
      $moderate = array(
        'fullName' => format_username($account),
        'meetingID' => $meeting->meetingID,
        'password' => $meeting->moderatorPW,
      );
      $attend = array_merge($attend, $recording);
      $moderate = array_merge($moderate, $recording);
      $meeting->url = array(
        'attend' => bbb_api_join($attend),
        'moderate' => bbb_api_join($moderate),
      );

      // 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;
}