You are here

function zoomapi_create_meeting in Zoom API 7.2

Create Zoom Meeting.

1 call to zoomapi_create_meeting()
zoomapi_create_meeting_for_entity in ./zoomapi.module
Create Meeting for Entity.

File

./zoomapi.module, line 587
Main file for the Zoom API module.

Code

function zoomapi_create_meeting($uid, array $params, array $context = []) {
  module_load_include('inc', 'zoomapi', 'zoomapi.api');
  $zoom_user_id = zoomapi_get_zoom_user_id($uid);
  if (!$zoom_user_id) {
    watchdog(__FUNCTION__, 'Unable to create Zoom meeting for user !uid. Unable to lookup Zoom account ID.', [
      '!uid' => $uid,
    ], WATCHDOG_ERROR);
    return FALSE;
  }
  if (empty($params['type'])) {
    $params['type'] = ZOOMAPI_MEETING_TYPE_DEFAULT;
  }
  if (empty($params['start_time']) || empty($params['duration'])) {
    unset($params['start_time']);
    unset($params['duration']);
    $params['type'] = ZOOMAPI_MEETING_TYPE_INSTANT;
  }
  elseif (is_numeric($params['start_time'])) {

    // If a timezone is provided the format the start timestamp using that
    // timezone. Otherwise use the server timezone.
    // @todo configuration to use host timezone?
    $params['timezone'] = !empty($params['timezone']) ? $params['timezone'] : variable_get('date_default_timezone', @date_default_timezone_get());
    $params['start_time'] = zoomapi_format_timestamp($params['start_time'], $params['timezone']);
  }
  drupal_alter('zoomapi_create_meeting', $params, $context);
  return zoomapi_api_create_meeting($zoom_user_id, $params, $context);
}