You are here

function certificate_certificate_load_all in Certificate 7.2

Same name and namespace in other branches
  1. 8.3 certificate.module \certificate_certificate_load_all()
  2. 6.2 certificate.module \certificate_certificate_load_all()
  3. 6 certificate.module \certificate_certificate_load_all()
  4. 7.3 certificate.module \certificate_certificate_load_all()
  5. 3.x certificate.module \certificate_certificate_load_all()

Public loader function for the full collection of certificates.

@todo cache?

Return value

An array of all certificates, keyed by node (certificate) ID.

3 calls to certificate_certificate_load_all()
certificate_get_template_options in ./certificate.module
Return an array of certificate templates suitable for use in an options form element.
certificate_mapping_form in ./certificate.admin.inc
Add mapping elements to a form.
certificate_type_mapping_form in ./certificate.admin.inc
Returns the form for the per-node certificate settings.

File

./certificate.module, line 233
Certificate module.

Code

function certificate_certificate_load_all() {
  $result = db_query("SELECT *, nid AS cid FROM {node} n WHERE type = :type ORDER BY title", array(
    ':type' => 'certificate',
  ));
  $certificates = array();
  while ($certificate = $result
    ->fetch(PDO::FETCH_ASSOC)) {
    $certificates[$certificate['cid']] = $certificate;
  }
  drupal_alter('certificate_template_options', $certificates);
  return $certificates;
}