You are here

public function Meeting::get in BigBlueButton 8

Return a meeting object.

Parameters

mixed $id: Meeting ID.

\Drupal\Core\Session\AccountInterface|null $account: User instance.

bool $cached: Flag of returning cached results.

Return value

array Meeting info.

Overrides MeetingInterface::get

1 call to Meeting::get()
Meeting::delete in src/Service/Meeting.php
Delete meeting.

File

src/Service/Meeting.php, line 121

Class

Meeting
Class Meeting.

Namespace

Drupal\bbb\Service

Code

public function get($id, AccountInterface $account = NULL, $cached = TRUE) {
  if (empty($account)) {
    $account = $this->currentUser;
  }
  if (!isset(self::$meetings[$id]) || !$cached) {

    /** @var \BigBlueButton\Parameters\CreateMeetingParameters $meeting_created */
    $meeting_created = $this->meetingCollection
      ->get($id);
    if ($meeting_created) {
      $meeting_info = $this->api
        ->getMeetingInfo(new GetMeetingInfoParameters($meeting_created
        ->getMeetingId(), $meeting_created
        ->getModeratorPassword()));
      if ($meeting_info) {
        $url = [
          'attend' => $this->api
            ->joinMeeting(new JoinMeetingParameters($meeting_created
            ->getMeetingId(), $account
            ->getDisplayName(), $meeting_created
            ->getAttendeePassword())),
          'moderate' => $this->api
            ->joinMeeting(new JoinMeetingParameters($meeting_created
            ->getMeetingId(), $account
            ->getDisplayName(), $meeting_created
            ->getModeratorPassword())),
        ];
        $meeting = [
          'info' => $meeting_info,
          'created' => $meeting_created,
          'url' => $url,
        ];

        // Allow alteration for e.g. access control
        // Just implement hook_bbb_meeting_alter(&$data) {} in your module.
        $this->moduleHandler
          ->alter('bbb_get_meeting', $meeting);

        // Static cache.
        self::$meetings[$id] = $meeting;
      }
    }
  }
  return isset(self::$meetings[$id]) ? self::$meetings[$id] : [];
}