You are here

function certificate_templates_list in Certificate 6.2

Same name and namespace in other branches
  1. 6 certificate.admin.inc \certificate_templates_list()
  2. 7.2 certificate.admin.inc \certificate_templates_list()
  3. 3.x certificate.admin.inc \certificate_templates_list()

List of certificates with links to add and edit.

1 string reference to 'certificate_templates_list'
certificate_menu in ./certificate.module
Implementation of hook_menu().

File

./certificate.admin.inc, line 424
Administrative pages for Certificate module.

Code

function certificate_templates_list() {
  $certificates = array();
  $l = l('Create new certificate', 'node/add/certificate', array(
    'query' => drupal_get_destination(),
  ));
  $sql = "select * from {node} where type='certificate'";
  $result = db_query($sql);
  while ($row = db_fetch_array($result)) {
    $destination = drupal_get_destination();
    $certificates[] = array(
      'title' => $row['title'],
      'edit' => l(t('edit'), "node/{$row['nid']}/edit?{$destination}", array(
        'attributes' => array(
          'class' => 'edit-link',
        ),
      )),
      'delete' => l(t('delete'), "node/{$row['nid']}/delete?{$destination}", array(
        'attributes' => array(
          'class' => 'delete-link',
        ),
      )),
      'preview' => l(t('PDF'), "admin/build/certificates/templates/preview/{$row['nid']}", array(
        'attributes' => array(
          'class' => 'preview-link',
        ),
      )),
    );
  }
  return $l . theme_table(array(
    t('Title'),
    t('Edit'),
    t('Delete'),
    t('Preview'),
  ), $certificates);
}