You are here

function gdpr_consent_revision_list in General Data Protection Regulation 7

Returns a list of all the existing revision numbers.

Parameters

GdprConsentAgreement $agreement: The Consent Agreement entity.

Return value

array An associative array keyed by revision number.

1 call to gdpr_consent_revision_list()
gdpr_consent_agreement_revision_overview in modules/gdpr_consent/includes/gdpr_consent.admin.inc
Generates an overview table of older revisions of a Consent Agreement.

File

modules/gdpr_consent/includes/gdpr_consent.admin.inc, line 163
Admin pages file for the GDPR Consent module.

Code

function gdpr_consent_revision_list(GdprConsentAgreement $agreement) {
  $revisions = array();
  $result = db_query('SELECT r.revision_id, a.title, r.log, r.author_uid, a.revision_id AS current_revision, r.timestamp, u.name FROM {gdpr_consent_agreement_revision} r LEFT JOIN {gdpr_consent_agreement} a ON a.revision_id = r.revision_id INNER JOIN {users} u ON u.uid = r.author_uid WHERE r.id = :id ORDER BY r.revision_id DESC', array(
    ':id' => $agreement->id,
  ));
  foreach ($result as $revision) {
    $revisions[$revision->revision_id] = $revision;
  }
  return $revisions;
}