You are here

function certificate_certificate_load_all in Certificate 6

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. 7.3 certificate.module \certificate_certificate_load_all()
  4. 7.2 certificate.module \certificate_certificate_load_all()
  5. 3.x certificate.module \certificate_certificate_load_all()

Public loader function for the full collection of certificates.

In situations where the module's data rarely changes, or is being used frequently (for example, loaded and processed on every page load), this is a prime candidate for caching. See The Beginner's Guide to Caching at http://www.lullabot.com/articles/a_beginners_guide_to_caching_data for more details.

Return value

An array of all certificates, keyed by id.

4 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_sets_form in ./certificate.admin.inc
Form for certificate type.
certificate_settings_form in ./certificate.admin.inc
Form for field mapping allowed values to certificate templates.
certificate_type_mapping_form in ./certificate.admin.inc
Returns the form for the per-node certificate settings.

File

./certificate.module, line 458
Certificate module.

Code

function certificate_certificate_load_all() {
  $sql = "SELECT *,nid as cid FROM {node} node where type='certificate'";
  $result = db_query($sql);
  $certificates = array();
  while ($certificate = db_fetch_array($result)) {
    $certificates[$certificate['cid']] = $certificate;
  }
  drupal_alter('certificate_template_options', $certificates);
  return $certificates;
}