You are here

function certificate_admin_clear_form in Certificate 6.2

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

Form to clear certificate snapshots.

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

File

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

Code

function certificate_admin_clear_form() {
  $form = array();
  $header = array(
    array(),
    array(
      'data' => 'Title',
      'field' => 'n.title',
    ),
    array(
      'data' => 'Count',
      'field' => 'count',
    ),
  );
  $sql = "select *, count(cs.uid) as count from {certificate_snapshots} cs\n  left join {node} n on (cs.nid = n.nid)\n  group by cs.nid";
  $sql .= tablesort_sql($header);
  $result = db_query($sql);
  $nids = array();
  while ($row = db_fetch_object($result)) {
    $nids[$row->nid] = '';
    $form['cs']['title'][$row->nid]['#value'] = $row->title;
    $form['cs']['count'][$row->nid]['#value'] = $row->count;
  }
  $form['cs']['nids'] = array(
    '#type' => 'checkboxes',
    '#options' => $nids,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Clear',
  );
  return $form;
}