You are here

function zoomapi_get_meeting_for_entity in Zoom API 7.2

Get Meeting for Entity.

Parameters

string $entity_type: The type (node, user, etc.) of entity.

int|object $entity_id: The entity (or entity_id) the meeting is being created for.

Return value

array An array of the meeting setup.

1 call to zoomapi_get_meeting_for_entity()
zoomapi_get_meeting_recordings_for_entity in ./zoomapi.module
Get Entity Meeting Recordings.

File

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

Code

function zoomapi_get_meeting_for_entity($entity_type, $entity_id, $api_refresh = FALSE) {
  if (!is_numeric($entity_id)) {
    list($entity_id, , ) = entity_extract_ids($entity_type, $entity_id);
  }

  // We only expect a single record for any entity_type/entity_id. Just in case
  // that is a false assumption, sort by the created date DESC so we grab the
  // most recent record.
  $data = db_query("\n    SELECT\n      *\n    FROM {zoomapi_meetings_index}\n    WHERE entity_type = :entity_type\n    AND entity_id = :entity_id\n    AND realm = :realm\n    ORDER BY created DESC\n  ", [
    ':entity_type' => $entity_type,
    ':entity_id' => $entity_id,
    ':realm' => zoomapi_realm(),
  ])
    ->fetchAssoc();
  if ($api_refresh && !empty($data['id'])) {
    $data = zoomapi_get_meeting($data['id']);
  }
  return $data;
}