class Meeting in BigBlueButton 8
Class Meeting.
@package Drupal\bbb\Service
Hierarchy
- class \Drupal\bbb\Service\Meeting implements MeetingInterface uses StringTranslationTrait
Expanded class hierarchy of Meeting
1 file declares its use of Meeting
- NodeMeeting.php in modules/
bbb_node/ src/ Service/ NodeMeeting.php
1 string reference to 'Meeting'
1 service uses Meeting
File
- src/
Service/ Meeting.php, line 22
Namespace
Drupal\bbb\ServiceView source
class Meeting implements MeetingInterface {
use StringTranslationTrait;
/**
* Current user.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* Entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Meetings storage.
*
* @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface
*/
protected $meetingCollection;
/**
* Logger.
*
* @var \Drupal\Core\Logger\LoggerChannelInterface
*/
protected $log;
/**
* Drupal API for BigBlueButton service.
*
* @var \Drupal\bbb\Service\Api
*/
protected $api;
/**
* Private key service.
*
* @var \Drupal\Core\PrivateKey
*/
protected $privateKey;
/**
* Meetings info cached collection.
*
* @var array
*/
protected static $meetings = [];
/**
* Meeting constructor.
*
* @param \Drupal\bbb\Service\Api $api
* Drupal API for BigBlueButton service.
* @param \Drupal\Core\PrivateKey $private_key
* Private key service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* Module handler.
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $keyvalue
* Keyvalue service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager.
* @param \Drupal\Core\Session\AccountInterface $current_user
* Current user instance.
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
* Logger factory.
*/
public function __construct(Api $api, PrivateKey $private_key, ModuleHandlerInterface $module_handler, KeyValueFactoryInterface $keyvalue, EntityTypeManagerInterface $entity_type_manager, AccountInterface $current_user, LoggerChannelFactoryInterface $logger_factory) {
$this->api = $api;
$this->privateKey = $private_key;
$this->currentUser = $current_user;
$this->entityTypeManager = $entity_type_manager;
$this->moduleHandler = $module_handler;
$this->meetingCollection = $keyvalue
->get('bbb_meetings');
$this->log = $logger_factory
->get('bbb');
}
/**
* {@inheritdoc}
*/
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] : [];
}
/**
* {@inheritdoc}
*/
public function update($key, CreateMeetingParameters $params) {
$this->meetingCollection
->set($key, $params);
return $key;
}
/**
* {@inheritdoc}
*/
public function create($key, CreateMeetingParameters $params) {
if ($data = $this->api
->createMeeting($params)) {
return $data;
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function store($key, CreateMeetingParameters $params) {
return $this
->update($key, $params);
}
/**
* {@inheritdoc}
*/
public function delete($key) {
if ($this->meetingCollection
->has($key)) {
$this->meetingCollection
->delete($key);
}
else {
$this->log
->warning($this
->t('Meeting @key not found during removal: It was removed before manually or never exists.', [
'@key' => $key,
]));
}
$meeting = $this
->get($key);
$params = new EndMeetingParameters($meeting->meetingID, $meeting->moderatorPW);
$request = $this->api
->endMeeting($params);
return $request;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Meeting:: |
protected | property | Drupal API for BigBlueButton service. | |
Meeting:: |
protected | property | Current user. | |
Meeting:: |
protected | property | Entity type manager. | |
Meeting:: |
protected | property | Logger. | |
Meeting:: |
protected | property | Meetings storage. | |
Meeting:: |
protected static | property | Meetings info cached collection. | |
Meeting:: |
protected | property | Module handler. | |
Meeting:: |
protected | property | Private key service. | |
Meeting:: |
public | function |
Create meeting. Overrides MeetingInterface:: |
|
Meeting:: |
public | function |
Delete meeting. Overrides MeetingInterface:: |
|
Meeting:: |
public | function |
Return a meeting object. Overrides MeetingInterface:: |
|
Meeting:: |
public | function |
Store meeting. Overrides MeetingInterface:: |
|
Meeting:: |
public | function |
Update meeting. Overrides MeetingInterface:: |
|
Meeting:: |
public | function | Meeting constructor. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |