You are here

function certificate_templates_list in Certificate 3.x

Same name and namespace in other branches
  1. 6.2 certificate.admin.inc \certificate_templates_list()
  2. 6 certificate.admin.inc \certificate_templates_list()
  3. 7.2 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
Implements hook_menu().

File

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

Code

function certificate_templates_list() {
  $certificates = array();
  $sql = "SELECT * FROM {node} WHERE type = 'certificate' ORDER BY title";
  $result = db_query($sql);
  while ($row = $result
    ->fetch(PDO::FETCH_ASSOC)) {
    $destination = drupal_get_destination();
    $certificates[] = array(
      'title' => filter_xss_admin($row['title']),
      'edit' => l(t('edit'), "node/{$row['nid']}/edit", array(
        'query' => $destination,
        'attributes' => array(
          'class' => 'edit-link',
        ),
      )),
      'delete' => l(t('delete'), "node/{$row['nid']}/delete", array(
        'query' => $destination,
        'attributes' => array(
          'class' => 'delete-link',
        ),
      )),
      'preview' => l(t('PDF'), "admin/structure/certificates/templates/preview/" . $row['nid'], array(
        'attributes' => array(
          'class' => 'preview-link',
        ),
      )),
    );
  }
  return theme('table', array(
    'header' => array(
      t('Title'),
      t('Edit'),
      t('Delete'),
      t('Preview'),
    ),
    'rows' => $certificates,
    'empty' => t('No certificate templates have been added.'),
  ));
}