You are here

public function BBBMeetingTypeController::moderate in BigBlueButton 8

Redirect to big blue button instance.

Parameters

\Drupal\Core\Entity\EntityInterface $node: A Drupal node Interface.

Return value

\Symfony\Component\HttpFoundation\Response|array Drupal render array.

1 string reference to 'BBBMeetingTypeController::moderate'
bbb_node.routing.yml in modules/bbb_node/bbb_node.routing.yml
modules/bbb_node/bbb_node.routing.yml

File

modules/bbb_node/src/Controller/BBBMeetingTypeController.php, line 170

Class

BBBMeetingTypeController
Class BBBMeetingTypeController.

Namespace

Drupal\bbb_node\Controller

Code

public function moderate(NodeInterface $node) {
  if (is_numeric($node)) {

    /** @var \Drupal\node\NodeInterface $node */
    $node = $this->nodeStorage
      ->load($node);
  }
  $mode = 'moderate';
  $meeting = $this->nodeMeeting
    ->get($node);
  $meeting_info = $meeting['info'];
  $params = [
    'meetingID' => $meeting->meetingID,
    'password' => $meeting->moderatorPW,
  ];
  $status = $this->api
    ->getMeetingInfo($params);
  if ($status && property_exists($status, 'hasBeenForciblyEnded') && $status
    ->hasBeenForciblyEnded() == 'true') {
    $this->messenger
      ->addStatus('The meeting has been terminated and is not available for reopening.');
    return new RedirectResponse(Url::fromRoute('entity.node.canonical', [
      'node' => $node
        ->id(),
    ], [
      'absolute' => TRUE,
    ]));
  }

  //    drupal_set_title($node->getTitle());
  // Implicitly create meeting.
  if (empty($meeting->initialized)) {
    if ($data = $this->nodeMeeting
      ->create($node, (array) $params)) {

      // Update local data.
      $this->nodeMeeting
        ->update($node, array_merge((array) $meeting, (array) $data));
    }
  }
  if ($this
    ->getDisplayMode() === 'blank') {
    $this
      ->attendRedirect($node, $mode);
  }
  return [
    '#theme' => 'bbb_meeting',
    '#meeting' => $meeting,
    '#mode' => $mode,
    '#height' => $this
      ->getDisplayHeight(),
    '#width' => $this
      ->getDisplayWidth(),
  ];
}